aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mp/mpdpopm/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/mp/mpdpopm/src/bin')
-rw-r--r--pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs38
1 files changed, 9 insertions, 29 deletions
diff --git a/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs b/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs
index 746088ca..82272aeb 100644
--- a/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs
+++ b/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs
@@ -27,7 +27,7 @@
//! for `mppopmd`. Run `mppopm --help` for detailed usage.
use mpdpopm::{
- clients::{Client, PlayerStatus, quote},
+ clients::{Client, PlayerStatus},
config::{self, Config},
filters::ExpressionParser,
filters_ast::{FilterStickerNames, evaluate},
@@ -266,10 +266,7 @@ async fn get_playlists(client: &mut Client) -> Result<()> {
/// Add songs selected by filter to the queue
async fn searchadd(client: &mut Client, filter: &str, case_sensitive: bool) -> Result<()> {
- let qfilter = quote(filter);
- debug!("findadd: got ``{}'', quoted to ``{}''.", filter, qfilter);
-
- let ast = match ExpressionParser::new().parse(&qfilter) {
+ let ast = match ExpressionParser::new().parse(filter) {
Ok(ast) => ast,
Err(err) => {
bail!("Failed to parse filter: `{}`", err)
@@ -283,7 +280,13 @@ async fn searchadd(client: &mut Client, filter: &str, case_sensitive: bool) -> R
.await
.context("Failed to evaluate filter")?
{
- results.push(client.add(&song).await);
+ let out = client.add(&song).await;
+
+ if out.is_ok() {
+ eprintln!("Added: `{}`", song)
+ }
+
+ results.push(out);
}
match results.into_iter().collect::<Result<Vec<()>>>() {
@@ -292,22 +295,6 @@ async fn searchadd(client: &mut Client, filter: &str, case_sensitive: bool) -> R
}
}
-/// Send an arbitrary command
-async fn send_command(client: &mut Client, chan: &str, args: Vec<String>) -> Result<()> {
- client
- .send_message(
- chan,
- args.iter()
- .map(String::as_str)
- .map(quote)
- .collect::<Vec<String>>()
- .join(" ")
- .as_str(),
- )
- .await?;
- Ok(())
-}
-
/// `mppopmd' client
#[derive(Parser)]
struct Args {
@@ -493,10 +480,6 @@ enum SubCommand {
#[arg(short, long, default_value_t = true)]
case_sensitive: bool,
},
-
- /// Send a command to mpd.
- #[clap(verbatim_doc_comment)]
- SendCommand { args: Vec<String> },
}
#[tokio::main]
@@ -586,8 +569,5 @@ async fn main() -> Result<()> {
filter,
case_sensitive,
} => searchadd(&mut client, &filter, case_sensitive).await,
- SubCommand::SendCommand { args } => {
- send_command(&mut client, &config.commands_chan, args).await
- }
}
}