Browse Source

Lower default volume. Kill music processes at exit.

master
Dan Helfman 2 months ago
parent
commit
29a8033791
  1. 13
      play-by-number

13
play-by-number

@ -2,17 +2,21 @@
set -e
function kill_music_processes() {
killall -9 mpv || true
}
apply_quiet_hours () {
sleep 1m
hour=$(TZ="America/Los_Angeles" date +"%H")
if [[ $hour -ge 21 ]] || [[ $hour -le 7 ]] ; then
killall -9 mpv || true
kill_music_processes
fi
if [[ $hour -ge 20 ]] || [[ $hour -le 8 ]] ; then
amixer sset 'Master' 50%
amixer sset 'Master' 25%
else
amixer sset 'Master' 100%
amixer sset 'Master' 75%
fi
}
@ -20,7 +24,7 @@ stream_song () {
subsonic-cli -c subsonic-cli.cfg stream -p id $1 | mpv --no-video --no-input-terminal -
}
trap kill_music_processes EXIT
apply_quiet_hours &
while [ true ] ; do
@ -32,7 +36,6 @@ while [ true ] ; do
continue
fi
killall -9 mpv || true
case $song_number in
1) mpv --no-video --no-input-terminal https://somafm.com/poptron.pls & ;; # Poptron

Loading…
Cancel
Save