xmltv/grab/eu_epgdata tv_grab_eu_epgdata,1.40,1.41

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

Modified Files:
	tv_grab_eu_epgdata 
Log Message:
Correctly use HTTP::Response interface. Error checking.

Index: tv_grab_eu_epgdata
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/eu_epgdata/tv_grab_eu_epgdata,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** tv_grab_eu_epgdata	8 Feb 2013 19:58:21 -0000	1.40
--- tv_grab_eu_epgdata	9 Oct 2014 18:49:39 -0000	1.41
***************
*** 140,144 ****
  use strict;
  use warnings;
! use LWP::Simple qw($ua getstore);
  use Archive::Zip;
  use File::Temp qw/ tempdir /;
--- 140,144 ----
  use strict;
  use warnings;
! use LWP::Simple qw($ua getstore is_success);
  use Archive::Zip;
  use File::Temp qw/ tempdir /;
***************
*** 282,286 ****
  # do all the work.
  prepareinclude($conf,$opt);
! our @xmlfiles = downloadepg($opt->{days},$opt->{offset},$pin);
  exit 1 unless @xmlfiles;
  processxml(@xmlfiles);
--- 282,286 ----
  # do all the work.
  prepareinclude($conf,$opt);
! our @xmlfiles = downloadepg($opt->{days}, $opt->{offset}, $pin);
  exit 1 unless @xmlfiles;
  processxml(@xmlfiles);
***************
*** 309,316 ****
          warn "url=$url\n" if $opt->{debug};
          my $response = $ua->request(GET $url);
!         if ($response->{'_headers'}{'x-epgdata-packageavailable'} == 1) {
!             my $filename  = sanitize($response->{'_headers'}{'content-disposition'});
!             $expiry_date  = $response->{'_headers'}{'x-epgdata-timeout'};
!             $channelgroup = sanitize($response->{'_headers'}{'x-epgdata-channelgroup'});
              $filename     =~  s/^.*=//;
              ($country)    = ($filename =~ /[^_]*_[^_]*_([^_]*)_[^_]*/) unless $country; # format: xyz########_########_de_qy.zip
--- 309,320 ----
          warn "url=$url\n" if $opt->{debug};
          my $response = $ua->request(GET $url);
!         if (!$response->is_success) {
!             warn "Unable to retrieve data from URL $url: " . $response->message . ' (' . $response->code . ')';
!             return [];
!         }
!         if ($response->header('x-epgdata-packageavailable') eq '1') {
!             my $filename  = sanitize($response->header('content-disposition'));
!             $expiry_date  = $response->header('x-epgdata-timeout');
!             $channelgroup = sanitize($response->header('x-epgdata-channelgroup'));
              $filename     =~  s/^.*=//;
              ($country)    = ($filename =~ /[^_]*_[^_]*_([^_]*)_[^_]*/) unless $country; # format: xyz########_########_de_qy.zip
***************
*** 339,345 ****
      my $includeurl = "http://www.epgdata.com/index.php?action=sendInclude&iOEM=&pin=$pin&dataType=xml";
      warn "Downloading include zip file\n" unless $opt->{quiet};
!     getstore($includeurl, $tmp . 'includezip');
!     my @zipfiles=($tmp . 'includezip');
!     unzip(@zipfiles);
  }
  
--- 343,350 ----
      my $includeurl = "http://www.epgdata.com/index.php?action=sendInclude&iOEM=&pin=$pin&dataType=xml";
      warn "Downloading include zip file\n" unless $opt->{quiet};
!     if (is_success(getstore($includeurl, $tmp . 'includezip'))) {
!         my @zipfiles=($tmp . 'includezip');
!         unzip(@zipfiles);
!     }
  }
  
***************
*** 608,612 ****
      my $pin = $conf->{pin}->[0];
      # make sure we know $channelgroup
!     downloadepg('1','0',$pin);
      prepareinclude($conf, $opt);
      # borrowed from http://www.xmltwig.com/xmltwig/ex_fm1
--- 613,620 ----
      my $pin = $conf->{pin}->[0];
      # make sure we know $channelgroup
!     downloadepg('1', '0', $pin);
!     if (!$channelgroup) {
!         return '';
!     }
      prepareinclude($conf, $opt);
      # borrowed from http://www.xmltwig.com/xmltwig/ex_fm1


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&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.