diff options
Diffstat (limited to 'pkgs/by-name/mp/mpp-lyrics')
| -rwxr-xr-x | pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh | 22 | ||||
| -rw-r--r-- | pkgs/by-name/mp/mpp-lyrics/package.nix | 27 | ||||
| -rw-r--r-- | pkgs/by-name/mp/mpp-lyrics/package.unstable.nix | 31 |
3 files changed, 47 insertions, 33 deletions
diff --git a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh index 004c67c7..6c96a9d9 100755 --- a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh +++ b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh @@ -1,11 +1,21 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -( - cd "%MPD_MUSIC_DIR" || die "No music dir!" - exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less -) +die() { + echo "Error: $1" + exit 1 +} + +cd "$XDG_MUSIC_DIR/beets" || die "No music dir!" +exiftool "$(mpc --format '%file%' current)" -json | jq '.[0] | if has("Lyrics") then .Lyrics elif has("Lyrics-xxx") then ."Lyrics-xxx" else "<No lyrics key>" end' --raw-output | less # vim: ft=sh diff --git a/pkgs/by-name/mp/mpp-lyrics/package.nix b/pkgs/by-name/mp/mpp-lyrics/package.nix deleted file mode 100644 index 76b590c7..00000000 --- a/pkgs/by-name/mp/mpp-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 = "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-lyrics/package.unstable.nix b/pkgs/by-name/mp/mpp-lyrics/package.unstable.nix new file mode 100644 index 00000000..0b6d8993 --- /dev/null +++ b/pkgs/by-name/mp/mpp-lyrics/package.unstable.nix @@ -0,0 +1,31 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + writeShellApplication, + # Dependencies + exiftool, + mpc, + jq, + less, + locale, # dependency of less +}: +writeShellApplication { + name = "mpp-lyrics"; + text = builtins.readFile ./mpp-lyrics.sh; + inheritPath = false; + + runtimeInputs = [ + exiftool + mpc + jq + less + locale # dependency of less + ]; +} |
