xmltv/grab/pt tv_grab_pt,1.56,1.57

Geoff <[email protected]> Mon, 10 Aug 2015 10:41:02 +0000
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/pt
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8199

Modified Files:
	tv_grab_pt 
Log Message:
Fix broken details page (programme descriptions) after source site changes

Index: tv_grab_pt
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/pt/tv_grab_pt,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** tv_grab_pt	13 Apr 2015 16:10:48 -0000	1.56
--- tv_grab_pt	10 Aug 2015 10:41:00 -0000	1.57
***************
*** 99,103 ****
  use XMLTV::Config_file;
  use XMLTV::DST;
! use XMLTV::Get_nice;
  use XMLTV::Mode;
  # Todo: perhaps we should internationalize messages and docs?
--- 99,103 ----
  use XMLTV::Config_file;
  use XMLTV::DST;
! use XMLTV::Get_nice 0.005067;
  use XMLTV::Mode;
  # Todo: perhaps we should internationalize messages and docs?
***************
*** 584,607 ****
      my ($ch_xmltv_id, $prog, $s_tree) = @_;
  
- 
      t "Getting prog details $$prog{'id'} \n";
  
-     # I don't know how much of this url is actually required, but let's try to follow it as far as poss (for stealth reasons)
-     #
-     # http://www.zon.pt/_layouts/EPGGetProgramDetails.aspx?c=SIC&p=79302&h=0&sh=03:45%20&eh=%2006:00
-     #
-     # jQuery code:
-     # channelAcronym1 = $("#channel-logo img").attr('alt');
-     # programId1 = $(this).attr('id');
-     #
-     # var hasDifferentTime = "";
-     # if (programId1 == "-2") {
-     #    hasDifferentTime = ($(this).find('.duration')).text();
-     # }
-     #
-     # var substr = ($(this).find('.duration')).text().split('-');
-     #
-     # $.get('/_layouts/EPGGetProgramDetails.aspx?c=' + channelAcronym1 + '&p=' + programId1+ '&h=' + $("#ctl00_PlaceHolderMain_channelProgr_HoursToAddOrRemove").val() + "&sh=" + substr[0] + "&eh=" + substr[1], function (data) {...});
-     #
      my $channelAcronym1;
      if ( my $h = $s_tree->look_down('_tag' => 'div', 'id' => 'channel-logo') ) {
--- 584,589 ----
***************
*** 618,625 ****
      my @substr = split(/-/, $$prog{'timespan'});
  
!     my $url = $HEAD->{'source-info-url'} . '_layouts/EPGGetProgramDetails.aspx?c='.$channelAcronym1.'&p='.$programId1.'&h='.$HoursToAddOrRemove.'&sh='.$substr[0].'&eh='.$substr[1];
      print STDERR " URL= $url \n" if $opt_debug;
      t $url;
  
  
      # This is what the page returns. Looks like an old school delimited list
--- 600,609 ----
      my @substr = split(/-/, $$prog{'timespan'});
  
!     my $url = $HEAD->{'source-info-url'} . '_layouts/15/Armstrong/ApplicationPages/EPGGetProgramsAndDetails.aspx/GetProgramDetails';
      print STDERR " URL= $url \n" if $opt_debug;
      t $url;
  
+     my $json = "{ 'programId':'$programId1', 'channelAcronym':'$channelAcronym1', 'hour':'$HoursToAddOrRemove', 'startHour':'$substr[0]', 'endHour':'$substr[1]' }";
+ 
  
      # This is what the page returns. Looks like an old school delimited list
***************
*** 629,636 ****
      #
  
!     my $content = get_nice($url);
!     $content = decode('UTF-8', $content);
! 
!     my @data = split(/_#\|\$_/, $content);
  
      # We could check the title matches what we already have but why not just trust the 'id' is correct ;-)
--- 613,619 ----
      #
  
!     # Emulate an AJAX post for the requested content
!     my $content = post_nice_json($url, $json);
!     my @data = split(/_#\|\$_/, $content->{'d'});
  
      # We could check the title matches what we already have but why not just trust the 'id' is correct ;-)


------------------------------------------------------------------------------