Commit 2c59a65c authored by Joakim Nylén's avatar Joakim Nylén

Changes

parent 00fc46ce
......@@ -26,7 +26,7 @@ then
# Remove old programmes and batches - dont use, fucks up the previouslyshown
# augmenter
perl -I lib tools/nonametv-remove-old
#perl -I lib tools/nonametv-remove-old
exit
fi
......
......@@ -37,6 +37,9 @@ foreach my $msg ($infolder->messages) {
if( $fromaddr =~ /\@vimn.com/i ) {
MoveMessage( $msg, "MTV" );
}
elsif( $fromaddr =~ /\@vimnmix.com/i ) {
MoveMessage( $msg, "MTV" );
}
elsif( $fromaddr =~ /\@disney.com/i ) {
MoveMessage( $msg, "Disney" );
}
......
#!/usr/bin/perl -w
use strict;
use warnings;
use File::Compare;
use FindBin;
use lib "$FindBin::Bin/../../lib";
use DateTime;
use IO::Compress::Gzip qw(gzip $GzipError);
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
use JSON -support_by_pp;
use JSON::XS;
use NonameTV qw(ParseXml);
# sources
my $channelsxml = '/content/full/honeybee_new/channels.js.gz';
my $xmltvdir = '/content/full/honeybee_new';
# target
my $datalistxml = '/content/full/honeybee_new_datalist.js.gz';
my $xml;
gunzip $channelsxml => \$xml
or die "gunzip failed: $GunzipError\n";
my $json = new JSON->allow_nonref;
my $doc = $json->allow_nonref->utf8->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($xml);
my $channels = $doc->{"jsontv"}->{'channels'};
my $chans = [];
foreach my $channel (@{$channels}) {
my $xmltvid = $channel->{"xmltvid"};
opendir(DIR, $xmltvdir)
or die "could not read from $xmltvdir\n";
my @files = grep(/^$xmltvid.*gz/, readdir(DIR));
closedir(DIR);
@files = sort @files;
my $dates = [];
foreach my $filename (@files) {
my $modified = ( stat( "$xmltvdir/$filename" ) )[9];
my( $date )=( $filename =~ m|^.*_(\d{4}-\d{2}-\d{2})\.js.gz$| );
my $dt = DateTime->from_epoch( epoch => $modified );
my $date2 = {"lastmodified" => $dt->iso8601, "date" => $date};
push @{$dates}, $date2;
}
push @{$chans}, {"days" => $dates, "channel" => $xmltvid};
}
my $xml2 = JSON::XS->new->ascii( 1 )->pretty( 1 )->encode( { jsontv => { channels => $chans } } );
gzip \$xml2 => $datalistxml . '.new', Level => 9, Time => 0
or die "gzip failed: $GzipError\n";
if( compare( $datalistxml, $datalistxml . '.new' )== 0 ){
unlink( $datalistxml . '.new' );
} else {
rename( $datalistxml . '.new', $datalistxml );
}
......@@ -440,7 +440,6 @@ sub guess_channel
# Sony Entertainment TV, Gmbh.
if($filename =~ /\.xml$/i or $filename =~ /\.xls$/i) {
return "axntv.de" if $filename =~ /^AXN-/i;
return "animax.tv" if $filename =~ /^AAX-/i;
return "sonyentertainment.tv" if $filename =~ /^SEN-/i;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment