Commit graph sonda/internal/smart
Author SHA1 Message Date
tgiachi
d3695d00d6 feat(smart): smart playlists by the year a song came out
I can now ask for songs from a year to a year, for example the eighties.

- The year is read from the tags of each file (the original date first, then the date) and kept on the track: migration 0028 adds tracks.year (SQLite and PostgreSQL).
- Two new rules, min_year and max_year, both included and checked (1000 to 2999, the first not after the second). The index answers them. A song with no year never matches.
- Files indexed before have no year until a full rescan reads their tags again; the editor and the API description say so.
- The smart playlist editor gets From year and Up to year, and the rules are described in words.
- English and Italian.
2026-11-14 10:19:39 +01:00
tgiachi
82b92eaf08 feat(smart): covers on the Smart playlists page
- GET /smart-playlists/{id}/covers and GET /smart-playlists/suggested/{key}/covers say which albums stand for a smart playlist: up to 4 albums that have a cover, in the order of the songs the rules give now (for the variant asked), each once. They are worked out apart from the songs, and the answer may be kept for a few minutes.
- The cards of the Smart playlists page are a grid with the collage. The list shows at once and each card asks for its own covers after that, showing the rings until they arrive or when they cannot be read.
- The pages of a smart playlist and of a suggested one use the same covers for the variant on screen, so only albums that have a cover are shown.
2026-11-13 11:41:23 +01:00
tgiachi
bf5c108785 feat(smart): the songs I play most, in rotation lately and over the year
- A smart playlist rule, plays_within_days, that counts only the plays of the last N days where plays are counted: the minimum of plays and the most and least played orders. The other listening rules are not changed.
- Two more suggested smart playlists on it: on-rotation (the most played of the last 30 days, at least twice) and top-year (the same over 365 days). most-played stays as the plays of all time.
- The editor has the new rule and the page says it in words. Texts in English and Italian.
2026-11-13 10:44:55 +01:00
tgiachi
23ae396430 feat(naming): names for playlists, with the Claude API as an option
- A pipeline over the facts about a list of songs (up to 5 genres, up to 8 artist names, how many songs, a few words about the rules of a smart playlist, the language). A local namer builds a name from the genres and the artists on this server and is always there; Claude is asked first only when an admin turned the new anthropic provider on with an API key. A failure or a refusal gives the local name. What Claude answers is kept under a hash of the facts, so the same question is not asked or paid twice.
- The anthropic provider: a write-only key (kept as typed, it is case-sensitive), a test that reads one model and sends no text, and a plain statement of what is sent. It uses the official Go SDK with nothing taken from the environment of the server (no key, profile, base URL or extra headers), no redirects, no system headers, and an answer that is cleaned and bounded.
- POST /playlists/{id}/suggest-name, POST /mixes/{id}/suggest-name and POST /smart-playlists/{id}/suggest-name answer with a name, a description and where it came from.
2026-11-13 10:33:48 +01:00
tgiachi
17f70d582d feat(smart): smart playlists made for everybody, without making them
- A fixed set that is there with no setup: recently added, never played, most played, not heard for a while, high quality files and long tracks. The rules are the same for everyone and are worked out on each one's own library and history, like the mixes; nothing is stored, so they follow the library.
- GET /smart-playlists/suggested, GET /smart-playlists/suggested/{key}/tracks and POST /smart-playlists/suggested/{key}/playlist.
- The Smart playlists page begins with them, with names and descriptions in the language of the page. A suggested one can be played, shuffled again, kept as a playlist, or made one's own: a copy of its rules opens in the editor.
2026-11-13 10:06:58 +01:00
tgiachi
a607070149 feat(smart): GET /genres, the genres of the library to choose from
Each genre with the number of playable songs, the biggest first and by name among equals. The spellings the files have are one genre, written the way the rules compare them, and tags such as other or unknown are left out.
2026-11-13 09:46:03 +01:00
tgiachi
104e41d10a feat(smart): smart playlists, playlists made of rules
A smart playlist is a set of rules, an order and a limit, kept under a name and worked out again every time it is opened.

- Rules (all that are set must hold): genres, artists and albums (is, or is not), file formats and a minimum bitrate of the same file, added in the last N days, never played, played or not played in the last N days, played at least N times, skipped or not skipped lately, only liked artists or without the avoided ones, and the length of the song.
- Orders: random (the same all day, a variant gives another), most played, least played, recently added, by title. A limit of 50 by default, 500 at most.
- GET/POST /smart-playlists, GET/PATCH/DELETE /smart-playlists/{id}, GET /smart-playlists/{id}/tracks, POST /smart-playlists/preview to try rules without keeping them, and POST /smart-playlists/{id}/playlist to keep what is shown as a normal playlist.
- Only the rules are stored (migration 0020); the songs come from the files and from the owner's own history and taste. Nothing is sent to a provider, and a smart playlist is its owner's alone. A user can have 200.
- Mixes and smart playlists share the way a list of songs becomes a playlist.
2026-11-13 09:36:52 +01:00