I've pushed an update to Docker Hub that should address the potential deadlock created by no audio being present on channels with sports event blackouts.
Pull bnhf/ah4c:test2
to try it out.
Bumping the channel up one or down one worked in my testing, but which way to bump varied based on the channel in question -- so here's the relevant section of code I'm using in bmitune.sh, if you need to make any adjustments or channel additions:
#Check for active audio stream with maxDuration, preTuneAudioCheck, sleepBeforeAudioCheck and sleepAfterAudioCheck as arguments
activeAudioCheck() {
local startTime=$(date +%s)
local maxDuration=$1
local minimumLoudness=-50
local sleepBeforeAudioCheck=$3
local sleepAfterAudioCheck=$4
local preTuneAudioCheck=$2
while true; do
sleep $sleepBeforeAudioCheck
checkLoudness=$(ffmpeg -t 1 -i $encoderURL -filter:a ebur128 -map 0:a -f null -hide_banner - 2>&1 | awk '/I: /{print $2}')
if (( $(date +%s) - $startTime > $maxDuration )); then
echo "Active audio stream not detected in $maxDuration seconds."
if [ $preTuneAudioCheck = "false" ]; then
echo "Active audio stream not detected after tuning completed"
case "$specialID" in
"212")
echo "Possible sports event blackout on NFL Network, so bumping channel up"
$adbTarget shell input keyevent KEYCODE_DPAD_LEFT
echo 0 > "$streamerNoPort/last_channel"
exit 1
;;
"213")
echo "Possible sports event blackout on MLB Network, so bumping channel down"
$adbTarget shell input keyevent KEYCODE_DPAD_RIGHT
echo 0 > "$streamerNoPort/last_channel"
exit 1
;;
*)
echo "Possible sports event blackout, so bumping channel down"
$adbTarget shell input keyevent KEYCODE_DPAD_RIGHT
echo 0 > "$streamerNoPort/last_channel"
exit 1
;;
esac
else
exit 1
fi
fi
if (( $(echo "$checkLoudness > $minimumLoudness" | bc -l) )); then
echo "Active audio stream detected with $checkLoudness LUF."
break
fi
echo "Active audio stream not yet detected -- loudness is $checkLoudness LUF. Continuing..."
sleep $sleepAfterAudioCheck
done
}
Please pull the new container, including updating scripts, when you have a moment to do some tests -- and let me know how it works. Hopefully there'll be a blacked out game in your area this month, so you can try it in a real world situation.