Process should not pause itself
@@ -11,11 +11,15 @@ check_paused() {
STATUS=`cat /proc/asound/card${CARD}/pcm0p/sub0/hw_params`
if [ "$STATUS" == "closed" ]; then
DATE2=`date +%Y%m%d-%H%M%S`
- echo "$DATE1 $DATE2 pause-all $PLAYER" >> /var/log/hifiberry.log
+ echo "$DATE1 $DATE2 pause-all $PLAYER" | systemd-cat
exit 0
fi
PROCESS=`lsof | grep /dev/snd | grep pcmC${CARD} | awk '{print $2}'`
APP=`basename $PROCESS`
+ if [ "$APP" == "$PLAYER"] ]; then
+ echo "$PLAYER requested pause, but is already using sound card, ignoring" | systemd-cat
+ exit 0
+ fi
}
pause_alsaloop() {
@@ -64,6 +68,11 @@ pause_squeezelite() {
echo "not yet implemented"
}
+pause_gmediarender() {
+ pkill -USR1 raat_app dlna-mpris
+}
+
+
pause_process() {
case $APP in
mpd)
@@ -78,6 +87,9 @@ pause_process() {
snapcast)
pause_snapcast
;;
+ gmediarender)
+ pause_gmediarender
+ ;;
*)
echo "don't know how to pause $APP"
;;
@@ -119,7 +131,7 @@ for i in 1 1 1 1 1 ; do
done
# Still in use
-echo "$APP still using the sound card killing it"
+echo "$APP still using the sound card killing it" | systemd-cat
kill_process
# Now it should REALLY be available
@@ -127,5 +139,5 @@ check_paused
# Still not? Something is wrong, exit with exit code 1
DATE2=`date +%Y%m%d-%H%M%S`
-echo "$DATE1 $DATE2 pause-all $1 failed, $APP still running " >> /var/log/hifiberry.log
+echo "$DATE1 $DATE2 pause-all $1 failed, $APP still running " | systemd-cat
exit 1
