mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
connect: use is_playing from connect_state
This commit is contained in:
parent
28588c4a8e
commit
c73871c516
1 changed files with 3 additions and 10 deletions
|
@ -1399,15 +1399,8 @@ impl SpircTask {
|
||||||
self.add_resolve_context(resolve);
|
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> {
|
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 current_uri = self.connect_state.current_track(|t| &t.uri);
|
||||||
let mut has_next_track =
|
let mut has_next_track =
|
||||||
|
@ -1450,7 +1443,7 @@ impl SpircTask {
|
||||||
self.connect_state.reset_playback_to_position(None)?;
|
self.connect_state.reset_playback_to_position(None)?;
|
||||||
self.handle_stop()
|
self.handle_stop()
|
||||||
}
|
}
|
||||||
Some(_) => self.load_track(self.is_playing(), 0)?,
|
Some(_) => self.load_track(self.connect_state.player().is_playing, 0)?,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.handle_seek(0);
|
self.handle_seek(0);
|
||||||
|
@ -1573,7 +1566,7 @@ impl SpircTask {
|
||||||
async fn notify(&mut self) -> Result<(), Error> {
|
async fn notify(&mut self) -> Result<(), Error> {
|
||||||
self.connect_state.set_status(&self.play_status);
|
self.connect_state.set_status(&self.play_status);
|
||||||
|
|
||||||
if self.is_playing() {
|
if self.connect_state.player().is_playing {
|
||||||
self.connect_state
|
self.connect_state
|
||||||
.update_position_in_relation(self.now_ms());
|
.update_position_in_relation(self.now_ms());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue