From 8b8032634a7a478020c7253def63f3ba18aa794e Mon Sep 17 00:00:00 2001 From: Will Stott Date: Sat, 19 Oct 2019 12:42:23 +0100 Subject: [PATCH] Fix shuffle and repeat when changing contexts to match Android behaviour Seems strange that these fields return true in the has_ methods when as far as I can tell it's impossible to remove the shuffle/repeat state in the client without explicitly toggling them with their dedicated buttons --- connect/src/spirc.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 37576a9e..edb7c29b 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -807,8 +807,16 @@ impl SpircTask { self.state.set_playing_track_index(index); self.state.set_track(tracks.into_iter().cloned().collect()); self.state.set_context_uri(context_uri); - self.state.set_repeat(frame.get_state().get_repeat()); - self.state.set_shuffle(frame.get_state().get_shuffle()); + // has_shuffle/repeat seem to always be true in these replace msgs, + // but to replicate the behaviour of the Android client we have to + // ignore false values. + let state = frame.get_state(); + if state.get_repeat() { + self.state.set_repeat(true); + } + if state.get_shuffle() { + self.state.set_shuffle(true); + } } fn load_track(&mut self, play: bool) {