This script automates the retrieval of the top 50 trending movies and TV shows from Trakt. It then compares this data with your existing media library and creates symbolic links to a specified folder. These symbolic links serve as the foundation for a new library, facilitating easy access and organization.
- Trending Media Integration: Automatically pulls the top 50 trending movies and TV shows from Trakt.
- Dynamic Symlink Creation: Matches trending media with your existing collection and creates symbolic links in a defined folder.
- Library Organization: Establishes a structured library based on trending media, enhancing accessibility and usability.
-
Sorting by Trending Order: Movies and TV shows are sorted based on their trending order, facilitating easy identification and access.
-
Renaming Convention: Movies are renamed with a prefix '#' followed by a number corresponding to their trending order, enhancing clarity within the library.
-
For more accurate results: Movies folders should be named using the following format Name (year) [tmdbID] and shows folders should be named using the following format Name (tvdbID). This can be easily done im bulk using sonarr and radarr renaming option.
-
The Path for the Movies and Shows Library: The paths inside Plex for existing Movies and Shows libraries, must match the local path. E.g. if your movies localy are in /mnt/movies, the path in the existing movies library inside plex must be also /mnt/movies. This is a limitation of the symlinks.
-
Download and Setup:
- Download the repository ZIP file by navigating to
Code > Download Zip
and extract it to your preferred location.
- Download the repository ZIP file by navigating to
-
Trakt API Registration:
- Create a Trakt API by registering on Trakt and visiting Trakt API Applications.
-
Configuration:
- Edit the
config.yml
file and provide your Trakt client ID and client secret.- Replace
client_id: 'YOUR_TRAKT_CLIENT_ID'
with the client ID obtained from your Trakt API application. - Replace
client_secret: 'YOUR_TRAKT_CLIENT_SECRET'
with the client secret obtained from your Trakt API application.
- Replace
- Replace
/path/to/trending_movies_symlink
and/path/to/trending_tv_symlink
with the paths to two folders on your system where the symlinks will be created (e.g.,/mnt/trending_movies
and/mnt/trending_shows
). - Replace
/path/to/movie_storage
and/path/to/tv_show_storage
with the paths to the parent folders of your existing movies and TV shows (e.g.,/mnt/movies
and/mnt/shows
). - Replace
http://YOUR_PLEX_SERVER_IP:32400
with your Plex server's IP. - Replace
YOUR_PLEX_TOKEN
with your Plex token (Find Your Plex Token). - Replace
'YOUR_PLEX_MOVIES_LIBRARY_NAME'
with the desired name for a trending movie library (e.g., Trending Movies). Ensure this library is pre-created in Plex. - Replace
'YOUR_PLEX_TV_SHOWS_LIBRARY_NAME'
with the desired name for a trending TV library. Ensure this library is pre-created in Plex.
- Edit the
-
Installation and Execution:
- Open a terminal and navigate to the root folder containing
plex-trending.py
. - Install the required modules by executing
pip install -r requirements.txt
. - Ensure the
config.yml
is correctly configured. - Run the script using
python3 plex-trending.py
.
- Open a terminal and navigate to the root folder containing
-
Exclusion of Media:
- To ignore specific movies or TV shows from being added to the libraries, edit the
unwanted.json
file and add the TMDB or TVDB ID.
- To ignore specific movies or TV shows from being added to the libraries, edit the
-
Scheduling Automation:
- Schedule the script to run periodically, e.g., every 12 hours, by setting up a cron job:
- Open the crontab file by executing
crontab -e
. - Add the following line:
0 */12 * * * /usr/bin/python3 /path/to/your/plex-trending.py
. - Save and exit the editor (e.g., Ctrl+X, Y, Enter).
- Open the crontab file by executing
- Schedule the script to run periodically, e.g., every 12 hours, by setting up a cron job: