# playlistd A daemon and API for automatically updating Subsonic playlists from Listenbrainz data *Note: I've not actually tested this against Subsonic, only Navidrome* ## Building & running This is a standard Rust project and should be uncomplicated to build and run. It does read some environment variables: * `SUBSONIC_BASE`, your Subsonic instance's API base. For navidrome users, this is `:///rest` * `SUBSONIC_USERNAME`, your Subsonic username * `SUBSONIC_PASSWORD`, your Subsonic password * `DATABASE_URL`, the URL for a Postgres database * `DAEMON_INTERVAL`, how often to update playlists For deploying, these can be configured in `/etc/playlistd.toml`. ### Container build (Ubuntu 22.04) Build the image: ```sh podman build -t playlistd-22 -f Containerfile . ``` Then build the `.deb`. The `sqlx` query macros check queries against a live, migrated database at compile time, so the host's Postgres socket is mounted into the container. With rootless podman, the container's root maps to your host user, so local peer authentication works without a password: ```sh podman run --rm \ -v "$PWD":/mnt -w /mnt \ -v /var/run/postgresql:/var/run/postgresql \ -e DATABASE_URL='postgres://jude@%2Fvar%2Frun%2Fpostgresql/playlistd' \ playlistd-22 cargo deb ``` The package is written to `target/debian/`. ## How to use Each of these will work best when your music library is well organised with Musicbrainz metadata. ### Tracked playlist A tracked playlist is a single Subsonic playlist that tracks data from Listenbrainz. For example, a playlist that contains your top 15 songs from the past week. You can create a tracked playlist by inserting a row into the `tracked_playlist` table. ### Tracked playlist rule A tracked playlist rule is a time-based instruction to create a new tracked playlist. For example, a playlist every year that contains your top songs. You can create a tracked playlist rule by inserting a row into the `create_tracked_playlist` table. For a yearly top songs playlist, run the following: ```sql INSERT INTO create_tracked_playlist (id, name_template, playlist_size, tracking_user, tracking_type) VALUES (gen_random_uuid(), '%Y - Top 100', 100, 'jellywx', 'this_year'); ```