Skip to content

A set of scripts for downloading upcoming trailers from Apple and preparing a Plex pre-roll that replicates most of what the Cinema Experience Kodi plugin used to do.

License

Notifications You must be signed in to change notification settings

atnpgo/Plex-Cinema-Experience-Preroll

 
 

Repository files navigation

Plex-Cinema-Experience-Preroll

A set of python scripts for downloading upcoming trailers from Apple, randomly mixing them each time a movie is played, and playing them before movies in Plex as preroll trailers.

Forked and modified from Plex-Apple-Preroll-Trailers to whom most of the credit belongs.

Requirements

You will need to install these yourself but the installations should be fairly straightforward.

  • Python 3+

  • PlexAPI

  • Tautulli for automatically mixing trailers

    • If using the mac OS version, I recommend avoiding the .pkg installer since it bundles it's own version of python which makes installing PlexAPI more difficult.

Settings

Edit the settings.ini file. Here you can add your url and token for Plex, resolution settings, number of trailers to download, number of trailers to mix, and several optional video steps.

Usage

Downloads

You need to schedule a job for downloading trailers each week. I find that once per week is totally sufficient if you have download_number set to a decent value like 40 in your settings.ini file.

macOS or Linux:

crontab -e
30 3 * * fri python /path/to/scripts/download.py 2>&1

Windows:

Open the Control Panel and navigate to Administrative Tools > Task Scheduler. Then click "Create Basic Task Scheduler" and enter a name and description. Then set the task to run weekly and choose a day and time. For the action, choose "Start a program." For the "Program/script" add the location of your python installation. For the "Arguments" add the full path of the download.py script in double quotes (example: "C:\Users\username\Trailers\download.py"). Click "Finish" and you're all set.

Mixing

Open Tautulli and go to Settings > Notification Agents and add a new notification agent. The type should be "script" and you'll want to add the path to the folder the scripts are located in and select mix.py as your script in the configuration tab. Be sure to add a description for the script as well. Next, go to the triggers tab and check the box for "Playback Stop" and then go to the conditions tab and add a condition to only fire when "media type is movie". For the arguments tab, go to the "Playback Stop" section and add the code below. After that, be sure to save it and you're all set.

nopythonpath

Config

This is the order in which the video steps will be played:

  1. Trivia Intro
    • Plays a video from the trivia_intro folder
  2. Trivia
    • Plays a video from the trivia config
  3. Trivia Outro
    • Plays a video from the trivia_outro folder
  4. Theater Intro
    • Plays a video from the theatre_intro folder
  5. Trailers Intro
    • Plays a video from the trailers_intro folder
  6. Trailers
    • Plays X videos downloaded from the trailers website where X is the number specified in the mix_number config
  7. Sponsor Intro
    • Plays a video from the sponsor_intro folder
  8. Sponsor
    • Plays a video from the sponsor folder
  9. Countdown Video
    • Plays a video from the countdown folder
  10. Feature Presentation Intro
    • Plays a video from the feature_presentation folder
  11. Feature Presentation
    • The film you selected to play

All steps except Trailers and Feature Presentation are optional. Simply leave the folders empty or the configuration blank.

Running For The First Time

Since you just set up the scripts for the first time, you don't have any trailers downloaded yet so you need to manually run the script one time.

python /path/to/scripts/download.py

Mixing trivia videos

You can use the trivia-gen.py from my PlexScripts repo to automatically create your own pre-show trivia/pre-show entertainment video from a collection of slides and videos. Just like those that are projected before the movie starts in a theatre.

About

A set of scripts for downloading upcoming trailers from Apple and preparing a Plex pre-roll that replicates most of what the Cinema Experience Kodi plugin used to do.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%