Project

General

Profile

RE: XMLTV, Kazer & French categories » categorias.pl

David jrm, 2015-11-23 14:01

 
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
    "Toros"                 => $POPULAR_ART ,
96
    "Drama"                 => $MOVIE ,
97
    "Deportes de invierno"  => $SPORT_SPECIAL ,
98
    "Otros deportes"        => $SPORT ,
99
    "Ciclismo"              => $SPORT ,
100
    "Automovilismo"         => $SPORT_MOTOR ,
101
    "Fútbol"                => $FOOTBALL ,
102
    "Champions League"      => $FOOTBALL ,
103
    "Cultural\\/Educativo"  => $VARIETY ,
104
    "Telefilme"             => $MOVIE ,
105
    "Ocio y Aficiones"      => $HOBBIES,
106
    "Música"                => $MUSIC ,
107
    "Musicales"             => $OPERA,
108
    "Magazine"              => $MAGAZINE ,
109
    "Magazines"             => $MAGAZINE ,
110
    "Entretenimiento"       => $VARIETY ,
111
    "Concurso"              => $VARIETY ,
112
    "Concursos"             => $VARIETY ,
113
    "Informativo"           => $NEWS , 
114
    "Informativos"          => $NEWS ,
115
    "Noticias"              => $NEWS ,
116
    "Documentales"          => $DOCUMENTARY ,
117
    "Series"                => $SOAP ,
118
    "Serie"                 => $SOAP ,
119
    "Entrevistas"           => $INTERVIEW ,
120
    "Infantil"              => $KIDS ,
121
    "Información"           => $NEWS ,
122
    "Película para adultos" => $XXX ,
123
    "Cine"                  => $FILM ,
124
    "Espectáculo"           => $PERFORMING ,
125
    "Otros"                 => $VARIETY ,
126
    "Deportes"              => $SPORT ,
127
    "Deporte"               => $SPORT ,
128
    "Religion"              => $HISTORICAL ,
129
    "Fitness"               => $FITNESS ,
130
    "Animación"             => $CARTOON ,
131
    "Humor"                 => $COMEDY ,
132
    "Cortometraje"          => $MOVIE ,
133
    "Sin clasificar"        => $NOCLASS ,
134
    "Viajes"                => $DOCUMENTARY ,
135
    "Clásica"               => $CLASSICAL ,
136
    "Política"              => $SOCIAL ,
137
    "Debate"                => $DEBATE ,
138
    "Debates"               => $DEBATE ,
139
    "Naturaleza y animales" => $NATURE ,
140
    "Reality Show"          => $VARIETY ,
141
    "Biográficos"           => $DOCUMENTARY ,
142
    "Ciencia y tecnología"  => $TECHNOLOGY ,
143
    "Actualidad"            => $NEWS ,
144
    "Videoclips"            => $MUSIC ,
145
    "Fantásticas"           => $SF ,
146
    "Programas"             => $SHOW ,
147
	
148
 ) ; 
149

    
150
my $PRE  = '<category lang=\"es\">' ;
151
my $POST = '</category>'  ;
152

    
153
sub myfilter {
154
  my ($a) = @_;
155
  if ( exists $REPLACE{$a} ) {     
156
      return $REPLACE{$a} ;
157
  } else {
158
      print STDERR "Warning: Unmanaged category: '$a'\n" ;
159
      return $a ;
160
  }
161
}
162

    
163
while (<>) {
164
    my $line = $_ ;
165
    $line =~ s/($PRE)(.*)($POST)/"$1".myfilter("$2")."$3"/ge ;
166
    print $line;
167
} 
(1-1/2)