annotate src/epgdump_xml_parse.pl @ 153:e040d91c5cc7

Remove unused variables.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Sun, 02 Sep 2012 02:28:05 +0900
parents 036ae90f1b01
children 2c1cec3c5d64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
1 #!/usr/bin/perl -w
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
2 # epgdmp_xml_parse.pl -- parse epgdump XML file.
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
3 #
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
4 # Copyright 2012 Naoya OYAMA <naoya.oyama@gmail.com>
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
5 #
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or modify
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
7 # it under the terms of the GNU General Public License as published by
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
9 # (at your option) any later version.
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
10 #
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
14 # GNU General Public License for more details.
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
15 #
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
18
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
19 use strict;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
20 use XML::Simple;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
21
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
22 my $simple = XML::Simple->new (ForceArray => 1, KeepRoot => 1);
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
23 my $data = $simple->XMLin($ARGV[0]);
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
24
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
25 my @base = @{$data->{tv}};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
26 my %tv = %{$base[0]};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
27 my %channels = %{$tv{channel}};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
28 my %channel_info_list = ();
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
29 my @service_id_list = ();
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
30
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
31 while (my ($channelType, $channelRef) = each %channels) {
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
32 my %channel = %$channelRef;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
33 my $service_id = $channel{service_id};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
34 my @si = ();
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
35 my %sih = ();
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
36 my $tp = "";
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
37
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
38 if (defined($channel{satelliteinfo})) {
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
39 @si = @{$channel{satelliteinfo}};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
40 %sih = %{$si[0]};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
41 $tp = $sih{TP}[0];
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
42 if($tp =~ m/^BS\d+$/) {
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
43 $tp = $service_id;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
44 }
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
45 } else {
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
46 $tp = $ARGV[0];
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
47 $tp =~ s/^.*\/(\d+)\.xml$/$1/;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
48 }
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
49 my @dpna = @{$channel{"display-name"}};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
50 my %dpnh = %{$dpna[0]};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
51
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
52 $channel_info_list{$service_id}{SID} = $service_id;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
53 $channel_info_list{$service_id}{TP} = $tp;
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
54 $channel_info_list{$service_id}{NAME} = $dpnh{content};
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
55 push(@service_id_list, $service_id);
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
56 }
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
57
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
58 foreach my $service_id (sort {$a <=> $b} @service_id_list) {
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
59 print $channel_info_list{$service_id}{SID} . ",";
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
60 print $channel_info_list{$service_id}{TP} . ",";
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
61 print $channel_info_list{$service_id}{NAME} . "\n";
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
62 }
036ae90f1b01 EXPERIMENTAL: Add channel scan script.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
63 1;