Skip to content

Instantly share code, notes, and snippets.

@maricn
Last active December 29, 2020 18:12
Show Gist options
  • Save maricn/e136e9456ffe00a8ea0b899b5dc91545 to your computer and use it in GitHub Desktop.
Save maricn/e136e9456ffe00a8ea0b899b5dc91545 to your computer and use it in GitHub Desktop.
#!/bin/bash
ROOMS="
rc1
rc2
csh (cs-hamburg)
oio
r3s
cwtv2
kreaturworks
cbase
bitwaescherei
chaostrawler
chaoszone
franconiannet
hacc
restrealitaet
sendezentrum
wikipaka
xhain
infobeamer
classics
c3lounge
ambientlounge"
# parse the flag options (and their arguments)
while getopts r:a:p:q:t:h:l: OPT; do
case "$OPT" in
r)
ROOM="$OPTARG" ;;
a)
ARGS="$OPTARG" ;;
p)
PLAYER="$OPTARG" ;;
t)
TRANSLATION="$OPTARG" ;;
q)
QUALITY="$OPTARG" ;;
h)
HOST="$OPTARG" ;;
l)
echo "Rooms: $ROOMS"; exit 0 ;;
[?])
# got invalid option
echo "Usage: $0
-l all - list all rooms
-r room - choose a room
[-a] args - player args
[-p] player - player
[-t] trans - translations (native|translated)
[-h] host - host" >&2
exit 1 ;;
esac
done
# get rid of the just-finished flag arguments
shift $(($OPTIND-1))
# Originally taken from https://codevoid.de/0/p/stream.sh
# cdn.c3voc.de
HOST="${HOST:-live.self.c3voc.de}"
PLAYER="${PLAYER:-mpv}"
ARGS="${ARGS:---record-file=rc3/$1.$(date +%FT%T).webm}"
QUALITY="${QUALITY:-sd}"
$PLAYER $ARGS "https://${HOST}/${ROOM}_${TRANSLATION}_${QUALITY}.webm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment