Project

General

Profile

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

David jrm, 2015-11-23 12:23

 
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
    "Entretenimiento"       => $VARIETY ,
110
    "Concurso"              => $VARIETY ,
111
    "Concursos"             => $VARIETY ,
112
    "Informativo"           => $NEWS , 
113
    "Informativos"          => $NEWS ,
114
    "Noticias"              => $NEWS ,
115
    "Documentales"          => $DOCUMENTARY ,
116
    "Series"                => $SOAP ,
117
    "Serie"                 => $SOAP ,
118
    "Entrevistas"           => $INTERVIEW ,
119
    "Infantil"              => $KIDS ,
120
    "Información"           => $NEWS ,
121
    "Película para adultos" => $XXX ,
122
    "Cine"                  => $FILM ,
123
    "Espectáculo"           => $PERFORMING ,
124
    "Otros"                 => $VARIETY ,
125
    "Deportes"              => $SPORT ,
126
    "Deporte"               => $SPORT ,
127
    "Religion"              => $HISTORICAL ,
128
    "Fitness"               => $FITNESS ,
129
    "Animación"             => $CARTOON ,
130
    "Humor"                 => $COMEDY ,
131
    "Cortometraje"          => $MOVIE ,
132
    "Sin clasificar"        => $NOCLASS ,
133
    "Viajes"                => $DOCUMENTARY ,
134
    "Clásica"               => $CLASSICAL ,
135
    "Política"              => $SOCIAL ,
136
    "Debate"                => $DEBATE ,
137
    "Naturaleza y animales" => $NATURE ,
138
    "Reality Show"          => $VARIETY ,
139
    "Biográficos"           => $DOCUMENTARY ,
140
    "Ciencia y tecnología"  => $TECHNOLOGY ,
141
    "Actualidad"            => $NEWS ,
142
    "Videoclips"            => $MUSIC ,
143
    "Fantásticas"           => $SF ,
144
    "Programas"             => $SHOW ,
145
 ) ; 
146

    
147
my $PRE  = '<category lang=\"es\">' ;
148
my $POST = '</category>'  ;
149

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

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