-
Notifications
You must be signed in to change notification settings - Fork 10
/
tv_grab_kazer
104 lines (86 loc) · 4.06 KB
/
tv_grab_kazer
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh
# Script sh récupérateur XMLTV pour http://www.kazer.org/
# Script d'origine par Stéphane DUBOIS, hébergé sur Github: https://github.com/clark17/tv_grab_FR_Kazer/
# Définition des variables
TMPFILE=""
# Commande stop
_stop()
{
if [ -n $TMPFILE ]
then
rm "$TMPFILE"
rm /tmp/tvguide.xml
fi
exit 1
}
# Commande usage
usage()
{
echo "usage : $0 [--version|--description]"
exit 1;
}
if [ $# -gt 1 ]
then
usage
fi
if [ $# -eq 1 ]
then
OPTION=$1
if [ "--version" = "$OPTION" ] ; then
echo "XMLTV module version 0.2"
echo "Voici tv_grab_kazer version 0.2, 2013/06/12 20:00:00"
exit
fi
if [ "--description" = "$OPTION" ] ; then
echo "France Kazer"
exit
fi
usage
fi
# Définition de votre User Hash
KAZERURL="http://www.kazer.org/tvguide.zip?u=VOTRE_CLEF"
if [ -z "$KAZERURL" ]
then
echo "No valid KAZERURL="<url>" set" >&2
exit 1
fi
# Nom du zip avec le PID du shell courant
TMPFILE="/tmp/$$.xmltv.zip"
# Capturer si le script s'arrête
trap "_stop" 1 2 3 15
# Téléchargement du fichier xmltv.zip
wget -q "$KAZERURL" -O "$TMPFILE"
# Extraction du zip
unzip -q "$TMPFILE" -d /tmp/
# Effectue la correspondance entre les catégories de Kazer et celles de TVHeadEnd
sed -ri 's/<category lang="fr">Clips/<category lang="fr">Music \/ Ballet \/ Dance/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Concert/<category lang="fr">Music \/ Ballet \/ Dance/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Débat/<category lang="fr">Social \/ Political issues \/ Economics/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Dessin animé/<category lang="fr">Children'"'"'s \/ Youth programmes/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Divertissement/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Documentaire/<category lang="fr">Education \/ Science \/ Factual topics/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Émission/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Feuilleton/<category lang="fr">Movie \/ Drama/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Film/<category lang="fr">Movie \/ Drama/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Interview/<category lang="fr">News \/ Current affairs/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Jeu/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Jeunesse/<category lang="fr">Children'"'"'s \/ Youth programmes/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Journal/<category lang="fr">News \/ Current affairs/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Loterie/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Magazine/<category lang="fr">Education \/ Science \/ Factual topics/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Loterie/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Météo/<category lang="fr">News \/ Current affairs/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Politique/<category lang="fr">Social \/ Political issues \/ Economics/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Série/<category lang="fr">Movie \/ Drama/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Spectacle/<category lang="fr">Arts \/ Culture \(without music\)/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Sport/<category lang="fr">Sports/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Talk show/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Téléfilm/<category lang="fr">Movie \/ Drama/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Téléréalité/<category lang="fr">Show \/ Game show/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Théâtre/<category lang="fr">Arts \/ Culture \(without music\)/g' /tmp/tvguide.xml
sed -ri 's/<category lang="fr">Variétés/<category lang="fr">Arts \/ Culture \(without music\)/g' /tmp/tvguide.xml
# Affichage du contenu de tvguide.xml
cat /tmp/tvguide.xml
# Effacement des fichiers temporaires
rm "$TMPFILE"
rm /tmp/tvguide.xml