xmltv/grab Grab_XML.pm,1.19,1.20

Nick Morrott <[email protected]> Sun, 05 Jul 2015 04:32:24 +0000
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31954/grab

Modified Files:
	Grab_XML.pm 
Log Message:
Remove duplicate programmes (based on start/stop times, title and channel id) in XMLTV::cat and XMLTV::catfiles routines

Index: Grab_XML.pm
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/Grab_XML.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Grab_XML.pm	3 Jul 2015 13:01:10 -0000	1.19
--- Grab_XML.pm	5 Jul 2015 04:32:22 -0000	1.20
***************
*** 335,356 ****
      $bar->finish() if not $opt_quiet;
  
-     # Ensure unique programme elements
-     #
-     # Process list of programmes in reverse order to prefer latest
-     # occurence of a duplicated programme entry. Duplicates are
-     # determined based upon a combination of start time, stop time
-     # and channel.
-     #
-     # Splice logic based on http://stackoverflow.com/a/14191738
-     #
-     my $xmltv_data = XMLTV::cat(@listingses);
-     my @progs = reverse @{$xmltv_data->[3]};
-     my %seen_progs;
-     my @dupe_indexes = reverse(grep { $seen_progs{ $progs[$_]->{start} . "|" . $progs[$_]->{stop} . "|" . $progs[$_]->{channel} }++ } 0..$#progs);
-     foreach my $item (@dupe_indexes) {
- 	splice (@progs,$item,1);
-     }
-     $xmltv_data->[3] = [reverse @progs];
- 
      my %w_args = ();
      if (defined $opt_output) {
--- 335,338 ----
***************
*** 367,371 ****
      }
      else {
! 	XMLTV::write_data($xmltv_data, %w_args);
      }
  }
--- 349,353 ----
      }
      else {
! 	XMLTV::write_data(XMLTV::cat(@listingses), %w_args);
      }
  }


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/