Skip to content

dbeley/playlist-versioning

Repository files navigation

playlists

My playlists under version control.

Requirements

  • Navidrome (with your library imported) - provides the Subsonic API for track lookups
  • python
  • bash
  • NAVIDROME_USER and NAVIDROME_PASSWORD environment variables
  • a list of your favorite tracks
  • a list of artists linked to a playlist (see below)

Navidrome matching

Create a text file (for example files/00_favorites-tracks.txt) containing your favorite tracks (one by line, with the format ARTIST - TRACK):

ARTIST1 - FAVORITE_TRACK1
ARTIST1 - FAVORITE_TRACK2
ARTIST2 - FAVORITE_TRACK3
ARTIST3 - FAVORITE_TRACK4
...

I personnaly export all my favorite tracks on last.fm with this script.

Set environment variables and run the navidrome_match.py script:

export NAVIDROME_USER="your_user"
export NAVIDROME_PASSWORD="your_password"
./navidrome_match.py files/00_favorites-tracks.txt

Additional environment variables (optional):

  • NAVIDROME_URL: Navidrome server URL (default: http://navidrome.docker-era.home)
  • LIBRARY_ROOT: Music library root path on the filesystem (default: /home/david/nfs/WDC14/Musique/)
  • NAVIDROME_MAX_WORKERS: Concurrent API requests (default: 10)

Output:

  • files/04_result-mplaylist.csv: tracks matched via Navidrome's API
  • files/05_result-mplaylist-missing.csv: tracks not matched

Playlist creation

You will need three files:

  • files/01_playlists.csv (fields: playlist_id;playlist_name):
1;Rock
2;Pop
  • files/02_artists.csv (fields: playlist_id;artist_name):
1;ARTIST1
1;ARTIST3
2;ARTIST2
2;ARTIST1

Those two files says "ARTIST1 and ARTIST3 songs will be added to the playlist Rock, and ARTIST1 and ARTIST2 songs to the Pop playlist".

Adding artists in multiple playlists is supported, just duplicate the entries with a different playlist id.

  • files/06_fix-missing-tracks.csv: manually add paths for the missing tracks in 05_result-mplaylist-missing.csv (fields: missing_track;path):
ARTIST1 - MISSING_TRACK1;PATH_TO_TRACK1
ARTIST2 - MISSING_TRACK2;PATH_TO_TRACK2
ARTIST2 - MISSING_TRACK3;PATH_TO_TRACK3
ARTIST3 - MISSING_TRACK4;PATH_TO_TRACK4

Run the create_playlists.py script (change the LOCAL_BASEPATH and BASEPATH global variable to your own):

python create_playlists.py

BASEPATH indicates what the matched tracks will be prefixed with. It's used to complete the paths as Navidrome uses internal paths and not full paths.

LOCAL_BASEPATH indicates the base path to delete after checking the validity of the manually inserted paths in 06_fix-missing-tracks.csv. The BASEPATH will then be used as a prefix.

By setting BASEPATH to /music/ and LOCAL_BASEPATH to /home/user/nfs/Musique/, the script will delete /home/user/nfs/Musique/ from the paths found in 06_fix-missing-tracks.csv and will create playlists using /music/ as base path. If you want to use your playlists on the same filesystem configuration, you can set LOCAL_BASEPATH and BASEPATH to the same value.

Output:

  • files/03_artists_NOT-FOUND.csv: artists not found in 02_artists.csv
  • files/07_fix-missing-tracks_NOT-FOUND.csv: missing tracks not found in 06_fix-missing-tracks.csv

If those files are empty you're good, otherwise just add entries in 02_artists.csv or 06_fix-missing-tracks.csv and restart the script create_playlists.py.

Exported playlists will be in the playlists folder.

Import

Playlists are synced to the music folder for Navidrome (which watches and imports playlists from a folder):

./navidrome_playlists.sh

My music folder is mounted under the /music/ folder in my Navidrome container (hence the /music/ prefix in create_playlists.py).

Jazz standards

The jazz_standards/ directory has its own workflow for building playlists of jazz standards by allowed artists.

About

My playlists under version control.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages