Skip to content

Darbunderscore/PlexTheaterTrailers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plex Theater Trailers

This project is a fork of TheaterTrailers by Electronickss and 99% of the code is still his. Other contributors are: TristBella.

This is a Python script that automates the downloading of movie trailers from YouTube using youtube-dl. Moive trailers are downloaded if their release date hasn't been reached. The videos will auto-delete when the movie is released. Files and folders are named with the standard naming convetions of Plex and The Movie DB. A "Coming Soon" image is copied in as poster.jpg and two versions of the trailer are stored. One is stored with -trailer in the name so Plex recognizes it as the trailer and the other is recognized as the movie.

NOTE: Because of how this function is implemented, the Recently Released Movies and Recently Added in Movies categories will be populated with the "fake" movies. This is due to Plex only playing trailers for movies already in the Library. Also, the selection of trailers is random across all movies in the library. It is recommended to delete any existing trailers before implementing this script.

Fixes/Changes from Forked TheaterTrailers Project:

  1. checkcashe function: Made it compatible with python3.
  2. videodownloader function: Now deletes the youtube_dl cache before each download to cut down on 403: forbidden errors
  3. videodownloader function: Added a 3 second pause after download to account for post-processing and to eliminate file copy errors
  4. videodownloader function: Performing a chmod on the downloaded file and poster.jpg to 777 to resolve access issues if you're using a different user for the cron job
  5. videodownloader function: Fixed some glitches with file copies when you're using a custom library location in the .config
  6. Misc. fixes by TristBella via theatertrailers.txt
  7. cleanup function: Now references trailerLocation variable instead of the default Trailers directory so cleanup can be ran even if using non-default location.
  8. Checks for trailers.conf and non-default, non-empty value for TMDB API key.

Why?

This application adds to the cinematic feel of your Plex setup by adding trailers of unreleased movies to your library and apparently really pisses off the wife!


Screenshot

Plex Web View


Installation

From within your OS

  1. Install Python. This module supports 2.7.x. 3.x support can be spotty. Raise a github issue if you spot a compatibility error
    • Python for Windows can be found here
  2. Install PIP if it isn't already present
  3. Install youtube_dl
    • pip install --upgrade youtube_dl
  4. Install tmdbsimple
    • pip install tmdbsimple
  5. Sign up at The Movie DB for an account and get a personal api key
    • A walk-through can be found here
  6. (Optional) Get your Plex token off of Plex Web
  7. Clone this repository or download it where you want it
    • git clone suggested
  8. Edit the config file to include your API keys. Remove example from the trailers.conf file title. Adjust other settings as necessary
  9. This script can be run manually like any other script or configured with Cron/Windows Task Scheduler.
    • Cron examples can be found here

From within Plex

  1. Add a folder inside of the Movie library that you want trailers, to /directoryTo/TheaterTrailers/Trailers/ or C:\directoryTo\TheaterTrailers\Trailers

    • Note that trailers in different libraries are not shared
  2. Enable trailers on your server

    • Check the option in Settings > Server > Extras > Include Cinema Trailers from movies in my library
  3. Enable trailers on your client

    • Plex Web: Set the number of trailers in Settings > Web > Player > Cinema Trailers to Play Before Movies
  4. TheaterTrailers copies over a "Coming Soon" poster so that users know it's a trailer. For that to be set to default, local media assets needs to be set as priority within your agents. Go to Settings > Server > Agents then adjust within each agent


Credit

Thank you to the youtube-dl team and to Electronickss!

This product uses the TMDb API but is not endorsed or certified by TMDb


About

Watch the same trailers as the movie theater plays before their movies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%