xmltv/grab/uk_rt tv_grab_uk_rt,1.28,1.29

Nick Morrott <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/uk_rt
In directory vz-cvs-3.sog:/tmp/cvs-serv32327/grab/uk_rt

Modified Files:
	tv_grab_uk_rt 
Log Message:
Remove occurences of 'New : ' in a programme's episode field, as seen in recent listings for Rookie Blue and Warehouse 13

Index: tv_grab_uk_rt
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_rt/tv_grab_uk_rt,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** tv_grab_uk_rt	13 Jun 2012 08:06:58 -0000	1.28
--- tv_grab_uk_rt	19 Sep 2012 03:21:23 -0000	1.29
***************
*** 220,223 ****
--- 220,224 ----
  my %demoted_title;            # key = title, value = title
  my %uc_prog_titles;           # key = title, value = title
+ my %new_title_in_subtitle_fixed; # key = 'title . '|' . episode', value = hashref (keys are title and episode)
  my %title_in_subtitle_fixed;  # key = 'title . '|' . episode', value = hashref (keys are title and episode)
  my %title_ep_in_subtitle_fixed; # key = 'title . '|' . episode', value = hashref (keys are title and episode)
***************
*** 305,308 ****
--- 306,310 ----
      print_flagged_title_eps();
      print_dotdotdot_titles();
+     print_new_title_in_subtitle();
      print_title_in_subtitle();
      print_categories();
***************
*** 1136,1139 ****
--- 1138,1143 ----
                      . $prog{'_title'} . " / " . $ep_in . "'");
  
+             # Remove "New $title" if seen in episode field
+             remove_duplicated_new_title_in_ep(\%prog);
              # Remove a duplicated programme title/ep if seen in episode field
              remove_duplicated_title_and_ep_in_ep(\%prog);
***************
*** 2228,2231 ****
--- 2232,2261 ----
  }
  
+ # Remove "New $title" from episode field
+ #
+ # Listings for programmes may be provided that contain
+ # "New $title" duplicated at the start of the episode field
+ #
+ sub remove_duplicated_new_title_in_ep {
+     my $prog = shift;
+ 
+     if (defined $prog->{'_episode'}) {
+         my $tmp_title = $prog->{'_title'};
+         my $tmp_episode = $prog->{'_episode'};
+         my $key = $tmp_title . "|" . $tmp_episode;
+ 
+         # Remove the "New $title" text from episode field if we find it
+         if ($tmp_episode =~ m/^New \Q$tmp_title\E(?::\s|\s-\s)(.+)$/) {
+             $prog->{'_episode'} = $1;
+             t("      Removing 'New \$title' text from beginning of episode field");
+             if ($opt->{debug}) {
+                 $new_title_in_subtitle_fixed{$key} = { 'title'    => $tmp_title,
+                                                        'episode'  => $tmp_episode,
+                                                      };
+             }
+         }
+     }
+ }
+ 
  # Remove duplicated programme title *and* episode from episode field
  #
***************
*** 5074,5077 ****
--- 5104,5117 ----
  }
  
+ sub print_new_title_in_subtitle {
+     if (%new_title_in_subtitle_fixed && scalar keys %new_title_in_subtitle_fixed > 0) {
+         say("\nStart of list of programmes where 'New \$title' was removed from sub-title field");
+         foreach my $prog_ref (sort keys %new_title_in_subtitle_fixed) {
+             say("  $new_title_in_subtitle_fixed{$prog_ref}->{'title'} / $new_title_in_subtitle_fixed{$prog_ref}->{'episode'}");
+         }
+         say("\nEnd of list of programmes where 'New \$title' was removed from sub-title field");
+     }
+ }
+ 
  sub print_title_in_subtitle {
      if (%title_ep_in_subtitle_fixed && scalar keys %title_ep_in_subtitle_fixed > 0) {


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
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.