@@ -71,6 +71,7 @@ enum WorkerCommand {
|
||||
Seek(u32),
|
||||
SetVolume(u16),
|
||||
RequestToken(oneshot::Sender<Token>),
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -191,6 +192,10 @@ impl futures::Future for Worker {
|
||||
self.token_task = Spotify::get_token(&self.session, sender);
|
||||
progress = true;
|
||||
}
|
||||
WorkerCommand::Shutdown => {
|
||||
self.player.stop();
|
||||
self.session.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -943,6 +948,10 @@ impl Spotify {
|
||||
self.cfg.with_state_mut(|mut s| s.volume = volume);
|
||||
self.send_worker(WorkerCommand::SetVolume(Self::log_scale(volume)));
|
||||
}
|
||||
|
||||
pub fn shutdown(&self) {
|
||||
self.send_worker(WorkerCommand::Shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
||||
Reference in New Issue
Block a user