mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Added: Next and Previous track
Bug resolved: opening a list with "dissallowed tracks" is now possible
This commit is contained in:
parent
f316211ba3
commit
3c8d709ff1
1 changed files with 11 additions and 0 deletions
11
src/spirc.rs
11
src/spirc.rs
|
@ -156,6 +156,7 @@ impl<D: SpircDelegate> SpircManager<D> {
|
|||
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<D: SpircDelegate> SpircManager<D> {
|
|||
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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue