mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Add shuffle command and command handling
This commit is contained in:
parent
56f1fb6dae
commit
eb4dacbc59
1 changed files with 8 additions and 0 deletions
|
@ -75,6 +75,7 @@ pub enum SpircCommand {
|
||||||
VolumeUp,
|
VolumeUp,
|
||||||
VolumeDown,
|
VolumeDown,
|
||||||
Shutdown,
|
Shutdown,
|
||||||
|
Shuffle,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SpircTaskConfig {
|
struct SpircTaskConfig {
|
||||||
|
@ -344,6 +345,9 @@ impl Spirc {
|
||||||
pub fn shutdown(&self) {
|
pub fn shutdown(&self) {
|
||||||
let _ = self.commands.unbounded_send(SpircCommand::Shutdown);
|
let _ = self.commands.unbounded_send(SpircCommand::Shutdown);
|
||||||
}
|
}
|
||||||
|
pub fn shuffle(&self) {
|
||||||
|
let _ = self.commands.unbounded_send(SpircCommand::Shuffle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Future for SpircTask {
|
impl Future for SpircTask {
|
||||||
|
@ -547,6 +551,10 @@ impl SpircTask {
|
||||||
self.shutdown = true;
|
self.shutdown = true;
|
||||||
self.commands.close();
|
self.commands.close();
|
||||||
}
|
}
|
||||||
|
SpircCommand::Shuffle => {
|
||||||
|
CommandSender::new(self, MessageType::kMessageTypeShuffle).send();
|
||||||
|
self.commands.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue