02.9.2018, 14:46
Kód:
#! /bin/bash
source=$*
tempplaylist="/storage/.kodi/userdata/addon_data/service.playlist.o2tv/playlist.m3u8"
stream=$(grep -A 1 "${source}$" /storage/.kodi/userdata/addon_data/service.playlist.o2tv/o2tv.generic.m3u8 | head -n 2 | tail -n 1)
wget -qO ${tempplaylist} ${stream}
streamcount=$(cat ${tempplaylist} | grep -Eo "(http|https)://[\da-z./?A-Z0-9\D=_-]*" | wc -l)
streamcount=$((streamcount-1))
if [ "$streamcount" = "-1" ]; then streamcount=0; fi
ffmpeg -protocol_whitelist file,http,https,tcp,tls -fflags +genpts -i ${tempplaylist} -probesize 32 -reconnect_at_eof 1 -reconnect_streamed 1 -c copy -map p:${streamcount}? -f mpegts -bsf:v h264_mp4toannexb,dump_extra -mpegts_service_type digital_tv
Z o2tv.playlist.m3u8 napisu do putty
pipe:///storage/.kodi/userdata/addon_data/service.playlist.o2tv/test.sh Prima Cool HD
A vysledek je
CoreELEC:~ # pipe:///storage/.kodi/userdata/addon_data/service.playlist.o2tv/test.sh
Prima Cool HD
-sh: pipe:///storage/.kodi/userdata/addon_data/service.playlist.o2tv/test.sh: not found