fix(context): fix playback context tracking bugs
Multiple critical fixes for context tracking: 1. Add 'local_library' to backend context type parser - Was rejecting 'local_library' causing "Invalid context type" error - Now properly recognized in set_playback_context command 2. Fix shuffle to not always start with first track - Removed logic that moved current track to front of shuffle - Now finds current track position in shuffled order instead - Shuffle is truly random, not biased to original order 3. Add missing await to all setPlaybackContext calls - PlaylistDetailView: await context creation - FavoritesView: make setFavoritesContext async + await calls - ArtistDetailView: await context creation - HomeView: await context creation - SearchView: await + use home_list type (search type doesn't exist) This fixes intermittent context tracking (race condition) Fixes: shuffle starting with first song, Local Library context error, intermittent playlist/favorites/artist/home/search context tracking cc
This commit is contained in:
1 parent
f2c3e8aedd
commit
ed7984a029
7 files changed
+24
-20
No files matched your search
@@ -525,15 +525,18 @@ impl QueueManager {
|
||||
order.swap(i, j);
|
||||
}
|
||||
|
||||
// If there's a current track, move it to the front
|
||||
if let Some(curr_idx) = state.current_index {
|
||||
if let Some(pos) = order.iter().position(|&x| x == curr_idx) {
|
||||
order.remove(pos);
|
||||
order.insert(0, curr_idx);
|
||||
}
|
||||
}
|
||||
|
||||
state.shuffle_order = order;
|
||||
state.shuffle_position = 0;
|
||||
|
||||
// If there's a current track, find its position in the new shuffle order
|
||||
// (don't move it to front, just update our position in the shuffled list)
|
||||
if let Some(curr_idx) = state.current_index {
|
||||
if let Some(pos) = state.shuffle_order.iter().position(|&x| x == curr_idx) {
|
||||
state.shuffle_position = pos;
|
||||
} else {
|
||||
state.shuffle_position = 0;
|
||||
}
|
||||
} else {
|
||||
state.shuffle_position = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user