fix(metrics): web and Android tag plays with one source vocabulary, so a surface reads the same on either (#8075)
The recommendation metrics judge each surface against a baseline of manual plays. The web tagged only system mixes, so its radio, album, artist and history plays all sat in the baseline; Android tagged nearly everything, and its search, Liked-list, library-shuffle and artist-top plays fell to Other. The surface deltas depended on which client someone listened on. - The web sends the vocabulary Android uses: radio:<seed>, album:<id>, artist:<id>, artist-top:<id>, home:most_played and history, kept in web/src/lib/player/playSource.ts. - The baseline is now named in one place (isManualSource): no source, a search pick, or a Liked-list pick. - library_shuffle gets its own row, the random baseline the mixes exist to beat; artist-top counts as an artist play. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { TrackRef, RadioResponse } from '#lib/api/types.js';
|
||||
import { playSource } from './playSource';
|
||||
import { untrack } from 'svelte';
|
||||
import { api } from '#lib/api/client.js';
|
||||
import { user } from '#lib/auth/user.svelte.js';
|
||||
@@ -83,10 +84,11 @@ let _pendingRestorePosition: number | null = null;
|
||||
let _radioSeedId = $state<string | null>(null);
|
||||
let _radioRefreshInFlight = false;
|
||||
|
||||
// Which system playlist (if any) this queue was seeded from.
|
||||
// 'for_you' | 'discover' | null. Read by the events dispatcher so
|
||||
// play_started carries `source` and the play counts against that
|
||||
// playlist's rotation. Re-set on every playQueue (a fresh non-system
|
||||
// Where this queue was seeded from, in the playSource vocabulary: a system
|
||||
// playlist's variant ('for_you' | 'discover' | …), radio, an album, an
|
||||
// artist, … or null for a manual pick. Read by the events dispatcher so
|
||||
// play_started carries `source`: a mix's play counts against that
|
||||
// playlist's rotation, and every play lands on its surface in the metrics. Re-set on every playQueue (a fresh non-system
|
||||
// queue clears it).
|
||||
let _queueSource = $state<string | null>(null);
|
||||
|
||||
@@ -480,7 +482,10 @@ export async function playRadio(seedTrackId: string): Promise<void> {
|
||||
if (tracks.length === 0) return;
|
||||
// Hand the player a self-heal closure so a fully-stale radio queue
|
||||
// re-seeds from the same track instead of dead-ending.
|
||||
playQueue(tracks, 0, { refetch: () => fetchRadioTracks(seedTrackId) });
|
||||
playQueue(tracks, 0, {
|
||||
source: playSource.radio(seedTrackId),
|
||||
refetch: () => fetchRadioTracks(seedTrackId)
|
||||
});
|
||||
_radioSeedId = seedTrackId; // Set AFTER playQueue (which clears it)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user