mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
clear_next_tracks
should never clear queued items
just mimics official client behavior
This commit is contained in:
parent
e6fe2ac00e
commit
f59b43b9c4
6 changed files with 7 additions and 12 deletions
|
@ -1057,7 +1057,7 @@ impl SpircTask {
|
||||||
fn handle_stop(&mut self) {
|
fn handle_stop(&mut self) {
|
||||||
self.player.stop();
|
self.player.stop();
|
||||||
self.connect_state.update_position(0, self.now_ms());
|
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) {
|
if let Err(why) = self.connect_state.reset_playback_to_position(None) {
|
||||||
warn!("failed filling up next_track during stopping: {why}")
|
warn!("failed filling up next_track during stopping: {why}")
|
||||||
|
@ -1136,7 +1136,7 @@ impl SpircTask {
|
||||||
self.connect_state.merge_context(context);
|
self.connect_state.merge_context(context);
|
||||||
|
|
||||||
// load here, so that we clear the queue only after we definitely retrieved a new 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();
|
self.connect_state.clear_restrictions();
|
||||||
|
|
||||||
debug!("play track <{:?}>", cmd.playing_track);
|
debug!("play track <{:?}>", cmd.playing_track);
|
||||||
|
|
|
@ -380,7 +380,7 @@ impl ConnectState {
|
||||||
debug!("has {} prev tracks", self.prev_tracks().len())
|
debug!("has {} prev tracks", self.prev_tracks().len())
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clear_next_tracks(true);
|
self.clear_next_tracks();
|
||||||
self.fill_up_next_tracks()?;
|
self.fill_up_next_tracks()?;
|
||||||
self.update_restrictions();
|
self.update_restrictions();
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ impl ConnectState {
|
||||||
Err(_) => {}
|
Err(_) => {}
|
||||||
}
|
}
|
||||||
// enforce reloading the context
|
// enforce reloading the context
|
||||||
self.clear_next_tracks(true);
|
self.clear_next_tracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.context = Some(new_context);
|
self.context = Some(new_context);
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl ConnectState {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clear_prev_track();
|
self.clear_prev_track();
|
||||||
self.clear_next_tracks(true);
|
self.clear_next_tracks();
|
||||||
|
|
||||||
let current_uri = self.current_track(|t| &t.uri);
|
let current_uri = self.current_track(|t| &t.uri);
|
||||||
|
|
||||||
|
|
|
@ -260,12 +260,7 @@ impl<'ct> ConnectState {
|
||||||
self.prev_tracks_mut().clear()
|
self.prev_tracks_mut().clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_next_tracks(&mut self, keep_queued: bool) {
|
pub fn clear_next_tracks(&mut self) {
|
||||||
if !keep_queued {
|
|
||||||
self.next_tracks_mut().clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// respect queued track and don't throw them out of our next played tracks
|
// respect queued track and don't throw them out of our next played tracks
|
||||||
let first_non_queued_track = self
|
let first_non_queued_track = self
|
||||||
.next_tracks()
|
.next_tracks()
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl ConnectState {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clear_prev_track();
|
self.clear_prev_track();
|
||||||
self.clear_next_tracks(false);
|
self.clear_next_tracks();
|
||||||
self.update_queue_revision()
|
self.update_queue_revision()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue