Repository navigation
For You: suggestions from what you play, worked out locally - #14
Merged
Merged
Conversation
- Every song played for 30 s goes in a local log (~/.local/share/trill/plays). Seeds are the songs you play, each play counting half as much every 14 days; your newest liked songs fill in while the log is short. - Candidates: the radio of the top 4 seed songs, and the top songs of artists Spotify lists as related to your top 4 artists (the artist-page query trill already sends for play counts). Fetched in parallel, about 2 s. - Ranked locally: liked songs and "not interested" are left out, songs played a lot in the last 30 days are pushed down, and each further song by an artist counts half (3 at most). The Why column says where each one came from. - Opening it shows the last list from disk at once; it's worked out again after 12 h, or on R. - X on a For You song, or a ✦ smart-shuffle song, marks it not interested (kept in ~/.local/share/trill/not_interested); a playing ✦ song is skipped. Smart shuffle leaves them out too. - Fix: opening a list while another was still loading let the slow one replace it when it arrived. - The startup frame lists the same sidebar entries as the real one, so nothing jumps.
… or one artist's neighbours counting 0.8
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new sidebar entry, ✦ For You: 50 songs picked from what you actually play. The ranking happens on your machine, and every row says why it's there.
How it works
~/.local/share/trill/plays(unix time, uri, title, artist, about 100 bytes a song). It's only read when For You is worked out, so it costs no memory otherwise. While the log is short (under 15 songs), your 50 newest liked songs are seeds too, at half weight, fading over a month.apollostation request smart shuffle uses, first 25 songs;queryArtistOverviewthe artist page already sends for play counts. It lists related artists. The 12 strongest (earlier in a list counts more, and several seeds listing one artist add up) have their pages fetched for their top 4 songs;discover::rank). Candidates for the same song add up, and the strongest reason is kept. Liked songs, saved albums and followed artists, "not interested" songs and the seeds themselves are left out. A song played n times in the last 30 days counts 1/(1+n). Then a greedy pick in which each further song by the same first artist counts half (at most 3 per artist), and each further song from the same source (one seed's radio, one artist's neighbours) counts 0.8, so the sources mix. Genres aren't in the metadata trill gets, so variety comes from artists and sources.radio · <seed song>orlike <your artist>, in the column blends use for "For".~/.cache/trill/lists/trill_foryou). Opening For You shows it at once (5 ms in tmux) and only works it out again after 12 h, or onR(about 2 s).X= not interested, on a For You song or a ✦ smart-shuffle song. It's kept in~/.local/share/trill/not_interested. The song leaves For You at once, a ✦ song leaves the queue (and is skipped if playing), and smart shuffle leaves it out from then on.What goes to Spotify
Through the same session and the same endpoints trill already uses for browsing, artist pages and smart shuffle: up to 4 seed song ids (radio), up to 40 of your top song ids (to look up their artists), up to 16 artist ids (artist pages), and the ids of the songs suggested (titles and covers). That's about 20 requests per refresh, at most once every 12 h unless you press
R. The play log and the not-interested list never leave the machine.Also fixed
show(), so every caller is covered.Tested
cargo test: new tests for the decay weights, the liked-song fallback, the 30-day counts, ranking (merging, exclusion, push-down, artist damping and cap, reasons) and the artist-overview parser.cargo clippywith 0 warnings. The help-layout test still fits (lyrics, art and theme now share a line, to make room for X).R(2.2 s, the X'd song stays out),Xin For You (the row goes, the file gets one line),Xon a ✦ song in the queue (it leaves), and the play log after 30 s of a song.