HDHRStatus/hdhrstatus.sh

20 lines
1008 B
Bash
Raw Normal View History

2020-04-03 11:56:49 -04:00
#!/bin/bash
2020-05-15 15:45:03 -04:00
HDHRIP="${1}"
2020-04-03 11:56:49 -04:00
tunerCount="3" # tuner count minus 1 since tuners start at 0
printdata () {
IFS=$'\n'
2020-04-06 12:56:10 -04:00
echo "Tuner Number, Virtual Channel, Frequency, Program Number, Modulation Lock, Signal Strength, Signal Quality, Symbol Quality, Streaming Rate, Resource Lock,"
2020-04-03 11:56:49 -04:00
for f in $(seq 0 $tunerCount); do
#for f in 0 1 2 3; do
printf "Tuner $f, ";
for p in $(curl -s "http://${HDHRIP}/tuners.html?page=tuner$f" | egrep "Virtual Channel|Frequency|Program Number|Modulation Lock|Signal Strength|Signal Quality|Symbol Quality|Streaming Rate|Resource Lock" | sed 's/<tr><td>//g' | sed 's#</td><td>##g' | sed 's#</td></tr>##g' | sed 's/Virtual Channel//g' | sed 's/Frequency//g' | sed 's/ProgramFrequency//g' | sed 's/Program Number//g' | sed 's/Modulation Lock//g' | sed 's/Signal Strength//g' | sed 's/Signal Quality//g' | sed 's/Symbol Quality//g' | sed 's/Streaming Rate//g' | sed 's/Resource Lock//g'); do
printf "%s, " $p;
done
echo ""
done
}
2020-04-06 12:56:10 -04:00
printdata | rev | sed 's/,//' | rev | column -t -s,