companion for plex-playlist-sync that adds missing songs to Plex playlists
This script is meant to be used in conjunction with plex-playlist-sync in Docker. It's probably possible to combine them into one but I don't have the skills for that. This script will read through the CSV files of missing songs generated by plex-playlist-sync (or any csv with title, artist etc, though the code would have to be changed), search for matching songs in your Plex library, and then add them to the appropriate Plex playlist. It will edit the CSV files to leave only the songs that it could not add to the playlist.
Set up the config file with your Plex info
Set up the run command to mount the folder with CSVs from plex-playlist-sync. Be sure to use the correct slashes for the path.
Build the docker image
Run the docker run command
I combined the build & run commands in the file but they can be split
The output looks like this:
Available Plex Libraries:
1. Music
2. Movies
3. Shows
Enter the number of the correct library: 1
You selected library: Music
Continue with this library (y/N)? y
INFO:root:Read 111 songs from All Songs - Spotify.csv:
INFO:root: {'title': 'DREAMS!', 'artist': 'The South Hill Experiment'}
...
INFO:root:Read 3 songs from Your Top Songs 2022 - Spotify.csv:
INFO:root: {'title': 'Bored Again!', 'artist': 'Buddy Ross'}
INFO:root: {'title': 'Off You', 'artist': 'Sherwyn'}
INFO:root: {'title': 'Oomph', 'artist': 'Brooke Candy'}
Do you want to process the CSV for playlist All Songs - Spotify (y/N)? y
INFO:root:Processing playlist: All Songs - Spotify
INFO:root:Searching for artist: The South Hill Experiment
INFO:root:Found track: The South Hill Experiment - DREAMS!
...
INFO:root:Searching for artist: Dog Orchestra
INFO:root:Found track: Dog Orchestra - Club Fragil
Add 104 tracks to playlist (y/N)? y
INFO:root:Successfully added 104 tracks to playlist.
INFO:root:Added 104 tracks to the playlist All Songs - Spotify.
...
Do you want to process the CSV for playlist Your Top Songs 2022 - Spotify (y/N)? y
INFO:root:Processing playlist: Your Top Songs 2022 - Spotify
...
INFO:root:Searching for artist: Brooke Candy
INFO:root:Found track: Brooke Candy - Oomph
Add 3 tracks to playlist (y/N)? y
INFO:root:Successfully added 3 tracks to playlist.
INFO:root:Added 3 tracks to the playlist Your Top Songs 2022 - Spotify.
All CSVs processed.
One or two tracks somtimes fall through the cracks and are not added to the playlist despite the script saying they are found.
Implement Spotify API connection to check order of playlists and update order of playlists on Plex once songs are added.
Need to implement album matching because some added tracks are incorrect (from a live album etc).