xmltv/grab/eu_epgdata build_channel_ids,NONE,1.1

Jan Schneider <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/eu_epgdata
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22538/grab/eu_epgdata

Added Files:
	build_channel_ids 
Log Message:
Add small helper script to update channel_ids from epgData's channel.xml.


--- NEW FILE: build_channel_ids ---
#!/usr/bin/perl -w

use XML::LibXML::Reader;

open(my $fp, '<', './channel_ids') or die('No channel_ids');
my %channels;
while (<$fp>) {
    chomp;
    if ($_ !~ /^#/) {
        @line = split(';');
        $channels{$line[0]} = $line[1];
    }
}
close($fp);

my $xml = XML::LibXML::Reader->new(
    location => './channel_y.xml',
    encoding => 'UTF-8'
) or die('No channel_y.xml');

while ($xml->read()) {
    if ($xml->nodeType() == XML_READER_TYPE_ELEMENT &&
        $xml->name() eq 'data') {
        my $data = $xml->copyCurrentNode(1);
        my $id = $data->findvalue('ch4');
        my $name = $data->findvalue('ch0');
        my $dvb = $data->findvalue('ch11');
        $name .= " ($dvb)" if $dvb;
        printf("%d;%s;%s\n",
               $id,
               $channels{$id} ? $channels{$id} : 'XMLTVID',
               $name
        );
    }
}


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.