xmltv/grab/uk_atlas tv_grab_uk_atlas,1.17,1.18

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/uk_atlas
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8169

Modified Files:
	tv_grab_uk_atlas 
Log Message:
(minor) fix an issue with character encodings

Index: tv_grab_uk_atlas
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_atlas/tv_grab_uk_atlas,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** tv_grab_uk_atlas	21 Jan 2014 10:53:56 -0000	1.17
--- tv_grab_uk_atlas	23 Jan 2014 13:12:38 -0000	1.18
***************
*** 329,333 ****
  
  		my( $channel_id, $input, $channelname, $channelicon ) = @_;
! 		my $data = JSON::PP->new()->utf8(0)->decode($input);
  		$input = undef;
  
--- 329,333 ----
  
  		my( $channel_id, $input, $channelname, $channelicon ) = @_;
! 		my $data = JSON::PP->new()->utf8(1)->decode($input);
  		$input = undef;
  
***************
*** 531,537 ****
  		$xmlprog{'stop'} 						= DateTime->from_epoch( epoch => $bcast{'stop'} )->set_time_zone('Europe/London')->strftime("%Y%m%d%H%M%S %z");
  
! 		$xmlprog{'title'} 					= [[ $item{'title'}, 'en' ]];
! 		$xmlprog{'sub-title'} 			= [[ $item{'episodetitle'}, 'en' ]] 						if ($item{'episodetitle'});
! 		$xmlprog{'desc'} 						= [[ $item{'desc'}, 'en' ]] 										if ($item{'desc'});
  		
  		my $showepnum = make_ns_epnum($item{'seriesno'}, $item{'epno'}, $item{'totaleps'});
--- 531,537 ----
  		$xmlprog{'stop'} 						= DateTime->from_epoch( epoch => $bcast{'stop'} )->set_time_zone('Europe/London')->strftime("%Y%m%d%H%M%S %z");
  
! 		$xmlprog{'title'} 					= [[ codify( $item{'title'} ), 'en' ]];
! 		$xmlprog{'sub-title'} 			= [[ codify( $item{'episodetitle'} ), 'en' ]] 	if ($item{'episodetitle'});
! 		$xmlprog{'desc'} 						= [[ codify( $item{'desc'} ), 'en' ]] 					if ($item{'desc'});
  		
  		my $showepnum = make_ns_epnum($item{'seriesno'}, $item{'epno'}, $item{'totaleps'});
***************
*** 551,557 ****
  				foreach my $showperson ( @{$item{$role.'s'}}) {
  					if (ref($showperson) eq 'ARRAY') { 
! 						push @{$xmlprog{'credits'}{$role}}, [ @{$showperson}[0], @{$showperson}[1] ];
  					} else {
! 						push @{$xmlprog{'credits'}{$role}}, $showperson;
  					}
  				}
--- 551,557 ----
  				foreach my $showperson ( @{$item{$role.'s'}}) {
  					if (ref($showperson) eq 'ARRAY') { 
! 						push @{$xmlprog{'credits'}{$role}}, [ codify( @{$showperson}[0] ), codify( @{$showperson}[1] ) ];
  					} else {
! 						push @{$xmlprog{'credits'}{$role}}, codify( $showperson );
  					}
  				}
***************
*** 570,574 ****
  		if (scalar (keys %{$item{'genres'}}) > 0) {		
  			while (my ($key, $value) = each %{$item{'genres'}}) {
! 				push @{$xmlprog{category}}, [ $key, 'en' ];
  			}
  		}
--- 570,574 ----
  		if (scalar (keys %{$item{'genres'}}) > 0) {		
  			while (my ($key, $value) = each %{$item{'genres'}}) {
! 				push @{$xmlprog{category}}, [ codify( $key ), 'en' ];
  			}
  		}
***************
*** 839,847 ****
  					$w->endTag('type');
  					$w->startTag('display-name', 'lang' => 'en' );
! 					$w->characters($platform->{'title'});
  					$w->endTag('display-name');
  					foreach my $country (@{$platform->{'countrieslist'}}) {					
  						$w->startTag('availability', 'area' => 'country' );
! 						$w->characters($country);
  						$w->endTag('availability');
  					}
--- 839,847 ----
  					$w->endTag('type');
  					$w->startTag('display-name', 'lang' => 'en' );
! 					$w->characters( codify( $platform->{'title'} ) );
  					$w->endTag('display-name');
  					foreach my $country (@{$platform->{'countrieslist'}}) {					
  						$w->startTag('availability', 'area' => 'country' );
! 						$w->characters( codify( $country ) );
  						$w->endTag('availability');
  					}
***************
*** 853,860 ****
  						$w->endTag('type');
  						$w->startTag('display-name', 'lang' => 'en' );
! 						$w->characters($platform->{'title'} .' - '. $region->{'title'});
  						$w->endTag('display-name');
  						$w->startTag('availability', 'area' => 'region' );
! 						$w->characters($region->{'title'});
  						$w->endTag('availability');
  					$w->endTag('xmltv-lineup');
--- 853,860 ----
  						$w->endTag('type');
  						$w->startTag('display-name', 'lang' => 'en' );
! 						$w->characters( codify( $platform->{'title'} .' - '. $region->{'title'} ) );
  						$w->endTag('display-name');
  						$w->startTag('availability', 'area' => 'region' );
! 						$w->characters( codify( $region->{'title'} ) );
  						$w->endTag('availability');
  					$w->endTag('xmltv-lineup');
***************
*** 892,896 ****
  				$w->endTag('type');
  				$w->startTag('display-name', 'lang' => 'en' );
! 				$w->characters($conf->{'platform-title'}[0]);
  				$w->endTag('display-name');
  				
--- 892,896 ----
  				$w->endTag('type');
  				$w->startTag('display-name', 'lang' => 'en' );
! 				$w->characters( codify( $conf->{'platform-title'}[0] ) );
  				$w->endTag('display-name');
  				
***************
*** 902,906 ****
  						$w->startTag('station', 'rfc2838' => map_channel_id($channel->{'id'}) );
  							$w->startTag('name', 'lang' => 'en' );
! 							$w->characters($channel->{'title'});
  							$w->endTag('name');
  							$w->emptyTag('logo', 'url' => $channel->{'image'} ) if $channel->{'image'};
--- 902,906 ----
  						$w->startTag('station', 'rfc2838' => map_channel_id($channel->{'id'}) );
  							$w->startTag('name', 'lang' => 'en' );
! 							$w->characters( codify( $channel->{'title'} ) );
  							$w->endTag('name');
  							$w->emptyTag('logo', 'url' => $channel->{'image'} ) if $channel->{'image'};
***************
*** 953,957 ****
  			$channels_conf->{$channel{'num'}} = {
  				'id' => $channel{'id'},
! 				'display-name' => [[ $channel{'title'}, 'en' ]],
  			};
  			$channels_conf->{$channel{'num'}}->{'icon'} = [{'src' => $channel{'image'} }]   if $channel{'image'};
--- 953,957 ----
  			$channels_conf->{$channel{'num'}} = {
  				'id' => $channel{'id'},
! 				'display-name' => [[ codify( $channel{'title'} ), 'en' ]],
  			};
  			$channels_conf->{$channel{'num'}}->{'icon'} = [{'src' => $channel{'image'} }]   if $channel{'image'};
***************
*** 1038,1043 ****
  					
  					# Extract the available channels
! 					#my $data = JSON::PP->new()->utf8(0)->decode($res->content);
! 					my $data = get_nice_json($url,'',1);
  					$res = undef;
  
--- 1038,1042 ----
  					
  					# Extract the available channels
! 					my $data = JSON::PP->new()->utf8(1)->decode($res->content);
  					$res = undef;
  
***************
*** 1101,1105 ****
  				
  				# Extract the available platforms
! 				my $data = JSON::PP->new()->utf8(0)->decode($res->content);
  				$res = undef;
  
--- 1100,1104 ----
  				
  				# Extract the available platforms
! 				my $data = JSON::PP->new()->utf8(1)->decode($res->content);
  				$res = undef;
  
***************
*** 1425,1428 ****
--- 1424,1432 ----
  }
  
+ sub codify ( $ ) {
+ 		# Encode the text as UTF-8
+ 		return encode( 'UTF-8', $_[0] );
+ }
+ 
  sub uc_words {
  	# Uppercase the first letter of each word


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
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.