From eac996958e58f7ee223ac0ad30e9d03fce04753f Mon Sep 17 00:00:00 2001 From: herrernst Date: Sat, 26 Aug 2017 18:43:27 +0200 Subject: [PATCH] pause after last track has finished and first one is loaded again --- src/spirc.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/spirc.rs b/src/spirc.rs index 3b5fb77c..cf38dc5d 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -523,11 +523,13 @@ impl SpircTask { let current_index = self.state.get_playing_track_index(); let new_index = (current_index + 1) % (self.state.get_track().len() as u32); + let was_last_track = current_index + 1 >= self.state.get_track().len() as u32; + self.state.set_playing_track_index(new_index); self.state.set_position_ms(0); self.state.set_position_measured_at(now_ms() as u64); - self.load_track(true); + self.load_track(!was_last_track); self.notify(None); }