diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-01-31 16:29:24 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-01-31 16:29:24 +0100 |
| commit | 9741228b51856902f3791b43012b2ae792cf3f5d (patch) | |
| tree | 4fa1b571cf9c5a9bed725249a5557563ef53d035 /pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs | |
| parent | pkgs/mpdpopm: Change the default config to be the new json format (diff) | |
| download | nixos-config-9741228b51856902f3791b43012b2ae792cf3f5d.zip | |
pkgs/mpdpopm: Add a (basic) dj mode
Diffstat (limited to '')
| -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, + }, } } |
