From 9741228b51856902f3791b43012b2ae792cf3f5d Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 31 Jan 2026 16:29:24 +0100 Subject: pkgs/mpdpopm: Add a (basic) dj mode --- pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'pkgs/by-name/mp/mpdpopm/src/bin') 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}, }; @@ -424,6 +425,23 @@ enum PlaylistsCommand { Get {}, } +#[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. @@ -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, + }, } } -- cgit 1.4.1