about summary refs log tree commit diff stats
path: root/pkgs/by-name/mp/mpc-searchadd
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh14
-rw-r--r--pkgs/by-name/mp/mpc-searchadd/package.nix (renamed from pkgs/by-name/mp/mpc-fav/package.nix)7
2 files changed, 19 insertions, 2 deletions
diff --git a/pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh b/pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh
new file mode 100755
index 00000000..3fe9a6b6
--- /dev/null
+++ b/pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+
+tracks="$(mktmp)"
+beet list "$@" --path >"$tracks"
+
+while read -r track; do
+    mpc add "$track"
+done <"$tracks"
+
+mpc playlist
+# vim: ft=sh
diff --git a/pkgs/by-name/mp/mpc-fav/package.nix b/pkgs/by-name/mp/mpc-searchadd/package.nix
index 2d3a8f3f..54ceca91 100644
--- a/pkgs/by-name/mp/mpc-fav/package.nix
+++ b/pkgs/by-name/mp/mpc-searchadd/package.nix
@@ -1,13 +1,16 @@
 {
   sysLib,
   mpc-cli,
+  beets,
 }:
 sysLib.writeShellScript {
-  name = "mpc-fav";
-  src = ./mpc-fav.sh;
+  name = "mpc-searchadd";
+  src = ./mpc-searchadd.sh;
   generateCompletions = false;
   keepPath = false;
+
   dependencies = [
     mpc-cli
+    beets
   ];
 }