Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Bash by registered user uwe ( 13 years ago )
#!/bin/bash
tvprefix=/Volumes/media/mediathek/
log=$tvprefix/.mediathek.log
maxtries=25
PATH=$PATH:/usr/local/bin
if [ -n "$log" ]; then
echo "$(date +%F-%T) start" >> $log
fi
# Das Glueck dieser Erde
search[0]="Das Glück dieser Erde"
url[0]="http://www.ardmediathek.de/ard/servlet/export/rss/id=7283770"
grep[0]="http://www.ardmediathek.de[^<]*"
dir[0]="$tvprefix/Das Glück dieser Erde"
# Verbotene Liebe
search[1]="Verbotene Liebe"
url[1]="http://mediathek.daserste.de/daserste/servlet/export/rss?sendung=439104"
grep[1]="http.*_folge[^<]*"
dir[1]="$tvprefix/Verbotene Liebe"
tmp=$(mktemp -t $(basename $0)) || exit 1
for x in 0 1; do
urls="$(curl -s "${url[$x]}" | grep -o "${grep[$x]}")"
mkdir -p "${dir[$x]}"
for u in $urls; do
curl -s "$u" > $tmp
title="$(grep -o "${search[$x]} - Folge[^<]*" $tmp)"
if [ "x$title" == "x" ]; then continue; fi
ep=${title/*Folge }
ep=${ep/:*}
save="${dir[$x]}/$ep $title"
if ! grep -q "done $title" $log -o [ ! -s "$save.flv" ]; then
if [ -n "$log" ]; then
echo "$(date +%F-%T) get $title" >> $log
fi
try=1
ex=3
while [[ $ex -ne 0 ]]; do
if [[ $[++try] -eq $maxtries ]]; then
break
fi
if [[ $ex -eq 1 ]]; then
rm -f "$save.flv"
fi
rtmpdump -q -e --host vod.daserste.de --app ardfs/ --playpath "$(grep -o 'mp4:video.*Web-L[^"]*' $tmp)" -o "$save.flv"
ex=$?
done
if [[ $ex -eq 0 ]]; then
chmod 644 "$save.flv"
if [ -n "$log" ]; then
echo "$(date +%F-%T) done $title" >> $log
fi
else
rm -f "$save.flv"
if [ -n "$log" ]; then
echo "$(date +%F-%T) fail $title" >> $log
fi
fi
fi
done
done
if [ -n "$log" ]; then
echo "$(date +%F-%T) stop" >> $log
fi
rm -f $tmp
Revise this Paste