1
|
#!/usr/bin/perl -w
|
2
|
|
3
|
#
|
4
|
# The categories recognized by tvheadend (see epg.c)
|
5
|
#
|
6
|
|
7
|
my $MOVIE = "Movie / Drama";
|
8
|
my $THRILLER = "Detective / Thriller";
|
9
|
my $ADVENTURE = "Adventure / Western / War";
|
10
|
my $SF = "Science fiction / Fantasy / Horror";
|
11
|
my $COMEDY = "Comedy";
|
12
|
my $SOAP = "Soap / Melodrama / Folkloric";
|
13
|
my $ROMANCE = "Romance";
|
14
|
my $HISTORICAL = "Serious / Classical / Religious / Historical movie / Drama";
|
15
|
my $XXX = "Adult movie / Drama";
|
16
|
|
17
|
my $NEWS = "News / Current affairs";
|
18
|
my $WEATHER = "News / Weather report";
|
19
|
my $NEWS_MAGAZINE = "News magazine";
|
20
|
my $DOCUMENTARY = "Documentary";
|
21
|
my $DEBATE = "Discussion / Interview / Debate";
|
22
|
my $INTERVIEW = $DEBATE ;
|
23
|
|
24
|
my $SHOW = "Show / Game show";
|
25
|
my $GAME = "Game show / Quiz / Contest";
|
26
|
my $VARIETY = "Variety show";
|
27
|
my $TALKSHOW = "Talk show";
|
28
|
|
29
|
my $SPORT = "Sports";
|
30
|
my $SPORT_SPECIAL = "Special events (Olympic Games; World Cup; etc.)";
|
31
|
my $SPORT_MAGAZINE = "Sports magazines";
|
32
|
my $FOOTBALL = "Football / Soccer";
|
33
|
my $TENNIS = "Tennis / Squash";
|
34
|
my $SPORT_TEAM = "Team sports (excluding football)";
|
35
|
my $ATHLETICS = "Athletics";
|
36
|
my $SPORT_MOTOR = "Motor sport";
|
37
|
my $SPORT_WATER = "Water sport";
|
38
|
|
39
|
my $KIDS = "Children's / Youth programmes";
|
40
|
my $KIDS_0_5 = "Pre-school children's programmes";
|
41
|
my $KIDS_6_14 = "Entertainment programmes for 6 to 14";
|
42
|
my $KIDS_10_16 = "Entertainment programmes for 10 to 16";
|
43
|
my $EDUCATIONAL = "Informational / Educational / School programmes";
|
44
|
my $CARTOON = "Cartoons / Puppets";
|
45
|
|
46
|
my $MUSIC = "Music / Ballet / Dance";
|
47
|
my $ROCK_POP = "Rock / Pop";
|
48
|
my $CLASSICAL = "Serious music / Classical music";
|
49
|
my $FOLK = "Folk / Traditional music";
|
50
|
my $JAZZ = "Jazz";
|
51
|
my $OPERA = "Musical / Opera";
|
52
|
|
53
|
my $CULTURE = "Arts / Culture (without music)";
|
54
|
my $PERFORMING = "Performing arts";
|
55
|
my $FINE_ARTS = "Fine arts";
|
56
|
my $RELIGION = "Religion";
|
57
|
my $POPULAR_ART = "Popular culture / Traditional arts";
|
58
|
my $LITERATURE = "Literature";
|
59
|
my $FILM = "Film / Cinema";
|
60
|
my $EXPERIMENTAL_FILM = "Experimental film / Video";
|
61
|
my $BROADCASTING = "Broadcasting / Press";
|
62
|
|
63
|
my $SOCIAL = "Social / Political issues / Economics";
|
64
|
my $MAGAZINE = "Magazines / Reports / Documentary";
|
65
|
my $ECONOMIC = "Economics / Social advisory";
|
66
|
my $VIP = "Remarkable people";
|
67
|
|
68
|
my $SCIENCE = "Education / Science / Factual topics";
|
69
|
my $NATURE = "Nature / Animals / Environment";
|
70
|
my $TECHNOLOGY = "Technology / Natural sciences";
|
71
|
my $DIOLOGY = $TECHNOLOGY;
|
72
|
my $MEDECINE = "Medicine / Physiology / Psychology";
|
73
|
my $FOREIGN = "Foreign countries / Expeditions";
|
74
|
my $SPIRITUAL = "Social / Spiritual sciences";
|
75
|
my $FURTHER_EDUCATION = "Further education";
|
76
|
my $LANGUAGES = "Languages";
|
77
|
|
78
|
my $HOBBIES = "Leisure hobbies";
|
79
|
my $TRAVEL = "Tourism / Travel";
|
80
|
my $HANDICRAF = "Handicraft";
|
81
|
my $MOTORING = "Motoring";
|
82
|
my $FITNESS = "Fitness and health";
|
83
|
my $COOKING = "Cooking";
|
84
|
my $SHOPPING = "Advertisement / Shopping";
|
85
|
my $GARDENING = "Gardening";
|
86
|
|
87
|
#
|
88
|
# This is the
|
89
|
#
|
90
|
#
|
91
|
#
|
92
|
|
93
|
my %REPLACE=(
|
94
|
|
95
|
"Émission" => 0,
|
96
|
"Fin" => 0,
|
97
|
"Fin des programmes" => 0 ,
|
98
|
"Loterie" => 0 ,
|
99
|
"Programme indéterminé" => 0 ,
|
100
|
"Météo" => $WEATHER ,
|
101
|
"Drame" => $MOVIE ,
|
102
|
"Série fantastique" => $SF,
|
103
|
"Magazine scientifique" => $SCIENCE,
|
104
|
"Magazine de télé-achat" => $SHOPPING,
|
105
|
"Série réaliste" => $MOVIE,
|
106
|
"Série hospitalière" => $MOVIE,
|
107
|
"Jeu" => $GAME ,
|
108
|
"Magazine de la gastronomie" => $COOKING,
|
109
|
"Journal" => $NEWS ,
|
110
|
"Feuilleton sentimental" => $SOAP ,
|
111
|
"Téléfilm romanesque" => $SOAP ,
|
112
|
"Feuilleton réaliste" => $SOAP ,
|
113
|
"Série sentimentale" => $SOAP ,
|
114
|
"Téléfilm de suspense" => $THRILLER ,
|
115
|
"Téléréalité" => $VIP ,
|
116
|
"Série de téléréalité" => $VIP ,
|
117
|
"Magazine du show-biz" => $VIP ,
|
118
|
"Série humoristique" => $COMEDY ,
|
119
|
"Téléfilm humoristique" => $COMEDY ,
|
120
|
"Série policière" => $THRILLER ,
|
121
|
"Comédie policière" => $THRILLER ,
|
122
|
"Magazine sportif" => $SPORT_MAGAZINE,
|
123
|
"Téléfilm dramatique" => $MOVIE ,
|
124
|
"Téléfilm humoristique" => $COMEDY ,
|
125
|
"Téléfilm sentimental" => $SOAP ,
|
126
|
"Téléfilm romanesque" => $SOAP ,
|
127
|
"Football" => $FOOTBALL ,
|
128
|
"Tennis" => $TENNIS ,
|
129
|
"Divertissement" => $SHOW ,
|
130
|
"Multisports" => $SPORT ,
|
131
|
"Sport" => $SPORT ,
|
132
|
"Sports mécaniques" => $SPORT_MOTOR ,
|
133
|
"Comédie" => $COMEDY ,
|
134
|
"Classique" => $CLASSICAL,
|
135
|
"Documentaire" => $DOCUMENTARY ,
|
136
|
"Magazine de la mode" => $MAGAZINE ,
|
137
|
"Animalier" => $NATURE ,
|
138
|
"Nature" => $NATURE ,
|
139
|
"Magazine animalier" => $NATURE ,
|
140
|
"Découvertes" => $FOREIGN ,
|
141
|
"Magazine religieux" => $RELIGION ,
|
142
|
"Sports" => $SPORT ,
|
143
|
"Voyage" => $FOREIGN ,
|
144
|
"Culture" => $CULTURE ,
|
145
|
"Magazine littéraire" => $LITERATURE ,
|
146
|
"Magazine sportif" => $SPORT_MAGAZINE ,
|
147
|
"Téléfilm policier" => $THRILLER ,
|
148
|
"Magazine politique" => $SOCIAL,
|
149
|
"Série dramatique" => $MOVIE ,
|
150
|
"Environnement" => $NATURE ,
|
151
|
"Opéra" => $OPERA ,
|
152
|
"Magazine de géopolitique" => $DOCUMENTARY ,
|
153
|
"Série de suspense" => $THRILLER ,
|
154
|
"Economie" => $SOCIAL,
|
155
|
"Film" => $FILM ,
|
156
|
"Téléfilm catastrophe" => $FILM ,
|
157
|
"Magazine du cinéma" => $FILM ,
|
158
|
"Magazine du court métrage" => $FILM ,
|
159
|
"Magazine pornographique" => $XXX ,
|
160
|
"Magazine de charme" => $XXX ,
|
161
|
"Magazine culturel" => $CULTURE ,
|
162
|
"Cérémonie" => $SPORT_SPECIAL ,
|
163
|
"Magazine de découvertes" => $TRAVEL ,
|
164
|
"Magazine de reportages" => $TRAVEL ,
|
165
|
"Magazine régional" => $TRAVEL ,
|
166
|
"Magazine du multimédia" => $EXPERIMENTAL_FILM ,
|
167
|
"Magazine de services" => $NEWS_MAGAZINE ,
|
168
|
"Magazine du jeu vidéo" => $HOBBIES ,
|
169
|
"Magazine de la mer" => $MAGAZINE ,
|
170
|
"Magazine de société" => $MAGAZINE ,
|
171
|
"Magazine historique" => $MAGAZINE ,
|
172
|
"Magazine du consommateur" => $ECONOMIC ,
|
173
|
"Dessin animé" => $CARTOON ,
|
174
|
"Série jeunesse" => $CARTOON ,
|
175
|
"Politique" => $SOCIAL,
|
176
|
"Magazine culinaire" => $COOKING,
|
177
|
"Ballet" => $MUSIC ,
|
178
|
"Magazine musical" => $MUSIC ,
|
179
|
"Formule 1" => $SPORT_MOTOR ,
|
180
|
"Comédie sentimentale" => $SOAP ,
|
181
|
"Athlétisme" => $ATHLETICS,
|
182
|
"Magazine du jardinage" => $GARDENING ,
|
183
|
"Interview" => $DEBATE ,
|
184
|
"Rugby" => $SPORT_TEAM ,
|
185
|
"Gastronomie" => $COOKING,
|
186
|
"Magazine de la décoration" => $HOBBIES ,
|
187
|
"Indycar" => $SPORT_MOTOR ,
|
188
|
"Automobilisme" => $SPORT_MOTOR ,
|
189
|
"Magazine de la santé" => $MEDECINE ,
|
190
|
"Magazine médical" => $MEDECINE ,
|
191
|
"Santé" => $MEDECINE ,
|
192
|
"Débat" => $DEBATE ,
|
193
|
"Sciences et technique" => $TECHNOLOGY ,
|
194
|
"Clip" => $MUSIC ,
|
195
|
"Clips" => $MUSIC ,
|
196
|
"Téléfilm musical" => $MUSIC ,
|
197
|
"Téléfilm dramatique" => $MOVIE ,
|
198
|
"Concert" => $MUSIC ,
|
199
|
"Théâtre" => $CULTURE ,
|
200
|
"Spectacle" => $SHOW ,
|
201
|
"Fitness" => $FITNESS ,
|
202
|
"Magazine jeunesse" => $KIDS ,
|
203
|
"Emission jeunesse" => $KIDS ,
|
204
|
"Série d'aventures" => $ADVENTURE ,
|
205
|
"Magazine d'actualité" => $NEWS_MAGAZINE ,
|
206
|
"Magazine d'information" => $NEWS_MAGAZINE ,
|
207
|
"Magazine de l'automobile" => $MOTORING ,
|
208
|
"Magazine de l'économie" => $ECONOMIC ,
|
209
|
"Série d'animation" => $CARTOON ,
|
210
|
"Téléfilm d'animation" => $CARTOON ,
|
211
|
"Court métrage d'animation" => $CARTOON ,
|
212
|
"Film d'animation" => $CARTOON ,
|
213
|
"Série d'action" => $ADVENTURE ,
|
214
|
"Magazine de l'art de vivre" => $TRAVEL ,
|
215
|
"Magazine de l'environnement" => $NATURE ,
|
216
|
"Téléfilm d'horreur" => $SF ,
|
217
|
"Série d'horreur" => $SF ,
|
218
|
"Téléfilm de science-fiction" => $SF ,
|
219
|
"Téléfilm d'action" => $THRILLER ,
|
220
|
"Téléfilm" => $MOVIE ,
|
221
|
"Série de science-fiction" => $SF ,
|
222
|
"Série historique" => $HISTORICAL ,
|
223
|
) ;
|
224
|
|
225
|
my $PRE = '<category lang=\"fr\">' ;
|
226
|
my $POST = '</category>' ;
|
227
|
|
228
|
sub myfilter {
|
229
|
my ($a) = @_;
|
230
|
if ( exists $REPLACE{$a} ) {
|
231
|
return $REPLACE{$a} ;
|
232
|
} else {
|
233
|
print STDERR "Warning: Unmanaged category: '$a'\n" ;
|
234
|
return $a ;
|
235
|
}
|
236
|
}
|
237
|
|
238
|
while (<>) {
|
239
|
my $line = $_ ;
|
240
|
$line =~ s/($PRE)(.*)($POST)/"$1".myfilter("$2")."$3"/ge ;
|
241
|
print $line;
|
242
|
}
|
243
|
|