1
|
|
2
|
#!/usr/bin/perl -w
|
3
|
|
4
|
#
|
5
|
# The categories recognized by tvheadend (see epg.c)
|
6
|
#
|
7
|
|
8
|
my $MOVIE = "Movie / Drama";
|
9
|
my $THRILLER = "Detective / Thriller";
|
10
|
my $ADVENTURE = "Adventure / Western / War";
|
11
|
my $SF = "Science fiction / Fantasy / Horror";
|
12
|
my $COMEDY = "Comedy";
|
13
|
my $SOAP = "Soap / Melodrama / Folkloric";
|
14
|
my $ROMANCE = "Romance";
|
15
|
my $HISTORICAL = "Serious / Classical / Religious / Historical movie / Drama";
|
16
|
my $XXX = "Adult movie / Drama";
|
17
|
|
18
|
my $NEWS = "News / Current affairs";
|
19
|
my $WEATHER = "News / Weather report";
|
20
|
my $NEWS_MAGAZINE = "News magazine";
|
21
|
my $DOCUMENTARY = "Documentary";
|
22
|
my $DEBATE = "Discussion / Interview / Debate";
|
23
|
my $INTERVIEW = $DEBATE ;
|
24
|
|
25
|
my $SHOW = "Show / Game show";
|
26
|
my $GAME = "Game show / Quiz / Contest";
|
27
|
my $VARIETY = "Variety show";
|
28
|
my $TALKSHOW = "Talk show";
|
29
|
|
30
|
my $SPORT = "Sports";
|
31
|
my $SPORT_SPECIAL = "Special events (Olympic Games; World Cup; etc.)";
|
32
|
my $SPORT_MAGAZINE = "Sports magazines";
|
33
|
my $FOOTBALL = "Football / Soccer";
|
34
|
my $TENNIS = "Tennis / Squash";
|
35
|
my $SPORT_TEAM = "Team sports (excluding football)";
|
36
|
my $ATHLETICS = "Athletics";
|
37
|
my $SPORT_MOTOR = "Motor sport";
|
38
|
my $SPORT_WATER = "Water sport";
|
39
|
|
40
|
my $KIDS = "Children's / Youth programmes";
|
41
|
my $KIDS_0_5 = "Pre-school children's programmes";
|
42
|
my $KIDS_6_14 = "Entertainment programmes for 6 to 14";
|
43
|
my $KIDS_10_16 = "Entertainment programmes for 10 to 16";
|
44
|
my $EDUCATIONAL = "Informational / Educational / School programmes";
|
45
|
my $CARTOON = "Cartoons / Puppets";
|
46
|
|
47
|
my $MUSIC = "Music / Ballet / Dance";
|
48
|
my $ROCK_POP = "Rock / Pop";
|
49
|
my $CLASSICAL = "Serious music / Classical music";
|
50
|
my $FOLK = "Folk / Traditional music";
|
51
|
my $JAZZ = "Jazz";
|
52
|
my $OPERA = "Musical / Opera";
|
53
|
|
54
|
my $CULTURE = "Arts / Culture (without music)";
|
55
|
my $PERFORMING = "Performing arts";
|
56
|
my $FINE_ARTS = "Fine arts";
|
57
|
my $RELIGION = "Religion";
|
58
|
my $POPULAR_ART = "Popular culture / Traditional arts";
|
59
|
my $LITERATURE = "Literature";
|
60
|
my $FILM = "Film / Cinema";
|
61
|
my $EXPERIMENTAL_FILM = "Experimental film / Video";
|
62
|
my $BROADCASTING = "Broadcasting / Press";
|
63
|
|
64
|
my $SOCIAL = "Social / Political issues / Economics";
|
65
|
my $MAGAZINE = "Magazines / Reports / Documentary";
|
66
|
my $ECONOMIC = "Economics / Social advisory";
|
67
|
my $VIP = "Remarkable people";
|
68
|
|
69
|
my $SCIENCE = "Education / Science / Factual topics";
|
70
|
my $NATURE = "Nature / Animals / Environment";
|
71
|
my $TECHNOLOGY = "Technology / Natural sciences";
|
72
|
my $DIOLOGY = $TECHNOLOGY;
|
73
|
my $MEDECINE = "Medicine / Physiology / Psychology";
|
74
|
my $FOREIGN = "Foreign countries / Expeditions";
|
75
|
my $SPIRITUAL = "Social / Spiritual sciences";
|
76
|
my $FURTHER_EDUCATION = "Further education";
|
77
|
my $LANGUAGES = "Languages";
|
78
|
my $NOCLASS = "Unpublished";
|
79
|
my $HOBBIES = "Leisure hobbies";
|
80
|
my $TRAVEL = "Tourism / Travel";
|
81
|
my $HANDICRAF = "Handicraft";
|
82
|
my $MOTORING = "Motoring";
|
83
|
my $FITNESS = "Fitness and health";
|
84
|
my $COOKING = "Cooking";
|
85
|
my $SHOPPING = "Advertisement / Shopping";
|
86
|
my $GARDENING = "Gardening";
|
87
|
|
88
|
#
|
89
|
# This is the
|
90
|
#
|
91
|
#
|
92
|
#
|
93
|
|
94
|
my %REPLACE=(
|
95
|
|
96
|
"fr:Météo" => $WEATHER ,
|
97
|
"fr:Film" => $MOVIE ,
|
98
|
"fr:Théâtre" => $PERFORMING,
|
99
|
"fr:Ballet" => $OPERA ,
|
100
|
"fr:Clips" => $MUSIC ,
|
101
|
"fr:Concert" => $MUSIC ,
|
102
|
"fr:Court métrage" => $EXPERIMENTAL_FILM,
|
103
|
"fr:Débat" => $SOCIAL ,
|
104
|
"fr:Dessin animé" => $CARTOON ,
|
105
|
"fr:Divertissement" => $VARIETY ,
|
106
|
"fr:Documentaire" => $DOCUMENTARY ,
|
107
|
"fr:Drame" => $SOAP ,
|
108
|
"fr:Émission" => 0,
|
109
|
"fr:Feuilleton" => $SOAP ,
|
110
|
"fr:Fin" => 0,
|
111
|
"fr:Fin des programmes" => 0 ,
|
112
|
"fr:Interview" => $INTERVIEW ,
|
113
|
"fr:Jeu" => $GAME ,
|
114
|
"fr:Jeunesse" => $KIDS ,
|
115
|
"fr:Journal" => $NEWS ,
|
116
|
"fr:Loterie" => 0 ,
|
117
|
"fr:Magazine" => $MAGAZINE ,
|
118
|
"fr:Opéra" => $OPERA ,
|
119
|
"fr:Série" => $MOVIE ,
|
120
|
"fr:Spectacle" => $PERFORMING ,
|
121
|
"fr:Sport" => $SPORT ,
|
122
|
"fr:Talk show" => $TALKSHOW ,
|
123
|
# "fr:Téléfilm" => $MOVIE ,
|
124
|
"fr:Télé-réalité" => $VARIETY ,
|
125
|
"fr:Téléréalité" => $VARIETY ,
|
126
|
"fr:Tiercé" => $SPORT ,
|
127
|
"fr:Variétés" => $VARIETY ,
|
128
|
|
129
|
"es:Toros" => $POPULAR_ART ,
|
130
|
"es:Drama" => $MOVIE ,
|
131
|
"es:Deportes de invierno" => $SPORT_SPECIAL ,
|
132
|
"es:Otros deportes" => $SPORT ,
|
133
|
"es:Ciclismo" => $SPORT ,
|
134
|
"es:Automovilismo" => $SPORT_MOTOR ,
|
135
|
"es:Fútbol" => $FOOTBALL ,
|
136
|
"es:Champions League" => $FOOTBALL ,
|
137
|
"es:Cultural\/Educativo" => $VARIETY ,
|
138
|
"es:Telefilme" => $MOVIE ,
|
139
|
"es:Ocio y Aficiones" => $HOBBIES,
|
140
|
"es:Música" => $MUSIC ,
|
141
|
"es:Musicales" => $OPERA,
|
142
|
"es:Magazine" => $MAGAZINE ,
|
143
|
"es:Entretenimiento" => $VARIETY ,
|
144
|
"es:Concurso" => $VARIETY ,
|
145
|
"es:Concursos" => $VARIETY ,
|
146
|
"es:Informativo" => $NEWS ,
|
147
|
"es:Informativos" => $NEWS ,
|
148
|
"es:Noticias" => $NEWS ,
|
149
|
"es:Documentales" => $DOCUMENTARY ,
|
150
|
"es:Series" => $SOAP ,
|
151
|
"es:Serie" => $SOAP ,
|
152
|
"es:Entrevistas" => $INTERVIEW ,
|
153
|
"es:Infantil" => $KIDS ,
|
154
|
"es:Información" => $NEWS ,
|
155
|
"es:Película para adultos" => $XXX ,
|
156
|
"es:Cine" => $FILM ,
|
157
|
"es:Espectáculo" => $PERFORMING ,
|
158
|
"es:Otros" => $VARIETY ,
|
159
|
"es:Deportes" => $SPORT ,
|
160
|
"es:Deporte" => $SPORT ,
|
161
|
"es:Religion" => $HISTORICAL ,
|
162
|
"es:Fitness" => $FITNESS ,
|
163
|
"es:Animación" => $CARTOON ,
|
164
|
"es:Humor" => $COMEDY ,
|
165
|
"es:Cortometraje" => $MOVIE ,
|
166
|
"es:Sin clasificar" => $NOCLASS ,
|
167
|
"es:Viajes" => $DOCUMENTARY ,
|
168
|
"es:Clásica" => $CLASSICAL ,
|
169
|
"es:Política" => $SOCIAL ,
|
170
|
"es:Debate" => $DEBATE ,
|
171
|
"es:Naturaleza y animales" => $NATURE ,
|
172
|
"es:Reality Show" => $VARIETY ,
|
173
|
"es:Biográficos" => $DOCUMENTARY ,
|
174
|
"es:Ciencia y tecnología" => $TECHNOLOGY ,
|
175
|
"es:Actualidad" => $NEWS ,
|
176
|
"es:Videoclips" => $MUSIC ,
|
177
|
"es:Fantásticas" => $SF ,
|
178
|
"es:Programas" => $SHOW ,
|
179
|
) ;
|
180
|
|
181
|
my $PRE = '<category( lang=\"([a-z]+)\"|)>' ;
|
182
|
my $POST = '</category>' ;
|
183
|
|
184
|
sub myfilter {
|
185
|
my ($lang,$name) = @_;
|
186
|
$lang="en" if ( $lang eq "" ) ; # Default language is "en" when is no lang attribute
|
187
|
my $a = "$lang:$name" ;
|
188
|
if ( exists $REPLACE{$a} ) {
|
189
|
return $REPLACE{$a} ;
|
190
|
} elsif ( $lang eq "en" ) {
|
191
|
return $name ; # For English, assume that missing entries are fine
|
192
|
} else {
|
193
|
print STDERR "Warning: Unmanaged category: '$a'\n" ;
|
194
|
return $name ;
|
195
|
}
|
196
|
}
|
197
|
|
198
|
while (<>) {
|
199
|
my $line = $_ ;
|
200
|
# Warning $PRE contains 2 hidden level of parenthesis
|
201
|
#
|
202
|
$line =~ s/($PRE)(.*)($POST)/"$1".myfilter($3,$4)."$5"/ge ;
|
203
|
print $line;
|
204
|
}
|