aboutsummaryrefslogtreecommitdiff
path: root/ztunekey
diff options
context:
space:
mode:
Diffstat (limited to 'ztunekey')
-rwxr-xr-xztunekey33
1 files changed, 33 insertions, 0 deletions
diff --git a/ztunekey b/ztunekey
new file mode 100755
index 0000000..da69d56
--- /dev/null
+++ b/ztunekey
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# icon from:
+# https://vectorified.com/images/guitar-tuner-icon-28.jpg
+# ...installed via:
+# convert guitar-tuner-icon-28.jpg .local/share/icons/hicolor/256x256/apps/ztunekey.png
+
+ICON=ztunekey
+ZOPT='--width 300 --height 100 --title Tuning/Key'
+file="$1"
+
+if [ "$file" = "" ]; then
+ file="$( audtool --current-song-filename )"
+ if [ "$file" = "" ]; then
+ zenity --error $ZOPT --text="No song is playing!"
+ exit 1
+ fi
+fi
+
+if [ ! -e "$file" ]; then
+ zenity --error $ZOPT --text="No such file: $file"
+ exit 1
+fi
+
+bn="$( basename "$file" )"
+
+( find_tuning -q "$file" > /tmp/tuning.$$ &
+ find_key -q "$file" > /tmp/key.$$ &
+ wait ) | zenity --progress $ZOPT --icon-name=ztunekey --text="$bn" --pulsate --auto-close
+
+zenity --info $ZOPT --icon-name=ztunekey --text="$bn Tuning: $( cat /tmp/tuning.$$ ) cents Key: $( cat /tmp/key.$$ )"
+
+rm -f /tmp/tuning.$$ /tmp/key.$$