Plex Music Grabber is a tool that monitors your Plex TV Show library for missing theme music. Unfortunately not all shows on Plex have theme songs, so I wrote this script that automatically downloads theme songs.
- Download missing theme songs
- Works with TV shows, which are also provided by Plex
- Works with Movies, which are not provided by Plex.
- Supports movie/show folders named like:
Movie (year) {tmdb-12345}
- Mount the
/library
volume on your tv show directory - Choose a scan interval (seconds) of your liking
Docker CLI
docker run -d \
--name plex-music-grabber \
-v /path/to/tvshows:/library/tvshows \
-v /path/to/movies:/library/movies \
-e interval=3600 \
-e library_path=/library/tvshows,/library/movies \
--restart unless-stopped \
rutgernijhuis/plex-music-grabber
Docker Compose
version: "3.3"
services:
plex-music-grabber:
image: rutgernijhuis/plex-music-grabber
container_name: plex-music-grabber
volumes:
- ./my-library/movies:/library/movies
- ./my-library/tvshows:/library/tvshows
environment:
- interval=3600
- library_path=/library/movies,/library/tvshows
restart: unless-stopped
network_mode: default
library_path
variable needs one or more mounted paths to you library containing sub folders with media folders. Multiple paths needs to be comma seperated.
Add these environment variables:
telegram_chat_id
telegram_token
- Verify that the script is working by checking your show folders, the program should create a
theme.mp3
file. - Make sure Plex uses your local assets in your media. Go to
Plex > Settings > Agents > Shows > {one/all of your agents}
- Ensure
Local Media Assets(TV)
is checked. Optionally, you can change the priorities of where Plex should get your metadata from. - Go to a show in Plex and refresh it's metadata, the song should play :)
When you don't want a show folder to be searched for you can choose to ignore it.
Do so by adding a .themeignore
file in the directory
If you want to run it locally, I suppose you know what you are doing.
Tested on Python 3.9
pip install -r requirements.txt
Note Before running:
The script uses environment variables to locate your library and the interval time.
I used VSCode for developing and added them to ./vscode/launch.json
library_path="path/to/your/test/library"
interval=5
Or set env variables in your CLI.
Your library should be in the following structure:
- The
shows
path must be specified when starting the script. - All directories below
shows
will be searched for if they don't contain atheme.mp3
file. These directories need human readable names! - Everything below the show directory will be ignored.
shows/
├── Vinland Saga/
│ ├── S01E01.mkv
│ ├── S01E02.mkv
│ └── S01E03.mkv
├── Initial D/
│ ├── Season 1/
│ │ ├── S01E01.mkv
│ │ ├── S01E02.mkv
│ │ └── S01E03.mkv
│ └── theme.mp3
└── Game Of Thrones/
├── S01E01.mkv
├── S01E02.mkv
├── S01E03.mkv
└── theme.mp3
- Create a new tag
- run
update-image.sh