lsusb | grep -q '040d:340b' && opts='--audio-device=pipewire/alsa_output.usb-FX-AUDIO_FX-AUDIO-D-802-00.analog-stereo'
Stations=("CBS" "MyTV" "CW" "ABC" "Outlaw" "MeTV" "True Crime" "StartTV" "MeToons" "PBS" "PBS World" "PBS Create" "PBS Kids" "NBC" "FOX" "The365" "Cozi" "Court" "Mystery")
printf "\n%s\n%s\n" " Stations " "--------------"
for i in ${!Stations[@]}; do
printf "%3s%11s\n" "$(($i + 1)))" "${Stations[$i]}"
done; echo
(( "$1" % 1 + 1 )) &>/dev/null && STN="$1" || read -p "Select Station: " STN
case "$STN" in
1) Channel="http://hdhomerun:5004/auto/v3.1" ;;
2) Channel="http://hdhomerun:5004/auto/v3.2" ;;
3) Channel="http://hdhomerun:5004/auto/v3.4" ;;
4) Channel="http://hdhomerun:5004/auto/v13.1" ;;
5) Channel="http://hdhomerun:5004/auto/v13.2" ;;
6) Channel="http://hdhomerun:5004/auto/v13.3" ;;
7) Channel="http://hdhomerun:5004/auto/v13.4" ;;
8) Channel="http://hdhomerun:5004/auto/v13.5" ;;
9) Channel="http://hdhomerun:5004/auto/v13.6" ;;
10) Channel="http://hdhomerun:5004/auto/v16.1" ;;
11) Channel="http://hdhomerun:5004/auto/v16.2" ;;
12) Channel="http://hdhomerun:5004/auto/v16.3" ;;
13) Channel="http://hdhomerun:5004/auto/v16.4" ;;
14) Channel="http://hdhomerun:5004/auto/v46.1" ;;
15) Channel="http://hdhomerun:5004/auto/v46.2" ;;
16) Channel="http://hdhomerun:5004/auto/v46.3" ;;
17) Channel="http://hdhomerun:5004/auto/v46.4" ;;
18) Channel="http://hdhomerun:5004/auto/v46.5" ;;
19) Channel="http://hdhomerun:5004/auto/v46.6" ;;
*) exit ;;
esac
if [[ $DISPLAY ]]; then
mpv $opts -fs "$Channel"
else
trap "rm .xinitrc" EXIT
echo "mpv $opts -fs $Channel" > ~/.xinitrc
startx &> /dev/null
fi