rendered paste body#!/bin/bash
# arte3
# bas sur : arte2 by jipe
# un script pour visualiser et/ou enregistrer les emissions d'Arte depuis http://plus7.arte.tv/
#requiert zenity
liste="http://plus7.arte.tv/fr/$(wget -O - -q http://plus7.arte.tv/ | awk -F '"' '/xmlURL/{print $4}')"
#'
# ^ pour retrouver une coloration syntaxique correcte dans emacs -_-
while read line; do case "$line" in
*\<index\>*) set ${line//[<>]/ }; index=$2 ;;
*\<bigTitle\>*) set ${line//[<>]/ }; title="${@:2:$(($#-2))}" ;;
*\<startDate\>*) set ${line//[<>]/ }; startdate="${2/T/ }" ;;
*\<offlineDate\>*) set ${line//[<>]/ }; offlinedate="${2/T/ }" ;;
*\<targetURL\>*) set ${line//[<>]/ }; url="${@:2:$(($#-2))}"; liste1[index]="$title ($startdate) ($offlinedate)"; liste2[index]="$url"; liste3[index]="$title";;
esac; done <<< "$(wget -O - -q "$liste")"
while :; do
num=0
NUM=$(while ((num<${#liste1[@]})); do echo $num; echo ${liste1[num]}; (( num++)); done | zenity --list --title="Arte + 7" --text="Choisir une emission" --column "N" --column="Emission" --height=400 --width=650)
case ${NUM:=QUIT} in QUIT) exit 0 ;; esac
choix=$(zenity --list --title "Arte + 7" --text="Choisir l'action" --column "Action" "Enregistrer" "Visualiser")
url="$(wget -O - -q "${liste2[NUM]}" | awk -F '"' '/HQ_FR.wmv/{print $4}')"
#'
case ${choix:=QUIT} in
"Enregistrer")
mplayer -dumpstream -dumpfile "${liste3[NUM]}.wmv" "$(wget -O - -q "$url" | awk -F '"' '/REF HREF/{print $2}')" ;;
"Visualiser")
mplayer -cache 8192 "$(wget -O - -q "$url" | awk -F '"' '/REF HREF/{print $2}')" ;;
QUIT) exit 0;;
esac
done