Added more control fields for playback control
This commit is contained in:
@@ -17,6 +17,7 @@ use serenity::{
|
||||
};
|
||||
use songbird::{model::payload::ClientDisconnect, Call, CoreEvent, Event, EventContext};
|
||||
use spoticord_database::Database;
|
||||
use spoticord_player::playback_control::PlayPlaylist;
|
||||
use spoticord_player::{Player, PlayerEvent, PlayerHandle};
|
||||
use spoticord_utils::{discord::Colors, spotify};
|
||||
use std::{ops::ControlFlow, sync::Arc, time::Duration};
|
||||
@@ -42,9 +43,7 @@ pub enum SessionCommand {
|
||||
ShutdownPlayer,
|
||||
Disconnect,
|
||||
DisconnectTimedOut,
|
||||
QueuePlaylist {
|
||||
playlist_uri: String,
|
||||
},
|
||||
QueuePlaylist(PlayPlaylist),
|
||||
}
|
||||
|
||||
pub struct Session {
|
||||
@@ -292,8 +291,8 @@ impl Session {
|
||||
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
SessionCommand::QueuePlaylist { playlist_uri } => {
|
||||
self.player.queue_playlist(playlist_uri).await;
|
||||
SessionCommand::QueuePlaylist(play_playlist) => {
|
||||
self.player.queue_playlist(play_playlist).await;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -557,9 +556,9 @@ impl SessionHandle {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn queue_playlist(&self, playlist_uri: String) -> Result<()> {
|
||||
pub async fn queue_playlist(&self, play_playlist: PlayPlaylist) -> Result<()> {
|
||||
self.commands
|
||||
.send(SessionCommand::QueuePlaylist { playlist_uri })
|
||||
.send(SessionCommand::QueuePlaylist(play_playlist))
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user