xmltv/grab/za tv_grab_za,1.44,1.45
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/za
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv26227
Modified Files:
tv_grab_za
Log Message:
(minor) fix badiso8859
Index: tv_grab_za
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/za/tv_grab_za,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** tv_grab_za 11 Dec 2013 17:32:18 -0000 1.44
--- tv_grab_za 1 May 2014 19:26:55 -0000 1.45
***************
*** 84,87 ****
--- 84,88 ----
use IO::File;
use Digest::MD5 qw(md5 md5_hex);
+ use Encode;
use POSIX qw(strftime);
***************
*** 129,132 ****
--- 130,136 ----
my $LANG="en";
+ # character encoding of output file
+ my $ENCODING = 'ISO-8859-1';
+
our %dstvchannelmap;
our %mnetchannelmap;
***************
*** 338,342 ****
$w_args{OUTPUT} = $fh;
}
! $w_args{encoding} = 'ISO-8859-1';
my $writer = new XMLTV::Writer(%w_args);
$writer->start($HEAD);
--- 342,346 ----
$w_args{OUTPUT} = $fh;
}
! $w_args{encoding} = $ENCODING;
my $writer = new XMLTV::Writer(%w_args);
$writer->start($HEAD);
***************
*** 411,423 ****
}
sub tidy( $ ) {
! for (my $tmp = shift) {
! if (not defined $tmp) { return };
! tr/\t\205/ /d;
! s/([^\012\015\040-\176\240-\377]+)//g;
! return $_;
! }
}
# The URI to get listings for a given channel.
sub dstv_channel_uri( $ ) { # DEPRECATED
--- 415,439 ----
}
+ #sub tidy( $ ) {
+ # for (my $tmp = shift) {
+ # if (not defined $tmp) { return };
+ # tr/\t\205/ /d;
+ # s/([^\012\015\040-\176\240-\377]+)//g;
+ # return $_;
+ # }
+ #}
+
+ # Remove bad chars from an element
sub tidy( $ ) {
! my $html = shift;
! return $html if !defined $html;
! $html =~ s/(\s)\xA0/$1/g; # replace 'space- ' with 'space'
! $html =~ s/\xA0/ /g; # replace any remaining with space
! $html =~ s/\xAD//g; # delete soft hyphens
! return $html;
}
+
+
# The URI to get listings for a given channel.
sub dstv_channel_uri( $ ) { # DEPRECATED
***************
*** 497,501 ****
}
! if ($desc =~ /^'([^\.]+)'\.\s+(.+)/) {
$subtitle = $1;
$desc = $2;
--- 513,518 ----
}
! if ($desc =~ /^'([^\.]+)'\.\s+(.+)/) { # don't know why this excludes '.'
! # - means it fails to detect 'S1/E13 - ...A Better Place.'.
$subtitle = $1;
$desc = $2;
***************
*** 539,543 ****
if ($desc =~ /(.*) \((\d{4})\)\s*([^\.]+)\.?\s*$/) {
$year = $2;
! $director = $3;
$desc = $1;
t "desc = $desc\n";
--- 556,560 ----
if ($desc =~ /(.*) \((\d{4})\)\s*([^\.]+)\.?\s*$/) {
$year = $2;
! $director = encode($ENCODING, $3);
$desc = $1;
t "desc = $desc\n";
***************
*** 562,566 ****
$actors = [];
foreach my $a (@a) {
! push @$actors, $a;
}
}
--- 579,583 ----
$actors = [];
foreach my $a (@a) {
! push @$actors, encode($ENCODING, $a);
}
}
***************
*** 574,577 ****
--- 591,599 ----
$desc = "No description available" if ($desc eq "");
+
+ # Encode into output charset
+ $desc = encode($ENCODING, tidy($desc));
+ $title = encode($ENCODING, tidy($title));
+ $subtitle = encode($ENCODING, tidy($subtitle));
$r->{title} = [[$title]];
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs