about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-12-17 22:44:12 +0100
committerSoispha <soispha@vhack.eu>2023-12-17 22:44:12 +0100
commitac7b211c99ef09c591ea4a70732db2f38ca881ad (patch)
treeb49444c860b7c329c4adab01a4419e46e0196a52
parentbuild(treewide): Update (diff)
downloadnixos-config-ac7b211c99ef09c591ea4a70732db2f38ca881ad.tar.gz
nixos-config-ac7b211c99ef09c591ea4a70732db2f38ca881ad.zip
feat(hm/pkgs/src/lyrics): Init
Diffstat (limited to '')
-rw-r--r--hm/soispha/pkgs/scripts.nix16
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/lyrics16
2 files changed, 31 insertions, 1 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix
index c4d284c1..a8568d43 100644
--- a/hm/soispha/pkgs/scripts.nix
+++ b/hm/soispha/pkgs/scripts.nix
@@ -137,6 +137,19 @@
   #     path = "wrappers";
   #     dependencies = builtins.attrValues {inherit (pkgs) lf ueberzug;};
   #   };
+  lyrics-src = write_script {
+    name = "lyrics";
+    path = "wrappers";
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        mediainfo
+        mpc-cli
+        jq
+        gnused
+        ;
+    };
+  };
   spodi-scr = write_script {
     name = "spodi";
     path = "wrappers";
@@ -155,14 +168,15 @@
 in [
   aumo-scr
   con2pdf-scr
+  fupdate-src
   ll-scr
   # llp-scr # TODO: see above
+  lyrics-src
   neorg-scr
   screenshot_persistent-scr
   screenshot_temporary-scr
   spodi-scr
   update-sys-scr
-  fupdate-src
   virsh-del-scr
   yti-scr
 ]
diff --git a/hm/soispha/pkgs/scripts/wrappers/lyrics b/hm/soispha/pkgs/scripts/wrappers/lyrics
new file mode 100755
index 00000000..95096a28
--- /dev/null
+++ b/hm/soispha/pkgs/scripts/wrappers/lyrics
@@ -0,0 +1,16 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="1.8.0" . %SHELL_LIBRARY_PATH
+
+
+out="$(mktmp)"
+
+print " " > "$out"
+(
+    cd "$XDG_MUSIC_DIR" || die "No music dir!"
+    mediainfo --Output=JSON "$(mpc --format '%file%' current)" | jq -r '.media.track[0].Lyrics' | sed 's|/|\n|g' >> "$out"
+)
+cat "$out"
+
+# vim: ft=sh