From a4b85b9601be68c66d3bf33bf05c1ef1c0032526 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 17 Nov 2024 10:29:06 +0100 Subject: refactor(legacy/conf/mpd): Move to a unified `mpd` by-name module --- pkgs/by-name/mp/mpc-beetrm/mpc-beetrm.sh | 11 ----------- pkgs/by-name/mp/mpc-beetrm/package.nix | 16 --------------- pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh | 11 ----------- pkgs/by-name/mp/mpc-lyrics/package.nix | 27 -------------------------- pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh | 14 ------------- pkgs/by-name/mp/mpc-searchadd/package.nix | 16 --------------- pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh | 11 +++++++++++ pkgs/by-name/mp/mpp-beetrm/package.nix | 16 +++++++++++++++ pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh | 11 +++++++++++ pkgs/by-name/mp/mpp-lyrics/package.nix | 27 ++++++++++++++++++++++++++ pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh | 14 +++++++++++++ pkgs/by-name/mp/mpp-searchadd/package.nix | 16 +++++++++++++++ pkgs/by-name/mp/mpp/mpp.sh | 6 +++--- 13 files changed, 98 insertions(+), 98 deletions(-) delete mode 100755 pkgs/by-name/mp/mpc-beetrm/mpc-beetrm.sh delete mode 100644 pkgs/by-name/mp/mpc-beetrm/package.nix delete mode 100755 pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh delete mode 100644 pkgs/by-name/mp/mpc-lyrics/package.nix delete mode 100755 pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh delete mode 100644 pkgs/by-name/mp/mpc-searchadd/package.nix create mode 100755 pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh create mode 100644 pkgs/by-name/mp/mpp-beetrm/package.nix create mode 100755 pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh create mode 100644 pkgs/by-name/mp/mpp-lyrics/package.nix create mode 100755 pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh create mode 100644 pkgs/by-name/mp/mpp-searchadd/package.nix (limited to 'pkgs') diff --git a/pkgs/by-name/mp/mpc-beetrm/mpc-beetrm.sh b/pkgs/by-name/mp/mpc-beetrm/mpc-beetrm.sh deleted file mode 100755 index 3209503c..00000000 --- a/pkgs/by-name/mp/mpc-beetrm/mpc-beetrm.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -beet remove --delete \ - title:"$(mpc --format '%title%' current)" \ - album:"$(mpc --format '%album%' current)" -mpc del 0 - -# vim: ft=sh diff --git a/pkgs/by-name/mp/mpc-beetrm/package.nix b/pkgs/by-name/mp/mpc-beetrm/package.nix deleted file mode 100644 index 99ca8bbd..00000000 --- a/pkgs/by-name/mp/mpc-beetrm/package.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - sysLib, - mpc, - beets, -}: -sysLib.writeShellScript { - name = "mpc-beetrm"; - src = ./mpc-beetrm.sh; - generateCompletions = false; - keepPath = false; - - dependencies = [ - mpc - beets - ]; -} diff --git a/pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh b/pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh deleted file mode 100755 index 004c67c7..00000000 --- a/pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -( - cd "%MPD_MUSIC_DIR" || die "No music dir!" - exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less -) - -# vim: ft=sh diff --git a/pkgs/by-name/mp/mpc-lyrics/package.nix b/pkgs/by-name/mp/mpc-lyrics/package.nix deleted file mode 100644 index 08cc8e48..00000000 --- a/pkgs/by-name/mp/mpc-lyrics/package.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - sysLib, - exiftool, - mpc, - jq, - less, - locale, # dependency of less - mpd_music_dir ? "\${XDG_MUSIC_DIR}", -}: -sysLib.writeShellScript { - name = "mpc-lyrics"; - src = ./mpc-lyrics.sh; - generateCompletions = false; - keepPath = false; - - replacementStrings = { - MPD_MUSIC_DIR = mpd_music_dir; - }; - - dependencies = [ - exiftool - mpc - jq - less - locale # dependency of less - ]; -} diff --git a/pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh b/pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh deleted file mode 100755 index 3fe9a6b6..00000000 --- a/pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/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-searchadd/package.nix b/pkgs/by-name/mp/mpc-searchadd/package.nix deleted file mode 100644 index fd9f94e6..00000000 --- a/pkgs/by-name/mp/mpc-searchadd/package.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - sysLib, - mpc, - beets, -}: -sysLib.writeShellScript { - name = "mpc-searchadd"; - src = ./mpc-searchadd.sh; - generateCompletions = false; - keepPath = false; - - dependencies = [ - mpc - beets - ]; -} diff --git a/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh b/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh new file mode 100755 index 00000000..3209503c --- /dev/null +++ b/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +beet remove --delete \ + title:"$(mpc --format '%title%' current)" \ + album:"$(mpc --format '%album%' current)" +mpc del 0 + +# vim: ft=sh diff --git a/pkgs/by-name/mp/mpp-beetrm/package.nix b/pkgs/by-name/mp/mpp-beetrm/package.nix new file mode 100644 index 00000000..24b56606 --- /dev/null +++ b/pkgs/by-name/mp/mpp-beetrm/package.nix @@ -0,0 +1,16 @@ +{ + sysLib, + mpc, + beets, +}: +sysLib.writeShellScript { + name = "mpp-beetrm"; + src = ./mpp-beetrm.sh; + generateCompletions = false; + keepPath = false; + + dependencies = [ + mpc + beets + ]; +} diff --git a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh new file mode 100755 index 00000000..004c67c7 --- /dev/null +++ b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +( + cd "%MPD_MUSIC_DIR" || die "No music dir!" + exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less +) + +# vim: ft=sh diff --git a/pkgs/by-name/mp/mpp-lyrics/package.nix b/pkgs/by-name/mp/mpp-lyrics/package.nix new file mode 100644 index 00000000..76b590c7 --- /dev/null +++ b/pkgs/by-name/mp/mpp-lyrics/package.nix @@ -0,0 +1,27 @@ +{ + sysLib, + exiftool, + mpc, + jq, + less, + locale, # dependency of less + mpd_music_dir ? "\${XDG_MUSIC_DIR}", +}: +sysLib.writeShellScript { + name = "mpp-lyrics"; + src = ./mpp-lyrics.sh; + generateCompletions = false; + keepPath = false; + + replacementStrings = { + MPD_MUSIC_DIR = mpd_music_dir; + }; + + dependencies = [ + exiftool + mpc + jq + less + locale # dependency of less + ]; +} diff --git a/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh b/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh new file mode 100755 index 00000000..3fe9a6b6 --- /dev/null +++ b/pkgs/by-name/mp/mpp-searchadd/mpp-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/mpp-searchadd/package.nix b/pkgs/by-name/mp/mpp-searchadd/package.nix new file mode 100644 index 00000000..a98472d1 --- /dev/null +++ b/pkgs/by-name/mp/mpp-searchadd/package.nix @@ -0,0 +1,16 @@ +{ + sysLib, + mpc, + beets, +}: +sysLib.writeShellScript { + name = "mpp-searchadd"; + src = ./mpp-searchadd.sh; + generateCompletions = false; + keepPath = false; + + dependencies = [ + mpc + beets + ]; +} diff --git a/pkgs/by-name/mp/mpp/mpp.sh b/pkgs/by-name/mp/mpp/mpp.sh index 0d636ac5..538a56ee 100755 --- a/pkgs/by-name/mp/mpp/mpp.sh +++ b/pkgs/by-name/mp/mpp/mpp.sh @@ -6,15 +6,15 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH case "$1" in "searchadd") shift 1 - mpc-searchadd "$@" + mpp-searchadd "$@" ;; "lyrics") shift 1 - mpc-lyrics "$@" + mpp-lyrics "$@" ;; "beetrm") shift 1 - mpc-beetrm "$@" + mpp-beetrm "$@" ;; *) mpc "$@" -- cgit 1.4.1