RE: XMLTV, Kazer & French categories » xmltv_convert_categories.pl
1 |
#!/usr/bin/perl -w
|
---|---|
2 |
|
3 |
my $MOVIE = "Movie / Drama"; |
4 |
|
5 |
my %REPLACE=( |
6 |
|
7 |
"Movie" => $MOVIE , |
8 |
"movie" => $MOVIE , |
9 |
) ; |
10 |
|
11 |
my $PRE = '<category lang=\"en\">' ; |
12 |
my $POST = '</category>' ; |
13 |
|
14 |
sub myfilter { |
15 |
my ($a) = @_; |
16 |
if ( exists $REPLACE{$a} ){ |
17 |
return $REPLACE{$a} ; |
18 |
}
|
19 |
else { |
20 |
print STDERR "Warning: Unmanaged category: '$a'\n" ; |
21 |
return $a ; |
22 |
}
|
23 |
}
|
24 |
|
25 |
while (<>) { |
26 |
my $line = $_ ; |
27 |
$line =~ s/($PRE)(.*)($POST)/"$1".myfilter("$2")."$3"/ge ; |
28 |
print $line ; |
29 |
}
|
- « Previous
- 1
- 2
- Next »