Skip to content

Instantly share code, notes, and snippets.

@tohn
Last active June 15, 2016 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tohn/5941553 to your computer and use it in GitHub Desktop.
Save tohn/5941553 to your computer and use it in GitHub Desktop.
Dmenu based german public tv station switcher
#!/bin/bash
# Watch various streams
# http://marmaro.de/lue/txt/2014-01-05.txt
# https://linuxundich.de/gnu-linux/fussball-em-2016-auf-ard-und-zdf-per-vlc-oder-totem-schauen/
# requirements
command -v mpv >/dev/null 2>&1 || { echo >&2 "I require \"mpv\" but it's not installed. Aborting."; exit 1; }
command -v mencoder >/dev/null 2>&1 || { echo >&2 "I require \"mencoder\" but it's not installed. Aborting."; exit 1; }
command -v rtmpdump >/dev/null 2>&1 || { echo >&2 "I require \"rtmpdump\" but it's not installed. Aborting."; exit 1; }
command -v dmenu >/dev/null 2>&1 || { echo >&2 "I require \"dmenu\" but it's not installed. Aborting."; exit 1; }
player=$(which mpv) # insert player here
option="--really-quiet -fs" # add options
puffer="/tmp/puffer.mp4"
trap 'killall mencoder' EXIT
#tv_ARD="rtsp://daserste.edges.wowza.gl-systemhaus.de/live/mp4:daserste_int_576"
tv_ARD="http://daserste_live-lh.akamaihd.net/i/daserste_de@91204/master.m3u8"
#tv_ZDF="rtsp://3gp-livestreaming1.zdf.de/liveedge2/de10_v1_710.sdp"
tv_ZDF="http://zdf1314-lh.akamaihd.net/i/de14_v1@392878/master.m3u8"
tv_ZDFneo="rtsp://3gp-livestreaming1.zdf.de/liveedge2/de09_v1_710.sdp"
tv_ZDFkultur="rtsp://3gp-livestreaming1.zdf.de/liveedge2/de07_v1_710.sdp"
tv_ZDFinfo="rtsp://3gp-livestreaming1.zdf.de/liveedge2/de08_v1_710.sdp"
tv_Arte="rtmp://artestras.fc.llnwd.net/artestras/s_artestras_scst_geoFRDE_de?s=1320220800&h=878865258ebb8eaa437b99c3c7598998"
tv_3sat="http://zdf_hds_ng-f.akamaihd.net/i/none02_v1@87014/master.m3u8"
#tv_kika="mms://85.239.122.162/mk3w-3faw-3rqf-enc0-kika?MSWMExt=.asf"
#tv_nasa="http://nasa-f.akamaihd.net/public_h264_700@54826"
res=$(echo "${!tv_*}" | tr ' ' '\n' | dmenu)
if [[ "$res" == "tv_Arte" ]] ; then
rtmpdump -r "${!res}" --live -o - | "$player" $option -
elif [[ "$res" == "tv_ARD" || "$res" == "tv_ZDF" || "$res" == "tv_3sat" ]] ; then
mencoder -really-quiet "${!res}" -vid 10 -oac pcm -ovc copy -o "$puffer" &
sleep 5
"$player" $option "$puffer"
else
"$player" $option "${!res}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment