xmltv/grab/sd_json tv_grab_sd_json,1.21,1.22
Kevin Groeneveld <[email protected]> Fri, 06 Jan 2017 01:16:52 +0000
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/sd_json
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19704/grab/sd_json
Modified Files:
tv_grab_sd_json
Log Message:
tv_grab_sd_json: Sort output data.
Not only was the data not sorted the ordering was somewhat random do to
the way perl handles hashes. This makes it difficult to even compare the
output results from two back to back runs of the grabber. And having the
output sorted is just generally nicer.
Index: tv_grab_sd_json
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/sd_json/tv_grab_sd_json,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** tv_grab_sd_json 15 Jul 2016 01:26:44 -0000 1.21
--- tv_grab_sd_json 6 Jan 2017 01:16:50 -0000 1.22
***************
*** 60,64 ****
use Digest::SHA qw(sha1_hex);
use DateTime;
- use List::MoreUtils qw(uniq);
use Scalar::Util qw(looks_like_number);
use Try::Tiny;
--- 60,63 ----
***************
*** 967,973 ****
sub get_channel_list {
my ($conf) = @_;
if($conf->{'mode'}->[0] eq 'lineup') {
- my %hash;
for my $lineup (@{$conf->{'lineup'}}) {
if(ref $cache_lineups->{$lineup}->{'stations'} ne 'ARRAY') {
--- 966,972 ----
sub get_channel_list {
my ($conf) = @_;
+ my %hash;
if($conf->{'mode'}->[0] eq 'lineup') {
for my $lineup (@{$conf->{'lineup'}}) {
if(ref $cache_lineups->{$lineup}->{'stations'} ne 'ARRAY') {
***************
*** 984,997 ****
}
}
-
- my @list = keys %hash;
- return \@list;
}
else {
! my @list;
!
! for my $channel (uniq(@{$conf->{'channel'}})) {
if(exists $channel_index{$channel}) {
! push(@list, $channel);
}
else {
--- 983,991 ----
}
}
}
else {
! for my $channel (@{$conf->{'channel'}}) {
if(exists $channel_index{$channel}) {
! $hash{$channel} = 1;
}
else {
***************
*** 999,1005 ****
}
}
-
- return \@list;
}
}
--- 993,1000 ----
}
}
}
+
+ my @list = sort(keys %hash);
+ return \@list;
}
***************
*** 1505,1510 ****
# write programs
for my $channel (@{$channels}) {
! for my $schedule (values %{$cache_schedules->{$channel}}) {
! for my $program (@{$schedule->{'programs'}}) {
write_programme($w, $channel_index{$channel}, $program, $cache_programs->{$program->{'programID'}});
}
--- 1500,1506 ----
# write programs
for my $channel (@{$channels}) {
! my $schedules = $cache_schedules->{$channel};
! for my $day (sort(keys %{$schedules})) {
! for my $program (@{$schedules->{$day}->{'programs'}}) {
write_programme($w, $channel_index{$channel}, $program, $cache_programs->{$program->{'programID'}});
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot