From 3c8d709ff1e71af8b37ac8b164f12cf00bbc087e Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 14 Jan 2016 04:27:34 +0100 Subject: [PATCH] Added: Next and Previous track Bug resolved: opening a list with "dissallowed tracks" is now possible --- src/spirc.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/spirc.rs b/src/spirc.rs index cd7ba756..62229dbb 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -156,6 +156,7 @@ impl SpircManager { self.tracks = frame.get_state() .get_track() .iter() + .filter(|track| track.get_gid().len()==16) .map(|track| SpotifyId::from_raw(track.get_gid())) .collect(); @@ -170,6 +171,16 @@ impl SpircManager { protocol::spirc::MessageType::kMessageTypePause => { self.delegate.pause(); } + protocol::spirc::MessageType::kMessageTypeNext => { + self.index = (self.index + 1) % self.tracks.len() as u32; + let track = self.tracks[self.index as usize]; + self.delegate.load(track, true, 0); + } + protocol::spirc::MessageType::kMessageTypePrev => { + self.index = (self.index - 1) % self.tracks.len() as u32; + let track = self.tracks[self.index as usize]; + self.delegate.load(track, true, 0); + } protocol::spirc::MessageType::kMessageTypeSeek => { self.delegate.seek(frame.get_position()); }