mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
connect: fix incorrect stopping
This commit is contained in:
parent
cd9f822c90
commit
b13ab3aa1b
3 changed files with 12 additions and 2 deletions
|
@ -1042,7 +1042,7 @@ impl SpircTask {
|
|||
self.connect_state.update_position(0, self.now_ms());
|
||||
self.connect_state.clear_next_tracks(true);
|
||||
|
||||
if let Err(why) = self.connect_state.fill_up_next_tracks() {
|
||||
if let Err(why) = self.connect_state.reset_playback_to_position(None) {
|
||||
warn!("failed filling up next_track during stopping: {why}")
|
||||
}
|
||||
}
|
||||
|
@ -1343,7 +1343,6 @@ impl SpircTask {
|
|||
self.load_track(continue_playing, 0)
|
||||
} else {
|
||||
info!("Not playing next track because there are no more tracks left in queue.");
|
||||
self.connect_state.reset_playback_to_position(None)?;
|
||||
self.handle_stop();
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -348,9 +348,15 @@ impl ConnectState {
|
|||
}
|
||||
|
||||
pub fn reset_playback_to_position(&mut self, new_index: Option<usize>) -> Result<(), Error> {
|
||||
debug!(
|
||||
"reset_playback with active ctx <{:?}> fill_up ctx <{:?}>",
|
||||
self.active_context, self.fill_up_context
|
||||
);
|
||||
|
||||
let new_index = new_index.unwrap_or(0);
|
||||
self.update_current_index(|i| i.track = new_index as u32);
|
||||
self.update_context_index(self.active_context, new_index + 1)?;
|
||||
self.fill_up_context = self.active_context;
|
||||
|
||||
if !self.current_track(|t| t.is_queue()) {
|
||||
self.set_current_track(new_index)?;
|
||||
|
|
|
@ -333,6 +333,11 @@ impl<'ct> ConnectState {
|
|||
self.next_tracks_mut().push(track);
|
||||
}
|
||||
|
||||
debug!(
|
||||
"finished filling up next_tracks ({})",
|
||||
self.next_tracks().len()
|
||||
);
|
||||
|
||||
self.update_context_index(self.fill_up_context, new_index)?;
|
||||
|
||||
// the web-player needs a revision update, otherwise the queue isn't updated in the ui
|
||||
|
|
Loading…
Reference in a new issue