Skip to content

Commit 8c7b267

Browse files
committed
Fix issue where end-of-track is incorrectly signalled when paused
1 parent 5e29621 commit 8c7b267

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
[Unreleased]: https://github.com/udoprog/OxidizeBot/compare/1.0.4...master
1010

11+
### Fixed
12+
* Fix issue where end-of-track is incorrectly signalled when paused [#100]
13+
14+
[#100]: https://github.com/udoprog/OxidizeBot/issues/100
15+
1116
## [1.0.4]
1217

1318
### Fixed

bot/src/player/playback_future.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::player::{ConnectStream, PlaybackMode, PlayerInternal, Song};
1+
use crate::player::{ConnectStream, PlaybackMode, PlayerInternal, Song, State};
22
use crate::prelude::*;
33
use crate::settings;
44
use crate::spotify_id::SpotifyId;
@@ -52,7 +52,10 @@ impl PlaybackFuture {
5252
loop {
5353
futures::select! {
5454
song = song_stream.select_next_some() => {
55-
song_timeout = song.map(|s| tokio::time::delay_until(s.deadline().into()));
55+
song_timeout = song.and_then(|s| match s.state() {
56+
State::Playing => Some(tokio::time::delay_until(s.deadline().into())),
57+
_ => None,
58+
});
5659
}
5760
fallback = fallback_stream.select_next_some() => {
5861
self.internal.write().await.update_fallback_items(fallback).await;

0 commit comments

Comments
 (0)