feat(session): round-trip streamable, parental_warning, source_item_id_hint (#315)

The PersistedQueueTrack struct already had streamable and parental_warning
fields but the load path hardcoded streamable=true and parental_warning
=false because the columns didn't exist in queue_tracks. source_item_id
_hint was missing entirely.

Adds the three columns via the same idempotent ALTER-TABLE pattern the
existing migrations use, persists them in save_session, and reads them in
load_session. PersistedQueueTrack gains source_item_id_hint as an
Option<String> with serde default so saves from older builds deserialize
cleanly.

User-visible effect: a restored queue now keeps explicit-content badges,
unstreamable visual state, and Mixtape/Collection source-item ids
matching the live queue instead of resetting to defaults at every
launch. Backwards-compatible: columns get safe defaults for older rows
(streamable=1, parental_warning=0, hint=NULL) so users upgrading from
1.2.12 don't see a regression.

cc
This commit is contained in:
vicrodh committed 2026-05-13 12:41:58 -06:00
1 parent 7284568c40
commit 267440f541
3 files changed
+55 -5

No files matched your search

+6
View File
@@ -26,6 +26,12 @@ export interface PersistedQueueTrack {
// v2_play_track (Qobuz) instead of v2_library_play_track. Backend also
// keeps this in session_store; this interface just needs to carry it.
source?: string | null;
// Round-tripped fields, previously hardcoded on load. Persisting them
// means a restored queue matches the live one for explicit-content
// badges, unstreamable visual state, and Mixtape source association.
streamable?: boolean;
parental_warning?: boolean;
source_item_id_hint?: string | null;
}
export interface PersistedSession {
+10
View File
@@ -4200,6 +4200,9 @@
// older versions that didn't persist source. Without this, a
// restored local queue routed next-track auto-advance to Qobuz.
source: trk.source ?? (trk.is_local ? 'local' : undefined),
streamable: trk.streamable ?? true,
parental_warning: trk.parental_warning ?? false,
source_item_id_hint: trk.source_item_id_hint ?? null,
}));
await setQueue(tracks, session.current_index ?? 0, true);
@@ -4479,6 +4482,13 @@
// auto-advance routed to v2_play_track with library row ids — which
// Qobuz then "resolved" to whatever track happened to share the id.
source: track.source ?? (track.is_local ? 'local' : null),
// Round-trip explicit-content + unstreamable visual state + the
// Mixtape/Collection source-item id so a restored queue mirrors
// the live one. Backend defaults streamable=true, parental=false
// and source_item_id_hint=null for tracks saved by older builds.
streamable: track.streamable ?? true,
parental_warning: track.parental_warning ?? false,
source_item_id_hint: track.source_item_id_hint ?? null,
});
}