fix: add FavQ and TopQ context types to playback context
The ContextType enum and v2_set_playback_context match were missing fav_q and top_q variants, causing an "Invalid context type" error that blocked all playback from FavQ and TopQ views. Also wrap setPlaybackContext calls in try/catch so context errors don't prevent track playback. Fixes #140
This commit is contained in:
4 files changed
+14
No files matched your search
@@ -8926,6 +8926,8 @@ pub async fn v2_set_playback_context(
|
||||
"home_list" => ContextType::HomeList,
|
||||
"daily_q" => ContextType::DailyQ,
|
||||
"weekly_q" => ContextType::WeeklyQ,
|
||||
"fav_q" => ContextType::FavQ,
|
||||
"top_q" => ContextType::TopQ,
|
||||
"favorites" => ContextType::Favorites,
|
||||
"local_library" => ContextType::LocalLibrary,
|
||||
"radio" => ContextType::Radio,
|
||||
|
||||
@@ -24,6 +24,8 @@ pub enum ContextType {
|
||||
HomeList,
|
||||
DailyQ,
|
||||
WeeklyQ,
|
||||
FavQ,
|
||||
TopQ,
|
||||
Favorites,
|
||||
LocalLibrary,
|
||||
Radio,
|
||||
@@ -129,6 +131,8 @@ impl PlaybackContext {
|
||||
ContextType::HomeList => "Home List",
|
||||
ContextType::DailyQ => "DailyQ",
|
||||
ContextType::WeeklyQ => "WeeklyQ",
|
||||
ContextType::FavQ => "FavQ",
|
||||
ContextType::TopQ => "TopQ",
|
||||
ContextType::Favorites => "Favorites",
|
||||
ContextType::LocalLibrary => "Local Library",
|
||||
ContextType::Radio => "Radio",
|
||||
|
||||
@@ -290,6 +290,7 @@
|
||||
|
||||
if (queueIndex < 0) return;
|
||||
|
||||
try {
|
||||
await setPlaybackContext(
|
||||
'fav_q',
|
||||
'favq',
|
||||
@@ -298,6 +299,9 @@
|
||||
queueTrackIds,
|
||||
queueIndex
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('Failed to set playback context:', err);
|
||||
}
|
||||
|
||||
try {
|
||||
await invoke('v2_set_queue', { tracks: queueTracks, startIndex: queueIndex });
|
||||
|
||||
@@ -403,6 +403,7 @@
|
||||
|
||||
if (queueIndex < 0) return;
|
||||
|
||||
try {
|
||||
await setPlaybackContext(
|
||||
'top_q',
|
||||
'topq',
|
||||
@@ -411,6 +412,9 @@
|
||||
queueTrackIds,
|
||||
queueIndex
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('Failed to set playback context:', err);
|
||||
}
|
||||
|
||||
try {
|
||||
await invoke('v2_set_queue', { tracks: queueTracks, startIndex: queueIndex });
|
||||
|
||||
Reference in new issue
Block a user