CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Laurent_R] cherryEPG: Edit Log



zaca011
New User

Feb 8, 2016, 1:30 AM


Views: 2518
Re: [Laurent_R] cherryEPG

hi,

thanks for replay
here is part of the code that refers to the import xml.
Code

Code
sub importXmlTv {  
my $epg = shift;
my $filename = shift;

use XML::Simple;

my $xml = XMLin( $filename, KeepRoot => 1);

my $schedule = $xml->{tv}{programme};

foreach my $rawEvent ( @$schedule) {
my $event;

# take the title

# the start and stop
$rawEvent->{start} =~ m/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/;
my @t = ( $6, $5, $4, $3, $2 - 1, $1 );
$event->{start} = timelocal(@t);

$rawEvent->{stop} =~ m/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/;
@t = ( $6, $5, $4, $3, $2 - 1, $1 );
$event->{stop} = timelocal(@t);

if( $rawEvent->{channel} eq "NameCh") {
$event->{uid} = 2;
}
else {
die( "Unknown service name: $rawEvent->{channel}");
}

my @descriptors;
my $short_descriptor;
$short_descriptor->{descriptor_tag} = 0x4d; # short event descriptor
# language code from ISO 639-2 lowercase
$short_descriptor->{language_code} = 'sr';
# define codepage according to Annex.2 of EN 300 468 - Latin 2
$short_descriptor->{codepage_prefix} = "\x10\x00\x02";
$short_descriptor->{event_name} = $rawEvent->{title}{content}; ------line 213 error hash
$short_descriptor->{text} = $rawEvent->{"sub-title"}{content} || "";
push( @descriptors, $short_descriptor);

my $extended_descriptor;
$extended_descriptor->{descriptor_tag} = 0x4e; # extended event descriptor
$extended_descriptor->{language_code} = 'sr';
$extended_descriptor->{codepage_prefix} = "\x10\x00\x02";
$extended_descriptor->{text} = $rawEvent->{desc}{content};
push( @descriptors, $extended_descriptor);

$event->{descriptors} = \@descriptors;

$epg->addEvent( $event);
}

return 1;
}



(This post was edited by Laurent_R on Feb 8, 2016, 4:40 AM)


Edit Log:
Post edited by zaca011 (New User) on Feb 8, 2016, 1:34 AM
Post edited by zaca011 (New User) on Feb 8, 2016, 1:36 AM
Post edited by zaca011 (New User) on Feb 8, 2016, 2:25 AM
Post edited by Laurent_R (Veteran) on Feb 8, 2016, 4:40 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives