dotfiles/.bin/OLD/KAPUTT/ccc-streams.sh

77 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
sformat="webm"
squality="sd"
translated="native"
mediaplayer="mpv"
usage() {
printf "Available rooms:\n" >&2
printf " a|ada|1\n" >&2
printf " b|borg|2\n" >&2
printf " c|clarke|3\n" >&2
printf " d|dijkstra|4\n" >&2
printf " e|elize|5\n" >&2
printf " chaoswest|150\n" >&2
printf " openinfrastructure|oio\n" >&2
printf " wiki|151\n\n" >&2
exit 1
}
[ -z $1 ] && usage;
hall="$1"
case "$hall" in
1|2|3|4|5|150|151|oio)
;;
a|ada)
hall="1"
;;
b|borg)
hall="2"
;;
c|clarke)
hall="3"
;;
d|dijkstra)
hall="4"
;;
e|eliza)
hall="5"
;;
chaoswest)
hall="150"
;;
open*)
hall="oio"
;;
wiki*)
hall="151"
;;
*)
usage;
;;
esac
webmbase="http://cdn.c3voc.de/s%s_%s_%s.webm"
hlsbase="http://cdn.c3voc.de/hls/s%s_%s_%s.m3u8"
audiobase="http://cdn.c3voc.de/s%s_%s.%s"
slink=""
case "$sformat" in
webm)
slink="$(printf "$webmbase" "${hall}" "${translated}" "${squality}")"
;;
m3u8|hls)
slink="$(printf "$hlsbase" "${hall}" "${translated}" "${squality}")"
;;
*)
printf "Only the stream formats »webm« and »hls« are available.\n" >&2
exit 1
;;
esac
$mediaplayer "$slink"