xmltv/grab/zz_sdjson_sqlite tv_grab_zz_sdjson_sqlite, 1.1, 1.2

Gary Buhrmaster <[email protected]> Sun, 28 Aug 2016 23:48:21 +0000
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
--===============8903140633370989651==

Update of /cvsroot/xmltv/xmltv/grab/zz_sdjson_sqlite
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32006

Modified Files:
	tv_grab_zz_sdjson_sqlite 
Log Message:
Update to current master


Index: tv_grab_zz_sdjson_sqlite
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/zz_sdjson_sqlite/tv_grab_zz_sdjson_sqlite,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tv_grab_zz_sdjson_sqlite	29 Jul 2016 06:36:24 -0000	1.1
--- tv_grab_zz_sdjson_sqlite	28 Aug 2016 23:48:19 -0000	1.2
***************
*** 22,26 ****
  #
  # For extended help information run
! #     tv_grab_zz_sdjson_sqlite  --info
  #
  #
--- 22,26 ----
  #
  # For extended help information run
! #     tv_grab_zz_sdjson_sqlite --info
  #
  #
***************
*** 45,48 ****
--- 45,63 ----
  # Version history:
  #
+ # 2016/08/25 - 1.22 - no warning messages for malformed SD data if quiet
+ # 2016/08/25 - 1.21 - additional error checking of SD data
+ # 2016/08/24 - 1.20 - correct sql error reporting
+ # 2016/08/03 - 1.19 - reflect multinational capability (and fix docs)
+ # 2016/08/03 - 1.18 - rename grabber based on xmltv agreed convention
+ # 2016/07/30 - 1.17 - don't report radio stations as tvshow category
+ # 2016/07/30 - 1.16 - eliminate XML:Writer validation for performance
+ # 2016/07/17 - 1.15 - use Digest::SHA rather than Digest::SHA1
+ # 2016/06/07 - 1.14 - support multipart episodes
+ # 2016/06/07 - 1.13 - improved season/episode value checks
+ # 2016/05/28 - 1.12 - add support for episodeImage
+ # 2016/05/26 - 1.11 - use program duration as length
+ # 2016/05/26 - 1.10 - hack for tv_find_grabbers source parsing of desc
+ # 2016/05/25 - 1.9 - Support total seasons, and more robust validation
+ # 2016/05/24 - 1.8 - retry limit updates and get-lineup improvements
  # 2016/05/21 - 1.7 - protect against bad json returned by server
  # 2016/05/21 - 1.6 - correct (mis)use of global variable in package
***************
*** 77,81 ****
  use Encode qw/decode encode/;
  use JSON;
! use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
  use File::Basename;
  use File::Which;
--- 92,96 ----
  use Encode qw/decode encode/;
  use JSON;
! use Digest::SHA qw(sha1 sha1_hex sha1_base64);
  use File::Basename;
  use File::Which;
***************
*** 88,91 ****
--- 103,107 ----
  use POSIX qw(strftime);
  use List::MoreUtils qw(natatime);
+ use List::Util qw/min max/;
  use DBI;
  use DBI qw(:sql_types);
***************
*** 98,103 ****
  
  my $SCRIPT_VERSION             = '$Id$';
! my $SCRIPT_DESC                = 'North America Schedules Direct XMLTV grabber';
! my $SCRIPT_URL                 = 'https://github.com/garybuhrmaster/tv_grab_na_sd';
  my $SCRIPT_NAME                = basename("$0");
  my $SCRIPT_NAME_DIR            = dirname("$0");
--- 114,118 ----
  
  my $SCRIPT_VERSION             = '$Id$';
! my $SCRIPT_URL                 = 'https://github.com/garybuhrmaster/tv_grab_zz_sdjson_sqlite';
  my $SCRIPT_NAME                = basename("$0");
  my $SCRIPT_NAME_DIR            = dirname("$0");
***************
*** 147,151 ****
        preferredmethod => 'allatonce',
        version => "$SCRIPT_VERSION",
!       description => "$SCRIPT_DESC",
        extra_options => [qw/manage-lineups force-download download-only no-download passwordhash=s/],
        defaults => { days => 30 },
--- 162,166 ----
        preferredmethod => 'allatonce',
        version => "$SCRIPT_VERSION",
!       description => 'Multinational (Schedules Direct JSON web services with SQLite DB)',
        extra_options => [qw/manage-lineups force-download download-only no-download passwordhash=s/],
        defaults => { days => 30 },
***************
*** 489,493 ****
  # feed to our DB
  #
! for (my $retry = 0; $retry < 4; $retry++)
    {
  
--- 504,508 ----
  # feed to our DB
  #
! for (my $retry = 0; $retry < 7; $retry++)
    {
  
***************
*** 554,558 ****
      print (STDERR "   downloading " . scalar(@{$stationsSchedulesList}) . " new, updated, or missing daily schedules" . (($retry == 0) ? "" : " (retry $retry)") . "\n") if (!$quiet);
  
!     sleep(10 * $retry);
  
      $sql1 = "delete from schedules where station = ? and day = ?";
--- 569,573 ----
      print (STDERR "   downloading " . scalar(@{$stationsSchedulesList}) . " new, updated, or missing daily schedules" . (($retry == 0) ? "" : " (retry $retry)") . "\n") if (!$quiet);
  
!     sleep(min(30, (10 * $retry)));
  
      $sql1 = "delete from schedules where station = ? and day = ?";
***************
*** 561,565 ****
  
      $sth1 = $DBH->prepare_cached($sql1);
!     if (!defined($sth))
        {
          print (STDERR "Unexpected error when preparing statement ($sql1): " . $DBH->errstr . "\n");
--- 576,580 ----
  
      $sth1 = $DBH->prepare_cached($sql1);
!     if (!defined($sth1))
        {
          print (STDERR "Unexpected error when preparing statement ($sql1): " . $DBH->errstr . "\n");
***************
*** 567,571 ****
        }
      $sth2 = $DBH->prepare_cached($sql2);
!     if (!defined($sth))
        {
          print (STDERR "Unexpected error when preparing statement ($sql2): " . $DBH->errstr . "\n");
--- 582,586 ----
        }
      $sth2 = $DBH->prepare_cached($sql2);
!     if (!defined($sth2))
        {
          print (STDERR "Unexpected error when preparing statement ($sql2): " . $DBH->errstr . "\n");
***************
*** 573,579 ****
        }
      $sth3 = $DBH->prepare_cached($sql3);
!     if (!defined($sth))
        {
!         print (STDERR "Unexpected error when preparing statement ($sql2): " . $DBH->errstr . "\n");
          exit(1);
        }
--- 588,594 ----
        }
      $sth3 = $DBH->prepare_cached($sql3);
!     if (!defined($sth3))
        {
!         print (STDERR "Unexpected error when preparing statement ($sql3): " . $DBH->errstr . "\n");
          exit(1);
        }
***************
*** 652,656 ****
              if ($sth1->err)
                {
!                 print (STDERR "Unexpected error when executing statement ($sql): " . $sth1->errstr . "\n");
                   exit(1);
                }
--- 667,671 ----
              if ($sth1->err)
                {
!                 print (STDERR "Unexpected error when executing statement ($sql1): " . $sth1->errstr . "\n");
                   exit(1);
                }
***************
*** 658,665 ****
                {
                  my $pID = $program->{'programID'};
!                 my $starttime = DateTime::Format::ISO8601->parse_datetime($program->{'airDateTime'});
                  my $duration = $program->{'duration'};
                  my $phash = $program->{'md5'};
                  my $details = $JSON->utf8->encode($program);
                  $sth2->bind_param( 1, $sID, SQL_VARCHAR );
                  $sth2->bind_param( 2, DateTime::Format::SQLite->format_date($dayDateTime), SQL_DATE );
--- 673,686 ----
                {
                  my $pID = $program->{'programID'};
!                 my $airDateTime = $program->{'airDateTime'};
                  my $duration = $program->{'duration'};
                  my $phash = $program->{'md5'};
                  my $details = $JSON->utf8->encode($program);
+                 if ((!defined($duration)) || (!defined($phash)) || (!defined($pID)) || (!defined($airDateTime)))
+                   {
+                     print (STDERR "Unexpected parsing error in program (data malformed) in schedule for $sID on " . $meta->{'startDate'} . ", skipping\n") if (!$quiet);
+                     next;
+                   }
+                 my $starttime = DateTime::Format::ISO8601->parse_datetime($airDateTime);
                  $sth2->bind_param( 1, $sID, SQL_VARCHAR );
                  $sth2->bind_param( 2, DateTime::Format::SQLite->format_date($dayDateTime), SQL_DATE );
***************
*** 672,676 ****
                  if ($sth2->err)
                    {
!                     print (STDERR "Unexpected error when executing statement ($sql): " . $sth2->errstr . "\n");
                      exit(1);
                    }
--- 693,697 ----
                  if ($sth2->err)
                    {
!                     print (STDERR "Unexpected error when executing statement ($sql2): " . $sth2->errstr . "\n");
                      exit(1);
                    }
***************
*** 682,686 ****
              if ($sth3->err)
                {
!                 print (STDERR "Unexpected error when executing statement ($sql): " . $sth3->errstr . "\n");
                   exit(1);
                }
--- 703,707 ----
              if ($sth3->err)
                {
!                 print (STDERR "Unexpected error when executing statement ($sql3): " . $sth3->errstr . "\n");
                   exit(1);
                }
***************
*** 700,704 ****
  #
  
! for (my $retry = 0; $retry < 4; $retry++)
    {
  
--- 721,725 ----
  #
  
! for (my $retry = 0; $retry < 7; $retry++)
    {
  
***************
*** 763,767 ****
      print (STDERR "   downloading " . scalar(@{$programsList}) . " new, updated, or missing programs" . (($retry == 0) ? "" : " (retry $retry)") . "\n") if (!$quiet);
  
!     sleep(10 * $retry);
  
      $sql1 = "replace into programs (program, hash, details) values (?, ?, ?)";
--- 784,788 ----
      print (STDERR "   downloading " . scalar(@{$programsList}) . " new, updated, or missing programs" . (($retry == 0) ? "" : " (retry $retry)") . "\n") if (!$quiet);
  
!     sleep(min(30, (10 * $retry)));
  
      $sql1 = "replace into programs (program, hash, details) values (?, ?, ?)";
***************
*** 832,836 ****
              if ($sth1->err)
                {
!                 print (STDERR "Unexpected error when executing statement ($sql): " . $sth1->errstr . "\n");
                  exit(1);
                }
--- 853,857 ----
              if ($sth1->err)
                {
!                 print (STDERR "Unexpected error when executing statement ($sql1): " . $sth1->errstr . "\n");
                  exit(1);
                }
***************
*** 991,995 ****
  my $w = XML::Writer->new( 'ENCODING' => 'UTF-8',
                            'DATA_MODE' => 1,
!                           'DATA_INDENT' => 1 );
  
  $w->xmlDecl('UTF-8');
--- 1012,1017 ----
  my $w = XML::Writer->new( 'ENCODING' => 'UTF-8',
                            'DATA_MODE' => 1,
!                           'DATA_INDENT' => 1,
!                           'UNSAFE' => (!$debug) );
  
  $w->xmlDecl('UTF-8');
***************
*** 1016,1020 ****
    # it is a necessary compromise
    #
!   $sql = "select schedules.station, schedules.starttime, schedules.duration, schedules.program, schedules.details, programs.details, strftime('%Y%m%d%H%M%S', schedules.starttime), strftime('%Y%m%d%H%M%S', datetime(schedules.starttime, '+' || schedules.duration || ' seconds')) from schedules as schedules left join programs as programs on programs.program = schedules.program where schedules.station in (select distinct stations.station from stations as stations where stations.station in ( select distinct channels.station from channels as channels where channels.lineup = ? and channels.selected = 1)) AND schedules.day >= ? and schedules.day < ? order by schedules.station, schedules.starttime";
  
    $sth = $DBH->prepare_cached($sql);
--- 1038,1042 ----
    # it is a necessary compromise
    #
!   $sql = "select schedules.station, schedules.starttime, schedules.duration, schedules.program, schedules.details, programs.details, strftime('%Y%m%d%H%M%S', schedules.starttime), strftime('%Y%m%d%H%M%S', datetime(schedules.starttime, '+' || schedules.duration || ' seconds')), stations.details from schedules as schedules left join programs as programs on programs.program = schedules.program left join stations as stations on stations.station = schedules.station where schedules.station in (select distinct stations.station from stations as stations where stations.station in ( select distinct channels.station from channels as channels where channels.lineup = ? and channels.selected = 1)) AND schedules.day >= ? and schedules.day < ? order by schedules.station, schedules.starttime";
  
    $sth = $DBH->prepare_cached($sql);
***************
*** 1051,1054 ****
--- 1073,1077 ----
    $sth->bind_col(7, undef, SQL_VARCHAR );
    $sth->bind_col(8, undef, SQL_VARCHAR );
+   $sth->bind_col(9, undef, SQL_VARCHAR );
  
    my $programsWritten = 0;
***************
*** 1068,1071 ****
--- 1091,1099 ----
            $programDetails = $JSON->decode($r->[5]);
          }
+       my $stationDetails;
+       if (defined($r->[8]))
+         {
+           $stationDetails = $JSON->decode($r->[8]);
+         }
  
        $w->startTag('programme', 'channel' => generateRFC2838($sID),
***************
*** 1201,1205 ****
              # For MythTV, we need to specify the first category
              # in the xmltv file as one of movie, series, sports,
!             # or tvshow.  We can derive that from the entityType
              if (defined($programDetails->{'entityType'}))
                {
--- 1229,1239 ----
              # For MythTV, we need to specify the first category
              # in the xmltv file as one of movie, series, sports,
!             # or tvshow.  We can derive that from the entityType.
!             # If the station is a radio station, do not add tvshow
!             my $radioStation = 0;
!             if (defined($stationDetails->{'isRadioStation'}))
!               {
!                 $radioStation = $stationDetails->{'isRadioStation'};
!               }
              if (defined($programDetails->{'entityType'}))
                {
***************
*** 1217,1228 ****
                      $w->dataElement('category', 'series');
                    }
!                 else   # Should be Show, but if anything else, show
                    {
!                     $w->dataElement('category', 'tvshow');
                    }
                }
              else   # entityType is supposed to be manditory, but....
!               { 
!                 $w->dataElement('category', 'tvshow');
                }
            }
--- 1251,1268 ----
                      $w->dataElement('category', 'series');
                    }
!                 else   # Should be Show
                    {
!                     if (!$radioStation)
!                       {
!                         $w->dataElement('category', 'tvshow');
!                       }
                    }
                }
              else   # entityType is supposed to be manditory, but....
!               {
!                 if (!$radioStation)
!                   {
!                     $w->dataElement('category', 'tvshow');
!                   }
                }
            }
***************
*** 1268,1274 ****
            }
  
!         if (defined($programDetails->{'movie'}->{'duration'}))
            {
!             $w->dataElement('length', $programDetails->{'movie'}->{'duration'}, 'units' => 'seconds');
            }
  
--- 1308,1331 ----
            }
  
!         if (defined($programDetails->{'duration'}))
            {
!             $w->dataElement('length', $programDetails->{'duration'}, 'units' => 'seconds');
!           }
! 
!         if (defined($programDetails->{'episodeImage'}) &&
!             defined($programDetails->{'episodeImage'}->{'uri'}))
!           {
!             my $url = $SD->uriResolve($programDetails->{'episodeImage'}->{'uri'}, '/image');
!             if (defined($programDetails->{'episodeImage'}->{'width'}) &&
!                 defined($programDetails->{'episodeImage'}->{'height'}))
!               {
!                 $w->emptyTag('icon', 'src' => $url,
!                                   'width' => $programDetails->{'episodeImage'}->{'width'},
!                                   'height' => $programDetails->{'episodeImage'}->{'height'});
!               }
!             else
!               {
!                 $w->emptyTag('icon', 'src' => $url);
!               }
            }
  
***************
*** 1285,1288 ****
--- 1342,1348 ----
            }
  
+         my $season = '';
+         my $episode = '';
+         my $part = '';
          if (defined($programDetails->{'metadata'}))
            {
***************
*** 1292,1306 ****
                  if (defined($meta->{'Gracenote'}))
                    {
!                     my $season = $meta->{'Gracenote'}->{'season'};
!                     my $episode = $meta->{'Gracenote'}->{'episode'} || '';
!                     my $total = $meta->{'Gracenote'}->{'totalEpisodes'} || '';
!                     next if (!looks_like_number($season));
                      $season = $season - 1;
!                     $episode = $episode - 1 if looks_like_number($episode);
!                     $episode = "$episode / $total" if ($total ne '');
!                     $w->dataElement('episode-num', " $season . $episode . ", 'system' => 'xmltv_ns');
                    }
                }
            }
  
          if (defined($scheduleDetails->{'videoProperties'}))
--- 1352,1388 ----
                  if (defined($meta->{'Gracenote'}))
                    {
!                     $season = $meta->{'Gracenote'}->{'season'};
!                     my $totalSeasons = $meta->{'Gracenote'}->{'totalSeasons'};
!                     $episode = $meta->{'Gracenote'}->{'episode'};
!                     my $totalEpisodes = $meta->{'Gracenote'}->{'totalEpisodes'};
!                     next if (!defined($season));
!                     $season = '0' if (!looks_like_number($season));
!                     $totalSeasons = '' if (!looks_like_number($totalSeasons));
!                     $episode = '0' if (!looks_like_number($episode));
!                     $totalEpisodes = '' if (!looks_like_number($totalEpisodes));
                      $season = $season - 1;
!                     $season = '' if ($season < 0);
!                     $season = "$season / $totalSeasons" if ($totalSeasons ne '');
!                     $episode = $episode - 1;
!                     $episode = '' if ($episode < 0);
!                     $episode = "$episode / $totalEpisodes" if ($totalEpisodes ne '');
!                     last;
                    }
                }
            }
+         if (defined($scheduleDetails->{'multipart'}))
+           {
+             $part = $scheduleDetails->{'multipart'}->{'partNumber'};
+             my $totalParts = $scheduleDetails->{'multipart'}->{'totalParts'};
+             $part = 0 if (!looks_like_number($part));
+             $part = $part - 1;
+             $part = '' if ($part < 0);
+             $totalParts = '' if (!looks_like_number($totalParts));
+             $part = "$part / $totalParts" if ($totalParts ne '');
+           }
+         if (($season ne '') || ($episode ne '') || ($part ne ''))
+           {
+             $w->dataElement('episode-num', " $season . $episode . $part ", 'system' => 'xmltv_ns');
+           }
  
          if (defined($scheduleDetails->{'videoProperties'}))
***************
*** 2280,2288 ****
                      }
  
!                   if ($SDtype eq 'DVB-T')
                      {
                        $w->startTag('dvb-channel');
!                         my $networkID = $c->{'networkID'} || 0;
!                         if (looks_like_number($networkID))
                            {
                              $networkID = 0 + $networkID;
--- 2362,2376 ----
                      }
  
!                   if (($SDtype eq 'DVB-T') || ($SDtype eq 'DVB-S') | ($SDtype eq 'DVB-C'))
                      {
                        $w->startTag('dvb-channel');
!                         my $freq = $c->{'frequencyHz'};
!                         if (defined($freq) && looks_like_number($freq))
!                           {
!                             $freq = 0 + $freq;
!                             $w->dataElement('frequency', $freq);
!                           }
!                         my $networkID = $c->{'networkID'};
!                         if (defined($networkID) && looks_like_number($networkID))
                            {
                              $networkID = 0 + $networkID;
***************
*** 2295,2321 ****
                              $w->dataElement('transport-id', $transportID);
                            }
!                         my $serviceID = $c->{'serviceID'} || 0;
!                         if (looks_like_number($serviceID))
                            {
                              $serviceID = 0 + $serviceID;
                              $w->dataElement('service-id', $serviceID);
                            }
!                         if (defined($c->{'channel'}) && looks_like_number($c->{'channel'}))
                            {
!                             my $preset = $c->{'channel'};
!                             $preset = 0 + $preset;
!                             $w->dataElement('lcn', $preset);
                            }
                        $w->endTag('dvb-channel');
                      }
  
-                   if ($SDtype eq 'DVB-S')
-                     {
-                     }
- 
-                   if ($SDtype eq 'DVB-C')
-                     {
-                     }
- 
                $w->endTag('lineup-entry');
              }
--- 2383,2401 ----
                              $w->dataElement('transport-id', $transportID);
                            }
!                         my $serviceID = $c->{'serviceID'};
!                         if (defined($serviceID) && looks_like_number($serviceID))
                            {
                              $serviceID = 0 + $serviceID;
                              $w->dataElement('service-id', $serviceID);
                            }
!                         my $lcn = $c->{'channel'};
!                         if (defined($lcn) && looks_like_number($lcn))
                            {
!                             $lcn = 0 + $lcn;
!                             $w->dataElement('lcn', $lcn);
                            }
                        $w->endTag('dvb-channel');
                      }
  
                $w->endTag('lineup-entry');
              }
***************
*** 2614,2618 ****
      $sql1 = "update lineups set name = ?, location = ?, transport = ?, details = ? where lineup = ?";
      $sth1 = $DBH->prepare_cached($sql1);
!     if (!defined($sth))
        {
          print (STDERR "Unexpected error when preparing statement ($sql1): " . $DBH->errstr . "\n");
--- 2694,2698 ----
      $sql1 = "update lineups set name = ?, location = ?, transport = ?, details = ? where lineup = ?";
      $sth1 = $DBH->prepare_cached($sql1);
!     if (!defined($sth1))
        {
          print (STDERR "Unexpected error when preparing statement ($sql1): " . $DBH->errstr . "\n");
***************
*** 2647,2651 ****
          if ($sth1->err)
            {
!             print (STDERR "Unexpected error when executing statement ($sql): " . $sth1->errstr . "\n");
              exit(1);
            }
--- 2727,2731 ----
          if ($sth1->err)
            {
!             print (STDERR "Unexpected error when executing statement ($sql1): " . $sth1->errstr . "\n");
              exit(1);
            }
***************
*** 4321,4325 ****
      my $transportTypeMap =                 # Map for Schedules Direct transport to XMLTV type
        {
!         'DVB-C'          => 'STB',         # DVB-C (most use a STB?)
          'DVB-T'          => 'DTV',         # DVB-T
          'DVB-S'          => 'DTV',         # DVB-S (should be STB?)
--- 4401,4405 ----
      my $transportTypeMap =                 # Map for Schedules Direct transport to XMLTV type
        {
!         'DVB-C'          => 'DTV',         # DVB-C
          'DVB-T'          => 'DTV',         # DVB-T
          'DVB-S'          => 'DTV',         # DVB-S (should be STB?)
***************
*** 4374,4392 ****
          'Saskatchewan Film and Video Classification Board'                                 => 'SFVCB',
          'Medietilsynet'                                                                    => 'NMA',
!         'Departamento de Justiça, Classificação, Títulos e Qualificação'                   => 'ClassInd',
          'Alberta\'s Film Classification Board'                                             => 'AFR',
!         'The Régie du cinéma'                                                              => 'RCQ',
          'Ontario Film Review Board'                                                        => 'OFRB',
          'Maritime Film Classification Board'                                               => 'MFC',
          'Canadian Parental Rating'                                                         => 'CHVRS',
!         'Conseil Supérieur de l\'Audiovisuel'                                              => 'CSA',
!         'Dirección General de Radio, Televisión y Cinematografía'                          => 'RTC',
!         'Instituto de Cinematografía y de las Artes Visuales'                              => 'ICAA',
!         'Mediakasvatus- ja kuvaohjelmayksikkö'                                             => 'MEKU',
          'UK Content Provider'                                                              => 'UK',
!         'Centre national du cinéma et de l\'image animée'                                  => 'CNC',
          'Irish Film Classification Office'                                                 => 'IFCO',    # Guess
!         'Statens filmgranskningsbyrå'                                                      => 'VET',     # Guess
!         'Nemzeti Média- és Hirközlési Hatóság'                                             => 'NMHH',    # Guess
          'Nederlands Instituut voor de Classificatie van Audiovisuele Media'                => 'NICAM',   # Guess
          'Office of Film and Literature Classification'                                     => 'OFLC',    # Guess
--- 4454,4472 ----
          'Saskatchewan Film and Video Classification Board'                                 => 'SFVCB',
          'Medietilsynet'                                                                    => 'NMA',
!         'Departamento de Justiça, Classificação, Títulos e Qualificação'                   => 'ClassInd',
          'Alberta\'s Film Classification Board'                                             => 'AFR',
!         'The Régie du cinéma'                                                              => 'RCQ',
          'Ontario Film Review Board'                                                        => 'OFRB',
          'Maritime Film Classification Board'                                               => 'MFC',
          'Canadian Parental Rating'                                                         => 'CHVRS',
!         'Conseil Supérieur de l\'Audiovisuel'                                              => 'CSA',
!         'Dirección General de Radio, Televisión y Cinematografía'                          => 'RTC',
!         'Instituto de Cinematografía y de las Artes Visuales'                              => 'ICAA',
!         'Mediakasvatus- ja kuvaohjelmayksikkö'                                             => 'MEKU',
          'UK Content Provider'                                                              => 'UK',
!         'Centre national du cinéma et de l\'image animée'                                  => 'CNC',
          'Irish Film Classification Office'                                                 => 'IFCO',    # Guess
!         'Statens filmgranskningsbyrå'                                                      => 'VET',     # Guess
!         'Nemzeti Média- és Hirközlési Hatóság'                                             => 'NMHH',    # Guess
          'Nederlands Instituut voor de Classificatie van Audiovisuele Media'                => 'NICAM',   # Guess
          'Office of Film and Literature Classification'                                     => 'OFLC',    # Guess
***************
*** 4546,4552 ****
  
  Output TV listings in XMLTV format for many locations available in
! North America (US/CA).  The data come from
! L<http://www.schedulesdirect.org> and an account must be created
! on the Schedules Direct site in order to grab data.
  
  This grabber uses a shared local database which allows for
--- 4626,4634 ----
  
  Output TV listings in XMLTV format for many locations available in
! North America (US/CA) and other selected countries internationally.
! The data comes from L<http://www.schedulesdirect.org> and an account
! must be created on the Schedules Direct site in order to grab data.
! Refer to the Schedules Direct site for signup requirements and
! supported locations.
  
  This grabber uses a shared local database which allows for
***************
*** 4557,4565 ****
  sources in the same location).
  
! First, you must run B<tv_grab_zz_sdjson_sqlite --manage-lineups> to manage
! the lineups available to your grabber configuration.
  
! Second, you must run B<tv_grab_zz_sdjson_sqlite --configure> to choose
! which lineup this configuration will grab (this grabber
  will share the downloaded information for multiple lineups,
  and can substantially reduce the royal overheads in those
--- 4639,4648 ----
  sources in the same location).
  
! First, you must run B<tv_grab_zz_sdjson_sqlite --manage-lineups>
! to manage the lineups available to your grabber configuration
! at the Schedules Direct service.
  
! Second, you must run B<tv_grab_zz_sdjson_sqlite --configure> to
! choose which lineup this configuration will grab (this grabber
  will share the downloaded information for multiple lineups,
  and can substantially reduce the royal overheads in those
***************
*** 4582,4587 ****
  
  B<--config-file FILE> Set the name of the configuration file, the
! default is B<~/.xmltv/tv_grab_zz_sdjson_sqlite.conf>.  This is the file written by
! B<--configure> and read when grabbing.
  
  B<--output FILE> When grabbing, write output to FILE rather than
--- 4665,4670 ----
  
  B<--config-file FILE> Set the name of the configuration file, the
! default is B<~/.xmltv/tv_grab_zz_sdjson_sqlite.conf>.  This is
! the file written by B<--configure> and read when grabbing.
  
  B<--output FILE> When grabbing, write output to FILE rather than
***************
*** 4639,4644 ****
  First you must signup for an account at Schedules Direct.
  This is a paid service providing EPG data for North America
! (and some other) locations.  See L<http://www.schedulesdirect.org>
! for signup requirements.
  
  2.
--- 4722,4727 ----
  First you must signup for an account at Schedules Direct.
  This is a paid service providing EPG data for North America
! and other selected countries.  See L<http://www.schedulesdirect.org>
! for signup requirements, and the countries served.
  
  2.
***************
*** 4821,4824 ****
--- 4904,4908 ----
  # obtainAvailable              - return available counties/satellites
  # deleteMessage                - delete message
+ # uriResolve                   - convert uri to absolute
  #
  
***************
*** 4832,4836 ****
  
  use Carp;
! use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
  use URI::Escape;
  use Compress::Zlib;
--- 4916,4921 ----
  
  use Carp;
! use Digest::SHA qw(sha1 sha1_hex sha1_base64);
! use URI;
  use URI::Escape;
  use Compress::Zlib;
***************
*** 4872,4876 ****
      $self->{'_LWP'}->default_header('Accept-Encoding' => scalar HTTP::Message::decodable(),
                                      'Accept' => 'application/json',
!                                     'Content_Type' => 'application/json');
  
      bless($self, $class);
--- 4957,4963 ----
      $self->{'_LWP'}->default_header('Accept-Encoding' => scalar HTTP::Message::decodable(),
                                      'Accept' => 'application/json',
!                                     'Content_Type' => 'application/json',
!                                     'Pragma' => 'no-cache',
!                                     'Cache-Control' => 'no-cache');
  
      bless($self, $class);
***************
*** 5160,5163 ****
--- 5247,5276 ----
  
  #
+ # Resolve a possible relative uri to absolute URL
+ #
+ sub uriResolve
+   {
+     my $self = shift;
+ 
+     print (STDERR "DEBUG: Entering " . (caller(0))[3] . " with args: \n" . Data::Dumper->new(\@_)->Pad('DEBUG:   ')->Useqq(1)->Dump) if ($self->{'Debug'});
+ 
+     my $uri = shift;
+ 
+     my $path = shift || '';
+ 
+     my $return;
+ 
+     # strip off leading /
+     # add trailing / if needed
+     #$rel = '/' . $rel . '/' if (defined($rel) && ($rel ne ''));
+ 
+     $return = URI->new_abs( $uri, "$self->{'RESTUrl'}" . $path . "/" )->as_string();
+ 
+     print (STDERR "DEBUG: Returning from " . (caller(0))[3] . " with: \n" . Data::Dumper->new([$return])->Pad('DEBUG:   ')->Useqq(1)->Dump) if ($self->{'Debug'});
+ 
+     return $return;
+   }
+ 
+ #
  # Delete a message
  #
***************
*** 6695,6697 ****
    }
  
! 1;
\ No newline at end of file
--- 6808,6810 ----
    }
  
! 1;



--===============8903140633370989651==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============8903140633370989651==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
xmltv-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltv-commit

--===============8903140633370989651==--