aboutsummaryrefslogtreecommitdiff
path: root/ztunekey
blob: da69d561317075413a886a5c3263bcdf78292966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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.$$