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,
|
"home_list" => ContextType::HomeList,
|
||||||
"daily_q" => ContextType::DailyQ,
|
"daily_q" => ContextType::DailyQ,
|
||||||
"weekly_q" => ContextType::WeeklyQ,
|
"weekly_q" => ContextType::WeeklyQ,
|
||||||
|
"fav_q" => ContextType::FavQ,
|
||||||
|
"top_q" => ContextType::TopQ,
|
||||||
"favorites" => ContextType::Favorites,
|
"favorites" => ContextType::Favorites,
|
||||||
"local_library" => ContextType::LocalLibrary,
|
"local_library" => ContextType::LocalLibrary,
|
||||||
"radio" => ContextType::Radio,
|
"radio" => ContextType::Radio,
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ pub enum ContextType {
|
|||||||
HomeList,
|
HomeList,
|
||||||
DailyQ,
|
DailyQ,
|
||||||
WeeklyQ,
|
WeeklyQ,
|
||||||
|
FavQ,
|
||||||
|
TopQ,
|
||||||
Favorites,
|
Favorites,
|
||||||
LocalLibrary,
|
LocalLibrary,
|
||||||
Radio,
|
Radio,
|
||||||
@@ -129,6 +131,8 @@ impl PlaybackContext {
|
|||||||
ContextType::HomeList => "Home List",
|
ContextType::HomeList => "Home List",
|
||||||
ContextType::DailyQ => "DailyQ",
|
ContextType::DailyQ => "DailyQ",
|
||||||
ContextType::WeeklyQ => "WeeklyQ",
|
ContextType::WeeklyQ => "WeeklyQ",
|
||||||
|
ContextType::FavQ => "FavQ",
|
||||||
|
ContextType::TopQ => "TopQ",
|
||||||
ContextType::Favorites => "Favorites",
|
ContextType::Favorites => "Favorites",
|
||||||
ContextType::LocalLibrary => "Local Library",
|
ContextType::LocalLibrary => "Local Library",
|
||||||
ContextType::Radio => "Radio",
|
ContextType::Radio => "Radio",
|
||||||
|
|||||||
@@ -290,6 +290,7 @@
|
|||||||
|
|
||||||
if (queueIndex < 0) return;
|
if (queueIndex < 0) return;
|
||||||
|
|
||||||
|
try {
|
||||||
await setPlaybackContext(
|
await setPlaybackContext(
|
||||||
'fav_q',
|
'fav_q',
|
||||||
'favq',
|
'favq',
|
||||||
@@ -298,6 +299,9 @@
|
|||||||
queueTrackIds,
|
queueTrackIds,
|
||||||
queueIndex
|
queueIndex
|
||||||
);
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to set playback context:', err);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await invoke('v2_set_queue', { tracks: queueTracks, startIndex: queueIndex });
|
await invoke('v2_set_queue', { tracks: queueTracks, startIndex: queueIndex });
|
||||||
|
|||||||
@@ -403,6 +403,7 @@
|
|||||||
|
|
||||||
if (queueIndex < 0) return;
|
if (queueIndex < 0) return;
|
||||||
|
|
||||||
|
try {
|
||||||
await setPlaybackContext(
|
await setPlaybackContext(
|
||||||
'top_q',
|
'top_q',
|
||||||
'topq',
|
'topq',
|
||||||
@@ -411,6 +412,9 @@
|
|||||||
queueTrackIds,
|
queueTrackIds,
|
||||||
queueIndex
|
queueIndex
|
||||||
);
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to set playback context:', err);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await invoke('v2_set_queue', { tracks: queueTracks, startIndex: queueIndex });
|
await invoke('v2_set_queue', { tracks: queueTracks, startIndex: queueIndex });
|
||||||
|
|||||||
Reference in new issue
Block a user