diff options
Diffstat (limited to 'pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs')
| -rw-r--r-- | pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs b/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs index 5d4eeae4..faa651bf 100644 --- a/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs +++ b/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs @@ -31,6 +31,7 @@ use mpdpopm::{ config::{self, Config}, filters::ExpressionParser, filters_ast::{FilterStickerNames, evaluate}, + messanges::COMMAND_CHANNEL, storage::{last_played, play_count, rating}, }; @@ -425,6 +426,23 @@ enum PlaylistsCommand { } #[derive(Subcommand)] +enum DjCommand { + /// Activate the automatic DJ mode on the mpdpopmd daemon. + /// + /// In this mode, the daemon will automatically add new tracks to the playlist based on a + /// recommendation algorithm. + #[clap(verbatim_doc_comment)] + Start {}, + + /// Deactivate the automatic DJ mode on the mpdpopmd daemon. + /// + /// In this mode, the daemon will automatically add new tracks to the playlist based on a + /// recommendation algorithm. + #[clap(verbatim_doc_comment)] + Stop {}, +} + +#[derive(Subcommand)] enum SubCommand { /// Change details about rating. Rating { @@ -477,9 +495,18 @@ enum SubCommand { filter: String, /// Respect the casing, when performing the filter evaluation. - #[arg(short, long, default_value_t = true)] + #[arg(short, long, default_value_t = false)] case_sensitive: bool, }, + + /// Modify the automatic DJ mode on the mpdpopmd daemon. + /// + /// In this mode, the daemon will automatically add new tracks to the playlist based on a + /// recommendation algorithm. + Dj { + #[command(subcommand)] + command: DjCommand, + }, } #[tokio::main] @@ -569,5 +596,9 @@ async fn main() -> Result<()> { filter, case_sensitive, } => searchadd(&mut client, &filter, case_sensitive).await, + SubCommand::Dj { command } => match command { + DjCommand::Start {} => client.send_message(COMMAND_CHANNEL, "dj start").await, + DjCommand::Stop {} => client.send_message(COMMAND_CHANNEL, "dj stop").await, + }, } } |
