-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzapper
executable file
·36 lines (29 loc) · 1.01 KB
/
zapper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
exit_error() {
echo -e "\e[1m\e[31mVeuillez installer '${1}' pour utiliser cette application\e[0m"
exit 1
}
! type whiptail >/dev/null 2>&1 && exit_error "whiptail"
! type curl >/dev/null 2>&1 && exit_error "curl"
! type vlc >/dev/null 2>&1 && exit_error "vlc"
curl -LSso .playlist mafreebox.freebox.fr/freeboxtv/playlist.m3u
sed -i -e '1d' .playlist
sed -e 's/.* - //' .playlist > .chaines
sed -i -e '/rtsp.*/d' .chaines
mapfile -t lines < .chaines
menu() {
list=("Q" "Quitter" "" ""); i=0
for ch in "${lines[@]}"; do
i=$(($i+1))
list+=("$i" "$ch ")
done
ENTRIES=$(whiptail --title "Liste des chaînes TV" --menu --nocancel "" 20 60 14 "${list[@]}" 3>&2 2>&1 1>&3)
case "${ENTRIES}" in
Q) killall vlc >&/dev/null; exit 0;;
([0-9]|[0-9][0-9]|[0-9][0-9][0-9]|1000) chaine=$(($ENTRIES*2)); \
killall vlc &>/dev/null; url=$(sed -n "${chaine}p" .playlist); cvlc $url &>/dev/null &;;
*) menu;;
esac
}
parent_path=$(cd "$(dirname "${BASH_SOURCE}")"; pwd -P)
menu; $parent_path/zapper