#!/bin/bash # Copyright (C) 2007–2021 Petr Písař # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License . # There is NO WARRANTY, to the extent permitted by law. VERSION="30" ## CHANGELOG # # Version 30 # * stv1 and stv2 replaced with rtvs1, rtvs2, and rtvs3. # # Version 29 # * Update nhk-world-* addresses. # # Version 28 # * Recognize mpv030 value of PLAYER. MPV 0.30.0 changed syntax of a --cache # option. # # Version 27 # * nhk-world-* replaced with nhk-world-300, nhk-world-770, and nhk-world-1180. # Effective since 2019-12-17. # # Version 26 # * ct-a* streams updated # * nhk-world updated and a new bistream added # * noe-* updated and renamed to new bitstream values # # Version 25 # * Russia Today updated and renamed to rustd-news-* # * Russia Today Documentary added (rustd-doc-*) # * ctart-a3500 added (3.5-Mbps Czech TV Art) # * ctart-* updated # * ČT D addedd (ctd-* added) # * Support for mpv >= 0.9 player added (`mpv09' identifier) # * tvba updated # * ocko renamed to ocko-* # * tvb1 removed # * ruv removed # * rustavi2-1 and rustavi2-2 removed # * nckyo removed # * meteopress removed # # Version 24 # * Update ct2-a* bitrate values # * ct4-a3500 added (3.5-Mbps Czech TV 4) # * NHK World updated, nhk-world-* renamed according to new stream bit rates. # * All Livestation channels removed (they were changed into heavy javascript # bloat requiring login through social services). # * All Voyo channels remove (they require an account and money). # * tvziva removed (station bankkrupted). # * All RTPM Czech TV streams removed (brodcaster does not support them anymore) # * Support for mpv player added (`mpv' for pre-0.8 versions, and `mpv08' for # 0.8 and newer which do not have --no-consolecontrols option). # # Version 23 # * NHK World updated, nhk-world-h* renamed to nhk-world-512, nhk-world-256, # nhk-world-128 # # Version 22 # * Update NHK World URLs, rename European hub (nhk-world-h) to nhk-world-hnl, # add American one (nhk-world-hca) # * Add streams for Czech Television Art (ctart-*) # ct2-a* lists bitrate in bits, not in kilobits # * nasa-edu and nasa-public-* updated # * nasa-media removed # # Version 21 # * Adjust ct1-a* streams for new bit-rate identifiers # # Version 20 # * kctv addedd # * tvb1 updated # * Update livestation helper # # Version 19 released # * Streams available from voyo.sk added (thanks to Pali Rohár, dajto-* do not # work for me, geographical restriction probably) # * markiza-h added (2-Mbps version of markiza) # # Version 18 released # * The media player is configurable now. Use /etc/televizerc or ~/.televizerc # to override default configuration. Syntax is described in usage output. # # Version 17 released # * markiza updated (thanks to Pali Rohár) # # Version 16 released # * Update ČT24 and ČT1 HTTP/H264 stream rates # # Version 15 released # * nhk-world-h updated # * jpopsuki updated # # Version 14 released # * Put back livestation helper removed by accident # # Version 13 released # * Fix Deutsche Welle stations # * Fix livestation helper # # Version 12 released # * Add Czech TV Apple formats (ct1-a*, ct2-a*, ct24-a*, ct4-a*) # * Fix ct4-h100 # # Version 11 released # * Add ဒီမိုကရေတစ်မြန်မာ့အသံ (dvb) # * Add Bloomber TV (bloomberg) # * Livestation streams readded: aljazeerar, aljazeeren, bbcworldnews # * Add Deagu MBC (mbc-daegu) # * Add Arirang daily news (arirang-news). This is not a live stream. # * Add Arirang Korea (arirang-korea) # * Add Arirang World (arirang-world) # * NHK World replaced with high bit-rate version as old URL has been defunct # * Add libyatv as livestation helper has been resurrected # # Version 10 released # * Readd Rustavi2 in two instances (rustavi2-1, rustavi2-2) # * Remove stv3 as operator ceased the channel # * Update Russia Today as 3 different bitrates (rustd-300, rustd-500, # rustd-1000) # * Remove publictv as owner ceased operation # * Update markiza # * Update ktv # * Add Hope TV streams in H264 (hopetv-100, hopetv-300, hopetv-600) # * Update Georgian Public Brodcasting TV (add 3 servers) # * Add Deutsche Welle TV Arabia (dwtv-arabia) # * Add Deutsche Welle TV Asia (dwtv-asia) # * Add Deutsche Welle TV Europe (dwtv-europe) # * Remove dwtven (English version of Deutsche Welle) # * Remove 3.5-Mbps Czech TV streams as they do not exist # * Update cctv4 # * Update belarus # * Update alsharq # * Update aliraq # * Update ocko # # Version 9 released # * Replace nasa stream with new NASA TV streams # (differ on special occasions only) # * Update ct1, ct2, ct4, ct24. They require external ctstream script. # # Version 8 released # * CT Windows Media and Real Media stream removed # * CT1 H264 streams added # * CT2 H264 streams added # * CT4 H264 streams added # * CT24 H264 streams added # * Remove z1 as owner ceased broadcasting # * nhk-world-l stream added (English dubbed NHK World) # * nckyo added # # Version 7 released # * Update Czech (state) TV helper because web pages have changed, migrate all # stations to ivysilani-helper() # * Remove Czech TV streams for gone olympic games # * Add tvziva # * Add gimi # * Update nasa URL # # Version 6 released # * Czech TV playlist extraction adjusted to accept IP address # * Winter Olympic Games brodcasted by Czech TV fixed # * Readded z1 and ocko as latest MPlayer (2010-02-13) supports RTMP streams # # Version 5 released # * ctzoh added # (only trial spot currently, company is going to offer 8 streams) # * lux added # * removed helperlivestaion() channels because they moved to RTMP # * psctv removed as free access has been terminated # # Version 4 released # * cropping fixed on ct4-rpal # * ct1-rl, ct4-rl, ct4-rh fixed # * ct1-rpal and ct2-rpal a has correct size now # (or mplayer/ffmpeg has been fixed), resizing video filters removed. # * Failure of helper-ct() handled properly # * quoting improved in helper-livestation() # # Version 3 released # * helper-ct() fixed to accept newly deployed CDN servers with up to three # digit serial number. Thanks to Radovan Drazny . # * Typos fixed # # Version 2 released # * Columns made wider. # * Al Jazeera in English (aljazeeren) and in Arabic (aljazeerar) added. # * Euronews in German (euronewsde) added. Stream is broken currently. # * Livestation streams started using simple token autorization. # * helper-livestream() added and given programs fixed. # # Version 1 released # See for some streams of # Czech stations. # Default values CACHE=2048 DIRECT_STREAM=1 PLAYER="mplayer" # Load configuration test -f /etc/televizerc && source /etc/televizerc test -f ~/.televizerc && source ~/.televizerc # Usage death message function help() { local FMT='%-10s %-16s %s\n' cat<
. Program je šířen BEZ JAKÉKOLI ZÁRUKY, jak jen zákon dovoluje. COPY exit 1; } # Adds TV to the list by stream URL function addtv() { I=$((${#PRGM[@]})) PRGM[$I]="$1" TITLE[$I]="$2" URL[$I]="$3" EXTRA[$I]="$4" } # Adds TV to the list by URL helper function. # The function will be executed and it must set stream URL into MYURL variable # and the function must terminate successfully. function caltv() { I=$((${#PRGM[@]})) PRGM[$I]="$1" TITLE[$I]="$2" HELPER[$I]="$3" EXTRA[$I]="$4" } # Adds TV to the list by streamer function. # The function will be executed and its standard output will be connected to # a media player. function strtv() { I=$((${#PRGM[@]})) PRGM[$I]="$1" TITLE[$I]="$2" STREAMER[$I]="$3" EXTRA[$I]="$4" } function streamer-ct() { if [ "$#" != 2 ]; then echo "$0: bad invocation" 1>&2 return 1 fi local CHANNEL="$1" local RATE="$2" local PAGE="http://www.ceskatelevize.cz/ivysilani/zive/${CHANNEL}/" ctstream -v -A -s "$PAGE" "$RATE" } # Return value of element from XML string function get_element() { local ELEMENT="$1" local TEXT="$2" echo "$TEXT" | grep -o "<${ELEMENT}>[^<]*" | \ sed 's/[^>]*>\([^<]*\).*/\1/' | sed 's/&/\&/g' } function helper-rtvs() { if [ "$#" != 1 ]; then echo "$0: bad invocation" return 1 fi local CHANNEL="$1" local JSON_DATA JSON_DATA=$(wget -O - "http://www.rtvs.sk/json/live5f.json?c=${CHANNEL}&b=mozilla&p=linux&v=47&f=1&d=1") MYURL=$(echo "$JSON_DATA" | sed -ne '/"src" :/s/.*"\(http:\/\/[^"]*\).*/\1/p') } function helper-dwelle() { if [ "$#" != 2 ]; then echo "$0: bad invocation" return 1 fi local NAME="$1" local RATE="$2" local STREAMER FILE SMIL SMIL=$(wget -O - "http://www.metafilegenerator.de/DWelle/${NAME}/flv/tv.smil") STREAMER=$(echo "$SMIL" | grep -o 'base="[^"]*"' | sed 's/[^"]*"\([^"]*\).*/\1/') FILE=$(echo "$SMIL" | grep "bandwidth=\"${RATE}\"" | grep -o 'src="[^"]*"' | sed 's/[^"]*"\([^"]*\).*/\1/') MYURL="${STREAMER}${FILE} live=1" } function helper-noe() { local HEIGHT="$1" XSPF=$(wget -O - "http://www.tvnoe.cz/sites/default/files/live/rtmp${HEIGHT}.xspf") HTTP=$(printf '%s' "$XSPF" | sed -e '/location/!d; s/.*\[\(http:[^]]*\).*/\1/') RTMP=$(LC_ALL=C wget -O /dev/null "$HTTP" 2>&1 | sed -e '/^Location: rtmp:/!d; s/Location: \([^ ]*\) .*/\1/') MYURL="${RTMP}" } # Process argument as date(1) format string. Usefull to insert nowaday date function helper-injecttime() { if [ "$#" != 1 ]; then echo "$0: bad invocation" return 1 fi MYURL=$(date "+${1}") if [ "$?" -ne 0 ]; then echo "Could not format date: $1" return 1 fi } # TV programs definition addtv "aliraq" "Al-Iraqiya" "http://212.7.196.74:80/iraqia" # This works: rtmpdump -v -r rtmp://livestfslivefs.fplive.net/aljazeeraflashlive-live/aljazeera_en_veryhigh addtv "alsharq" "AlSharqiya TV" "rtmp://ns6.indexforce.com/live/mystream" addtv "althingi" "Althingi" "http://netvarp.althingi.is/beint" caltv "arirang-news" "Arirang daily news" "helper-injecttime mms://121.156.66.59/News_2200/2200News_300k_%F.asf" addtv "arirang-korea" "Arirang Korea" "mms://s1.arirang.co.kr/Korea_Live" addtv "arirang-world" "Arirang World" "mms://s1.arirang.co.kr/World_Live" addtv "aqape" "Aqape TV" "mms://wms.dominiocreativo.com/agapetv" addtv "belarus" "Беларусь-ТВ" "mms://livecast.tvr.by/video" addtv "cctv4" "CCTV 4" "mms://4.71.37.8/cctv4-200" strtv "ct1-a500" "ČT1 HTTP/H264 500k" "streamer-ct ct1 628000" strtv "ct1-a1000" "ČT1 HTTP/H264 1M" "streamer-ct ct1 1160000" strtv "ct1-a2000" "ČT1 HTTP/H264 2M" "streamer-ct ct1 2176000" strtv "ct1-a3500" "ČT1 HTTP/H264 3,5M" "streamer-ct ct1 3712000" strtv "ct2-a500" "ČT2 HTTP/H264 500k" "streamer-ct ct2 628000" strtv "ct2-a1000" "ČT2 HTTP/H264 1M" "streamer-ct ct2 1160000" strtv "ct2-a2000" "ČT2 HTTP/H264 2M" "streamer-ct ct2 2176000" strtv "ct2-a3500" "ČT2 HTTP/H264 3,5M" "streamer-ct ct2 3712000" strtv "ct24-a500" "ČT24 HTTP/H264 500k" "streamer-ct ct24 628000" strtv "ct24-a1000" "ČT24 HTTP/H264 1M" "streamer-ct ct24 1160000" strtv "ct24-a2000" "ČT24 HTTP/H264 2M" "streamer-ct ct24 2176000" strtv "ct24-a3500" "ČT24 HTTP/H264 3,5M" "streamer-ct ct24 3712000" strtv "ct4-a500" "ČT4 HTTP/H264 500k" "streamer-ct ct4 628000" strtv "ct4-a1000" "ČT4 HTTP/H264 1M" "streamer-ct ct4 1160000" strtv "ct4-a2000" "ČT4 HTTP/H264 1M" "streamer-ct ct4 2176000" strtv "ct4-a3500" "ČT4 HTTP/H264 3,5M" "streamer-ct ct4 3712000" strtv "ctart-a500" "ČTart HTTP/H264 500k" "streamer-ct ct6 628000" strtv "ctart-a1000" "ČTart HTTP/H264 1M" "streamer-ct ct6 1160000" strtv "ctart-a2000" "ČTart HTTP/H264 2M" "streamer-ct ct6 2176000" strtv "ctart-a3500" "ČTart HTTP/H264 3,5M" "streamer-ct ct6 3712000" strtv "ctd-a500" "ČT D HTTP/H264 500k" "streamer-ct ct5 628000" strtv "ctd-a1000" "ČT D HTTP/H264 1M" "streamer-ct ct5 1160000" strtv "ctd-a2000" "ČT D HTTP/H264 2M" "streamer-ct ct5 2176000" strtv "ctd-a3500" "ČT D HTTP/H264 3,5M" "streamer-ct ct5 3712000" caltv "dwtv-amerika-l" "Deutsche Welle TV Amerika 85 kb/s" "helper-dwelle tv-northamerica low" caltv "dwtv-amerika-m" "Deutsche Welle TV Amerika 500 kb/s" "helper-dwelle tv-northamerica medium" caltv "dwtv-arabia-l" "Deutsche Welle TV Arabia 85 kb/s" "helper-dwelle tv-arabia low" caltv "dwtv-arabia-m" "Deutsche Welle TV Arabia 500 kb/s" "helper-dwelle tv-arabia medium" caltv "dwtv-asia-l" "Deutsche Welle TV Asia 85 kb/s" "helper-dwelle tv-asia low" caltv "dwtv-asia-m" "Deutsche Welle TV Asia 500 kb/s" "helper-dwelle tv-asia medium" caltv "dwtv-europe-l" "Deutsche Welle TV Europe 85 kb/s" "helper-dwelle tv-europa low" caltv "dwtv-europe-m" "Deutsche Welle TV Europe 500 kb/s" "helper-dwelle tv-europa medium" caltv "dwtv-europe-h" "Deutsche Welle TV Europe 1.2 Mb/s" "helper-dwelle tv-europa high" caltv "dwtv-lamerica-l" "Deutsche Welle TV Latinoamérica 85 kb/s" "helper-dwelle tv-latinoamerica low" caltv "dwtv-lamerica-m" "Deutsche Welle TV Latinoamérica 500 kb/s" "helper-dwelle tv-latinoamerica medium" addtv "france24fr" "France24 Français" "mms://stream1.france24.yacast.net/f24_livefr" addtv "gimi" "TV Gimi" "http://stream5.visual.cz/tvgimi" addtv "gpb1-g1" "Georgian Public Broadcast 1 server 1" "mms://80.241.246.154/1tv" addtv "gpb1-g2" "Georgian Public Broadcast 1 server 2" "mms://80.241.246.158/1tv" addtv "gpb1-usa" "Georgian Public Broadcast 1 USA server" "mms://80.241.246.158/1tv" addtv "hopetv-h" "Hope TV 896 kb/s" 'http://mediaserver.hopetv.cz/hopetv_high?MSWMExt=.asf' addtv "hopetv-l" "Hope TV 390 kb/s" 'http://mediaserver.hopetv.cz/hopetv_mid?MSWMExt=.asf' addtv "hopetv-600" "Hope TV 600 kb/s" 'rtmp://stream2.mediawork.cz/hopetv/hopetv1' addtv "hopetv-300" "Hope TV 300 kb/s" 'rtmp://stream2.mediawork.cz/hopetv/hopetv2' addtv "hopetv-100" "Hope TV 100 kb/s" 'rtmp://stream2.mediawork.cz/hopetv/hopetv3' addtv "jpopsuki" "JPopsuki TV" 'http://jpopsuki.fm:8800/;stream.nsv' addtv "kctv" "조선중앙TV" 'http://112.170.78.145:50000/chosun' addtv "ktv" "Kurdistan TV" "rtmp://www.kurdistantv.info/live/livestream live=1" addtv "lux" "TV Lux" "http://streaming.tvlux.sk/tvluxlive/" "-aspect 4:3" addtv "mbc-daegu" "Daegu MBC" "http://211.115.127.29:80/live" addtv "nasa-edu" "NASA TV Education" 'rtmp://infozen.fc.llnwd.net/infozen/edu_400 live=1' # Playlist 'http://www.nasa.gov/multimedia/isslivestream.asx' addtv "nasa-iss" "NASA TV ISS" "mms://a1709.l1856953708.c18569.g.lm.akamaistream.net/D/1709/18569/v0001/reflector:53708" addtv "nasa-public-200" "NASA TV Public 200k" "rtmp://infozen.fc.llnwd.net/infozen/nasa_200 live=1" addtv "nasa-public-400" "NASA TV Public 400k" "rtmp://infozen.fc.llnwd.net/infozen/nasa_400 live=1" addtv "nasa-public-1000" "NASA TV Public 1M" "rtmp://infozen.fc.llnwd.net/infozen/nasa_1000 live=1" # Playlist https://nhkworld.webcdn.stream.ne.jp/www11/nhkworld-tv/global/2003458/live.m3u8 addtv "nhk-world-300" "NHK World 300k" "https://nhkwlive-xjp.akamaized.net/hls/live/2003458/nhkwlive-xjp-en/index_200k.m3u8" addtv "nhk-world-770" "NHK World 770k" "https://nhkwlive-xjp.akamaized.net/hls/live/2003458/nhkwlive-xjp-en/index_600k.m3u8" addtv "nhk-world-1180" "NHK World 1180k" "https://nhkwlive-xjp.akamaized.net/hls/live/2003458/nhkwlive-xjp-en/index_1M.m3u8" caltv "noe-350" "TV Noe 350k" "helper-noe 176" caltv "noe-500" "TV Noe 500k" "helper-noe 288" caltv "noe-1000" "TV Noe 1000k" "helper-noe 432" addtv "ocko-500" "TV Óčko 600k" "rtmp://194.79.52.77/ockoi/ockoHQ3" addtv "ocko-1000" "TV Óčko 1M" "rtmp://194.79.52.77/ockoi/ockoHQ2" addtv "ocko-2500" "TV Óčko 2,5M" "rtmp://194.79.52.77/ockoi/ockoHQ1" # RTA works but the URL is based on date and region. # TODO: Find the algorithm and write helper #addtv "rta-vc" "RTA" "mms://stream1.rta.cz/quality_middle/119000/118236.wmv" #addtv "rta-vc-700" "RTA VČ 700k" "mms://stream1.rta.cz/quality_high/115000/114636.wmv" #addtv "rta-vc-300" "RTA VČ 300k" "mms://stream1.rta.cz/quality_middle/115000/114636.wmv" addtv "rustd-doc-500" "Russia Today Documentary 500k" "rtsp://hdn.octoshape.net/er-rt/ch5_240p" addtv "rustd-doc-700" "Russia Today Documentary 700k" "rtsp://hdn.octoshape.net/er-rt/ch5_320p" addtv "rustd-doc-1000" "Russia Today Documentary 1M " "rtsp://hdn.octoshape.net/er-rt/ch5_480p" addtv "rustd-doc-1500" "Russia Today Documentary 1,5M " "rtsp://hdn.octoshape.net/er-rt/ch5_720p" addtv "rustd-news-500" "Russia Today News 500k" "rtsp://hdn.octoshape.net/er-rt/ch1_240p" addtv "rustd-news-700" "Russia Today News 700k" "rtsp://hdn.octoshape.net/er-rt/ch1_320p" addtv "rustd-news-1000" "Russia Today News 1M " "rtsp://hdn.octoshape.net/er-rt/ch1_480p" addtv "rustd-news-1500" "Russia Today Documentary 1,5M " "rtsp://hdn.octoshape.net/er-rt/ch1_720p" caltv "rtvs1" "Jednotka (RTVS)" "helper-rtvs 1" caltv "rtvs2" "Dvojka (RTVS)" "helper-rtvs 2" caltv "rtvs3" "Trojka (RTVS)" "helper-rtvs 3" addtv "tvba" "TV Bratislava" "http://212.89.230.11:8083/stream.flv" # Parse parameters if [ \( $# = 0 \) -o \( "${1:0:1}" = '-' \) ]; then help; fi if [ $# -ge 1 ]; then for ((I=0; ${#PRGM[@]} - I; I=I+1)); do if [ "$1" == "${PRGM[$I]}" ]; then # TV program found MYURL="${URL[$I]}"; if test -z "$MYURL" && test -n "${HELPER[$I]}"; then # URL undefined, try to get it by helper ${HELPER[$I]}; if [ $? -gt 0 ]; then echo "Chyba: Nelze získat URL proudu: Pomocná funkce ${HELPER[$I]} selhala" exit 1; fi fi if test -z "$MYURL" && test -n "${STREAMER[$I]}"; then # URL undefined, use existing streamer MYSTREAMER="${STREAMER[$I]}" fi MYEXTRA="${EXTRA[$I]}"; break; fi done if test -z "${MYURL}" && test -z "$MYSTREAMER"; then echo "Chyba: Program „$1“ nebyl nalezen" echo "Nápovědu získáte zavoláním programu bez parametrů." exit 1 fi fi shift; # Go test -n "$DIRECT_STREAM" && unset http_proxy if test -n "$MYURL"; then case "$PLAYER" in mplayer|mplayer2) set -x "$PLAYER" -cache "$CACHE" $MYEXTRA "$@" "$MYURL" ;; mpv|mpv08) set -x mpv --cache "$CACHE" $MYEXTRA "$@" "$MYURL" ;; mpv09) set -x mpv --cache="$CACHE" $MYEXTRA "$@" "$MYURL" ;; mpv030) set -x mpv --cache=yes --demuxer-max-bytes="${CACHE}k" $MYEXTRA "$@" "$MYURL" ;; *) set -x "$PLAYER" "$@" "$MYURL" ;; esac else case "$PLAYER" in gst123) echo "Přehrávač „$PLAYER“ neumí přehrávat ze standardního vstupu." exit 1 ;; mplayer|mplayer2) $MYSTREAMER | \ "$PLAYER" -cache "$CACHE" $MYEXTRA "$@" -noconsolecontrols - ;; mpv) $MYSTREAMER | \ "$PLAYER" --cache "$CACHE" $MYEXTRA "$@" --no-consolecontrols - ;; mpv08) $MYSTREAMER | \ mpv --cache "$CACHE" $MYEXTRA "$@" - ;; mpv09) $MYSTREAMER | \ mpv --cache="$CACHE" $MYEXTRA "$@" - ;; mpv030) $MYSTREAMER | \ mpv --cache=yes --demuxer-max-bytes="${CACHE}k" $MYEXTRA "$@" - #mpv $MYEXTRA "$@" - ;; *) $MYSTREAMER | "$PLAYER" "$@" /dev/stdin ;; esac fi # vim: textwidth=0