aboutsummaryrefslogtreecommitdiffstats
path: root/src/bot
diff options
context:
space:
mode:
Diffstat (limited to 'src/bot')
-rw-r--r--src/bot/master.rs14
-rw-r--r--src/bot/music.rs3
2 files changed, 16 insertions, 1 deletions
diff --git a/src/bot/master.rs b/src/bot/master.rs
index 10a7572..67867ef 100644
--- a/src/bot/master.rs
+++ b/src/bot/master.rs
@@ -213,6 +213,20 @@ impl MasterBot {
Ok(())
}
+ pub fn bot_data(&self, name: String) -> Option<crate::web_server::BotData> {
+ let music_bots = self.music_bots.read().unwrap();
+
+ let bot = music_bots.connected_bots.get(&name)?;
+
+ Some(crate::web_server::BotData {
+ name: name,
+ state: bot.state(),
+ volume: bot.volume(),
+ currently_playing: bot.currently_playing(),
+ playlist: bot.playlist_to_vec(),
+ })
+ }
+
pub fn bot_datas(&self) -> Vec<crate::web_server::BotData> {
let music_bots = self.music_bots.read().unwrap();
diff --git a/src/bot/music.rs b/src/bot/music.rs
index d53e4a8..0def280 100644
--- a/src/bot/music.rs
+++ b/src/bot/music.rs
@@ -5,6 +5,7 @@ use std::thread;
use humantime;
use log::{debug, info};
+use serde::Serialize;
use structopt::StructOpt;
use tokio02::sync::mpsc::UnboundedSender;
use tsclientlib::{data, ChannelId, ClientId, ConnectOptions, Identity, Invoker, MessageTarget};
@@ -44,7 +45,7 @@ fn parse_seek(mut amount: &str) -> Result<Seek, ()> {
}
}
-#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize)]
pub enum State {
Playing,
Paused,