connect: use is_playing from connect_state

This commit is contained in:
Felix Prillwitz 2024-12-10 21:38:36 +01:00
parent 28588c4a8e
commit c73871c516
No known key found for this signature in database
GPG key ID: DE334B43606D1455

View file

@ -1399,15 +1399,8 @@ impl SpircTask {
self.add_resolve_context(resolve);
}
fn is_playing(&self) -> bool {
matches!(
self.play_status,
SpircPlayStatus::Playing { .. } | SpircPlayStatus::LoadingPlay { .. }
)
}
fn handle_next(&mut self, track_uri: Option<String>) -> Result<(), Error> {
let continue_playing = self.is_playing();
let continue_playing = self.connect_state.player().is_playing;
let current_uri = self.connect_state.current_track(|t| &t.uri);
let mut has_next_track =
@ -1450,7 +1443,7 @@ impl SpircTask {
self.connect_state.reset_playback_to_position(None)?;
self.handle_stop()
}
Some(_) => self.load_track(self.is_playing(), 0)?,
Some(_) => self.load_track(self.connect_state.player().is_playing, 0)?,
}
} else {
self.handle_seek(0);
@ -1573,7 +1566,7 @@ impl SpircTask {
async fn notify(&mut self) -> Result<(), Error> {
self.connect_state.set_status(&self.play_status);
if self.is_playing() {
if self.connect_state.player().is_playing {
self.connect_state
.update_position_in_relation(self.now_ms());
}