clear_next_tracks should never clear queued items

just mimics official client behavior
This commit is contained in:
Felix Prillwitz 2024-12-17 17:45:26 +01:00
parent e6fe2ac00e
commit f59b43b9c4
No known key found for this signature in database
GPG key ID: DE334B43606D1455
6 changed files with 7 additions and 12 deletions

View file

@ -1057,7 +1057,7 @@ impl SpircTask {
fn handle_stop(&mut self) {
self.player.stop();
self.connect_state.update_position(0, self.now_ms());
self.connect_state.clear_next_tracks(true);
self.connect_state.clear_next_tracks();
if let Err(why) = self.connect_state.reset_playback_to_position(None) {
warn!("failed filling up next_track during stopping: {why}")
@ -1136,7 +1136,7 @@ impl SpircTask {
self.connect_state.merge_context(context);
// load here, so that we clear the queue only after we definitely retrieved a new context
self.connect_state.clear_next_tracks(false);
self.connect_state.clear_next_tracks();
self.connect_state.clear_restrictions();
debug!("play track <{:?}>", cmd.playing_track);

View file

@ -380,7 +380,7 @@ impl ConnectState {
debug!("has {} prev tracks", self.prev_tracks().len())
}
self.clear_next_tracks(true);
self.clear_next_tracks();
self.fill_up_next_tracks()?;
self.update_restrictions();

View file

@ -237,7 +237,7 @@ impl ConnectState {
Err(_) => {}
}
// enforce reloading the context
self.clear_next_tracks(true);
self.clear_next_tracks();
}
self.context = Some(new_context);

View file

@ -47,7 +47,7 @@ impl ConnectState {
}
self.clear_prev_track();
self.clear_next_tracks(true);
self.clear_next_tracks();
let current_uri = self.current_track(|t| &t.uri);

View file

@ -260,12 +260,7 @@ impl<'ct> ConnectState {
self.prev_tracks_mut().clear()
}
pub fn clear_next_tracks(&mut self, keep_queued: bool) {
if !keep_queued {
self.next_tracks_mut().clear();
return;
}
pub fn clear_next_tracks(&mut self) {
// respect queued track and don't throw them out of our next played tracks
let first_non_queued_track = self
.next_tracks()

View file

@ -67,7 +67,7 @@ impl ConnectState {
}
self.clear_prev_track();
self.clear_next_tracks(false);
self.clear_next_tracks();
self.update_queue_revision()
}