Add genre mixes from clustering recent listens

A new cluster_mix_rule clusters a Listenbrainz user's listens from the
last few months by MusicBrainz genre (with tracks played in the same
session pulled together) and maintains one Subsonic playlist per cluster,
filled with the cluster's most played tracks plus unheard library songs
from the best matching library genres.

- listenbrainz: fetch raw listens since a timestamp and bulk recording
  genres, handling rate limits
- cluster: tag TF-IDF + co-listen smoothing, spherical k-means with k
  chosen by silhouette score
- mix: match cluster profiles to library genres and pick songs, with a
  per-artist cap; reuse playlists across rebuilds by genre overlap
- subsonic: getGenres, getSongsByGenre, rename/delete playlist, genre and
  MBID fields on tracks, API error detection
- daemon, migration, POST/GET /api/playlist/mix and README docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
This commit is contained in:
Claude committed 2026-11-13 14:53:29 +00:00
1 parent e082209bd2
commit 18b3f0974e
13 files changed
+1728 -5

No files matched your search

+4 -2
View File
@@ -9,7 +9,7 @@ description = "Subsonic playlist daemon"
[dependencies]
rocket = { version = "0.5.0", features = ["json"] }
tokio = { version = "1.0", features = ["full"] }
sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres", "uuid"] }
sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres", "uuid", "chrono"] }
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
uuid = { version = "1.7", features = ["v4", "serde"] }
@@ -17,7 +17,9 @@ md5 = "0.8.0"
thiserror = "2.0.17"
config = "0.15.19"
log = "0.4.21"
chrono = "0.4.38"
chrono = { version = "0.4.38", features = ["serde"] }
rand = "0.8"
serde_json = "1.0"
[package.metadata.deb]
depends = "$auto"