Browse Source

Switch to typing numbers followed by enter.

master
Dan Helfman 3 months ago
parent
commit
cc8bb0aa83
  1. 2
      README.md
  2. 12
      play-by-number

2
README.md

@ -19,4 +19,4 @@ password = YOUR_PASSWORD
## Usage
* `./play-by-number`
* Press a number key to play a song or internet radio.
* Press a number key and press enter to play a song or internet radio.

12
play-by-number

@ -17,25 +17,25 @@ apply_quiet_hours () {
}
stream_song () {
subsonic-cli -c subsonic-cli.cfg stream -p id $1 | mpv --no-video -
subsonic-cli -c subsonic-cli.cfg stream -p id $1 | mpv --no-video --no-input-terminal -
}
apply_quiet_hours &
while [ true ] ; do
read -s -n 1 song_number
read -s song_number
hour=$(date +"%H")
if [[ $hour -ge 21 ]] || [[ $hour -le 7 ]] ; then
mpv --no-video media/beep.mp3 & # error beep
mpv --no-video --no-input-terminal media/beep.mp3 & # error beep
continue
fi
killall -9 mpv || true
case $song_number in
1) mpv --no-video https://somafm.com/poptron.pls & ;; # Poptron
1) mpv --no-video --no-input-terminal https://somafm.com/poptron.pls & ;; # Poptron
2) stream_song 05211b7eb16eca0729307459ad31056a & ;; # What does the fox say
3) stream_song 2d526af565131fceaab63bf970df49ea & ;; # Bananaphone
4) stream_song 6b35d311b9bba0d6f6de654a02963849 & ;; # The Duck Song
@ -44,8 +44,6 @@ while [ true ] ; do
7) stream_song 3a26a5950b11886cd50d2f05d9c244f3 & ;; # Fire Truck
8) stream_song c6c5040d29c9eaaaf11f30f5415eab5b & ;; # Raining Tacos
9) stream_song a0e145806d461cf7bc98a668a40db5b8 & ;; # I Am a Gummy Bear
*) mpv --no-video media/beep.mp3 & ;; # error beep
*) mpv --no-video --no-input-terminal media/beep.mp3 & ;; # error beep
esac
# TODO: Enter after typing numbers? To allow more songs.
done

Loading…
Cancel
Save