Commit Graph
9 Commits
Author SHA1 Message Date
Jude SouthworthandClaude Opus 5.5 b75f66c205 Scrobble plays from the UI, and vary suggestions between rebuilds
Scrobbling: the UI reports "now playing" when a song starts, and a listen
once half of it (or 4 minutes) has actually been played. Library songs go
through Subsonic's scrobble endpoint, which keeps play counts and passes
them on to the user's Listenbrainz/Last.fm; YouTube songs go straight to
Listenbrainz with listenbrainz.token. discover.scrobble = false turns it
off. Also stops the previous YouTube video when moving to the next YouTube
song, as it played on while the next was looked up.

Fresher suggestions: each mix's suggestions are a random sample of its
best 3 x discovery_count candidates, weighted by fit squared, rather than
always the top ones. Suggestions left alone for a week expire, and stay
out of the mixes for 60 days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:22:57 +00:00
judeandClaude Opus 5.5 c84e7e715d Play new songs from YouTube in the browser
YouTube's bot checks block yt-dlp from fetching audio on the server, so
suggested songs now play in YouTube's embedded player, kept out of sight,
in the browser. yt-dlp is only used to search.

- GET /api/discover/youtube/<id> returns candidate video IDs, best first,
  or the one that played before (?refresh=true searches again).
- PUT /api/discover/youtube/<id> remembers the video that played.
- The UI tries the next candidate when a video can't be embedded, searches
  again when a remembered video is gone, and skips the song otherwise.
- Drop the YouTube audio proxy, and Deno from the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:59:40 +00:00
judeandClaude Opus 5.5 93e12cfc72 Create and delete genre mixes from the web UI
- Add a form to create a cluster mix rule: shown on first visit when there
  are no rules, and from a + in the sidebar for another Listenbrainz user.
  Backed by POST /api/discover/rules, which validates each setting and
  allows one rule per Listenbrainz user.
- Add deleting a user's mixes from a bin in the sidebar, optionally also
  deleting the mixes' playlists from Subsonic. Backed by
  DELETE /api/discover/rules/<id>?delete_playlists=true.
- Stop showing the previous user's mix while a new user's mixes build.
- Remove the per-account Listenbrainz token: LB Radio now always uses
  listenbrainz.token from the config. A migration drops the token columns
  from app_user, and PUT /api/auth/account/listenbrainz is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:45:52 +00:00
claude BotandClaude Opus 5.5 53c1bffa6d Require logging in to the web UI and API
The first visit to the UI creates the account from a username and password;
after that every API route needs a session cookie from logging in. Accounts
are stored in app_user (Argon2id password hashes) and sessions in
user_session (SHA-256 token hashes, 30 days).

The account page lets the user save a Listenbrainz token, checked with
Listenbrainz first. It takes priority over listenbrainz.token from the
config for LB Radio suggestions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:24:09 +00:00
Claude 77f9f29cc6 Build the web UI into the .deb
- Package discover/dist to /usr/share/playlistd/discover, and serve it
  from there in the default config. cargo deb refuses to package if the
  UI hasn't been built, rather than shipping without it.
- Install a pinned Node.js (22.23.4, checksum-verified) in the
  Containerfile; Ubuntu 22.04's is too old for Vite. The README's build
  command now builds the UI first.
- Recommend yt-dlp, for playing suggested songs from YouTube.
- If discover.ui points to a missing directory, warn instead of letting
  Rocket panic at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
2026-11-14 10:02:25 +00:00
Claude a594c56abc Set up logging properly
Rocket's logger was the only one, so messages from the daemons depended on
it having launched, and most messages bypassed logging with println!.

- Install env_logger at startup: level from log.level (LOG_LEVEL), with
  RUST_LOG overriding it. Rocket's per-request logs and sqlx's Postgres
  notices are kept to warnings.
- Under systemd, prefix lines with their syslog priority so journald
  records levels (journalctl -p warning works).
- Replace every println! with a log macro at a fitting level.
- Recurring failures are a warning when they start or change, debug while
  they repeat, and an info message when they recover.
- Listenbrainz errors are readable: an unknown user is "Listenbrainz user
  "x" doesn't exist" rather than a JSON decode error, and a period without
  stats yet (204) leaves the playlist alone instead of failing to decode.
  The UI's Refresh shows the same messages.
- Warnings name the playlist or rule they're about.
- Songs missing from the library are debug output, not errors every tick.
- Daemons no longer run twice at startup (interval's first tick is
  immediate), and a failing playlist rule or daemon is logged instead of
  panicking the task.
- Subsonic errors display as messages rather than Debug output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
2026-11-13 21:48:54 +00:00
Claude a8b1123777 Add discover UI with new song suggestions
Each mix rebuild now also finds songs that aren't in the library: the
user's Listenbrainz recommendations they've never played, plus an LB
Radio prompt per mix when a Listenbrainz token is configured. Each
candidate goes to the mix whose genre profile it fits best and is
skipped if it's already in the library or was played recently.

discover/ is a new React app to listen to the mixes: library songs
stream from Subsonic and suggested songs are found on YouTube with
yt-dlp, both proxied through playlistd with Range support for seeking.
Suggestions can be liked (kept in a "Liked new songs" list) or hidden.

- discover: candidate gathering, genre fit scoring, library filtering
- web: /api/discover routes, Subsonic/YouTube streaming proxy
- youtube: yt-dlp search (skipping hour-long results) and audio URLs
- mix tags now hold library genre names, for display in the UI
- config: listenbrainz.token, discover.ui, discover.ytdlp, discover.format

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
2026-11-13 16:39:46 +00:00
claude Bot a102fecc2e various 2024-04-20 19:10:49 +01:00
claude Bot 06ccea56d1 Add details for building 2024-04-16 20:37:42 +01:00