diff options
Diffstat (limited to '')
-rwxr-xr-x | pkgs/by-name/mp/mpc-fav/mpc-fav.sh | 16 | ||||
-rwxr-xr-x | pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh (renamed from pkgs/by-name/ly/lyrics/lyrics.sh) | 0 | ||||
-rw-r--r-- | pkgs/by-name/mp/mpc-lyrics/package.nix (renamed from pkgs/by-name/ly/lyrics/package.nix) | 4 | ||||
-rwxr-xr-x | pkgs/by-name/mp/mpc-rm/mpc-rm.sh | 5 | ||||
-rw-r--r-- | pkgs/by-name/mp/mpc-rm/package.nix | 5 | ||||
-rwxr-xr-x | pkgs/by-name/mp/mpc-searchadd/mpc-searchadd.sh | 14 | ||||
-rw-r--r-- | pkgs/by-name/mp/mpc-searchadd/package.nix (renamed from pkgs/by-name/mp/mpc-fav/package.nix) | 7 | ||||
-rwxr-xr-x | pkgs/by-name/mp/mpc/mpc.sh | 12 | ||||
-rw-r--r-- | pkgs/by-name/mp/mpc/package.nix | 8 |
9 files changed, 38 insertions, 33 deletions
diff --git a/pkgs/by-name/mp/mpc-fav/mpc-fav.sh b/pkgs/by-name/mp/mpc-fav/mpc-fav.sh deleted file mode 100755 index 795a4875..00000000 --- a/pkgs/by-name/mp/mpc-fav/mpc-fav.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -FAV_DIR="$XDG_MUSIC_DIR/playlists/favourites" - -cd "$XDG_MUSIC_DIR" || die "No music dir!" - -[ -d "$FAV_DIR" ] || mkdir --parents "$FAV_DIR" - -ln -sr "$(mpc --format '%file%' current)" "$FAV_DIR/" || die "Link failed!" - -mpc update - -# vim: ft=sh diff --git a/pkgs/by-name/ly/lyrics/lyrics.sh b/pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh index 004c67c7..004c67c7 100755 --- a/pkgs/by-name/ly/lyrics/lyrics.sh +++ b/pkgs/by-name/mp/mpc-lyrics/mpc-lyrics.sh diff --git a/pkgs/by-name/ly/lyrics/package.nix b/pkgs/by-name/mp/mpc-lyrics/package.nix index d83057ce..fdb8c53a 100644 --- a/pkgs/by-name/ly/lyrics/package.nix +++ b/pkgs/by-name/mp/mpc-lyrics/package.nix @@ -8,8 +8,8 @@ mpd_music_dir ? "\${XDG_MUSIC_DIR}", }: sysLib.writeShellScript { - name = "lyrics"; - src = ./lyrics.sh; + name = "mpc-lyrics"; + src = ./mpc-lyrics.sh; generateCompletions = false; keepPath = false; diff --git a/pkgs/by-name/mp/mpc-rm/mpc-rm.sh b/pkgs/by-name/mp/mpc-rm/mpc-rm.sh index 94e0634b..3209503c 100755 --- a/pkgs/by-name/mp/mpc-rm/mpc-rm.sh +++ b/pkgs/by-name/mp/mpc-rm/mpc-rm.sh @@ -3,8 +3,9 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH -cd "$XDG_MUSIC_DIR" || die "No music dir!" -trash-put "$(mpc --format '%file%' current)" +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-rm/package.nix b/pkgs/by-name/mp/mpc-rm/package.nix index 6b7e2ead..8af84279 100644 --- a/pkgs/by-name/mp/mpc-rm/package.nix +++ b/pkgs/by-name/mp/mpc-rm/package.nix @@ -1,15 +1,16 @@ { sysLib, mpc-cli, - trash-cli, + beets, }: sysLib.writeShellScript { name = "mpc-rm"; src = ./mpc-rm.sh; generateCompletions = false; keepPath = false; + dependencies = [ mpc-cli - trash-cli + beets ]; } 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 ]; } diff --git a/pkgs/by-name/mp/mpc/mpc.sh b/pkgs/by-name/mp/mpc/mpc.sh index 5aae5cdb..f613cf0a 100755 --- a/pkgs/by-name/mp/mpc/mpc.sh +++ b/pkgs/by-name/mp/mpc/mpc.sh @@ -4,13 +4,17 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH case "$1" in -"rm") +"searchadd") shift 1 - mpc-rm "$@" + mpc-searchadd "$@" + ;; +"lyrics") + shift 1 + mpc-lyrics "$@" ;; -"fav") +"rm") shift 1 - mpc-fav "$@" + mpc-rm "$@" ;; *) mpc "$@" diff --git a/pkgs/by-name/mp/mpc/package.nix b/pkgs/by-name/mp/mpc/package.nix index 936aa990..d73c0523 100644 --- a/pkgs/by-name/mp/mpc/package.nix +++ b/pkgs/by-name/mp/mpc/package.nix @@ -1,17 +1,15 @@ { sysLib, - mpc-fav, - mpc-rm, mpc-cli, }: sysLib.writeShellScript { name = "mpc"; src = ./mpc.sh; generateCompletions = false; - keepPath = false; + # We source the wrappers from the environment, to ensure that they have the same + # configurations (e.g. MPD_MUSIC_DIR in `mpc-lyrics`) + keepPath = true; dependencies = [ - mpc-fav - mpc-rm mpc-cli ]; } |