stream-countdown (709B)
1 #!/bin/sh 2 3 # Start at 10:00 or the provided number of minutes 4 minutes="$1" 5 minutes="${minutes:=10}" 6 seconds=0 7 8 # Give the stream a moment to start 9 printf " %02d:%02d" "$minutes" "$seconds" > /tmp/countdown_timer.txt 10 printf "Nothing Playing" > /tmp/stream-music.txt 11 gnome-terminal -- cava & 12 13 while true; do 14 sleep 1 15 rhythmbox-client --print-playing-format="%tt by %ta — %te/%td" > /tmp/stream-music.txt 16 if [ "$minutes" -eq 0 ] && [ "$seconds" -eq 0 ]; then 17 printf "Starting Soon" > /tmp/countdown_timer.txt 18 continue 19 elif [ "$seconds" -eq 0 ]; then 20 seconds=59 21 minutes=$((minutes-1)) 22 fi 23 printf " %02d:%02d" "$minutes" "$seconds" > /tmp/countdown_timer.txt 24 seconds=$((seconds-1)) 25 done