maddox/cadence

Automatically build playlists that show up in Plexamp.

★ 1Forks 0GoGitHub ↗Compare

README

Cadence

Four Daily Mix playlists in your Plex library, rebuilt every morning.

Like Spotify's Daily Mixes, except built from the music you already own and running entirely on your own server.

Daily Mix 1 Fast and intense
Daily Mix 2 Upbeat
Daily Mix 3 Midtempo
Daily Mix 4 Chill

They appear as ordinary playlists in Plex and Plexamp, with cover art. Mix 1 is always the energetic one, so you learn the numbers once — but the songs are different every day, and a track won't come back to the same mix for two weeks.

Roughly half of each playlist is music you actually listen to, and half is music you own but have forgotten about.

What you need

  • Plex Pass. Cadence relies on Plex's sonic analysis, which is a Plex Pass feature. Before starting, go to your music library in Plex and run Settings → Library → Analyze. Without it Cadence will refuse to start and tell you so.
  • A machine that can run Docker, on the same network as your Plex server.

Getting started

Make a docker-compose.yml:

services:
  cadence:
    build: .
    restart: unless-stopped
    environment:
      PLEX_URL: http://192.168.1.100:32400
      PLEX_TOKEN: your-plex-token
      # The library name exactly as it appears in Plex's sidebar
      PLEX_MUSIC_LIBRARY: Music
      # Your timezone, so the 4am rebuild happens at 4am your time
      TZ: America/Chicago
    ports:
      - "8973:8973"
    volumes:
      - cache:/app/.cache
      # Prefer a folder on your disk? Swap the line above for the two below,
      # using your own `id -u` and `id -g`. The named volume needs neither.
      # - /path/on/your/disk:/app/.cache
    # user: "1000:1000"
    stop_grace_period: 30s

volumes:
  cache:

Start it:

docker compose up -d
docker compose logs -f

The first start takes about five minutes. Cadence asks Plex about every track in your library once, to learn which songs sound alike, and remembers the answer. After that a rebuild takes under a minute. Watch the logs and you'll see it finish, then four new playlists appear in Plex.

That's everything. It rebuilds them at 4am each day and otherwise stays out of the way. curl localhost:8973/status says when it last ran, when it runs next, and how each playlist turned out.

Finding your Plex token

Open Plex in a browser, click any song, choose Get Info, then View XML. Look at the URL of the page that opens: it contains X-Plex-Token= followed by a long string. That string is your token.

Settings

Everything is optional except the two Plex values. Add any of these to environment: in your compose file.

Setting Default What it does
PLEX_URL — Required. Your Plex server, e.g. http://192.168.1.100:32400
PLEX_TOKEN — Required. See above
PLEX_MUSIC_LIBRARY Music Your library's name, exactly as Plex shows it
TZ UTC Your timezone
CADENCE_DAILY_AT 04:00 What time to rebuild, 24-hour clock
CADENCE_TRACK_COUNT 35 Songs per playlist
CADENCE_MAX_PER_ARTIST 2 Most songs allowed from one artist. It aims for one and only goes higher if a playlist can't be filled otherwise
CADENCE_FAMILIAR_SHARE 0.5 How much should be music you already play. 0.5 is half; 0 means only things you've never played
CADENCE_PLAYLIST_PREFIX none Put something in front of the playlist names
CADENCE_HTTP_ADDR :8973 Where the status page listens
LOG_LEVEL INFO Set to DEBUG for much more detail

More

License

MIT

Contributors

maddox

Issues