Merge pull request #666 from jackvstrickland/dev

Add shuffle command and command handling
This commit is contained in:
Sasha Hilton 2021-05-01 01:20:03 +01:00 committed by GitHub
commit 617b3b72b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,6 +78,7 @@ pub enum SpircCommand {
VolumeUp, VolumeUp,
VolumeDown, VolumeDown,
Shutdown, Shutdown,
Shuffle,
} }
struct SpircTaskConfig { struct SpircTaskConfig {
@ -350,6 +351,9 @@ impl Spirc {
pub fn shutdown(&self) { pub fn shutdown(&self) {
let _ = self.commands.send(SpircCommand::Shutdown); let _ = self.commands.send(SpircCommand::Shutdown);
} }
pub fn shuffle(&self) {
let _ = self.commands.unbounded_send(SpircCommand::Shuffle);
}
} }
impl SpircTask { impl SpircTask {
@ -519,6 +523,10 @@ impl SpircTask {
rx.close() rx.close()
} }
} }
SpircCommand::Shuffle => {
CommandSender::new(self, MessageType::kMessageTypeShuffle).send();
self.commands.close();
}
} }
} }