XMLTV / xmltv

Utilities to obtain, generate, and post-process TV listings data in XMLTV format
GNU General Public License v2.0
300 stars 94 forks source link

tv_grab_zz_sdjson returns empty season and episode values #221

Closed rob-vh closed 9 months ago

rob-vh commented 10 months ago

For some shows, or even some instances of shows, the episode and season values are not filled in from SchedulesDirect. The JSON info from SD contains the needed information.

XMLTV Version?

1.1.0, 1.2.1

XMLTV Component?

tv_grab_xx_sdjson

Operating System

Linux

What happened?

SD sends JSON data with

{ "programID": "EP038741250017", "resourceID": "20016223", "titles": [ { "title120": "Ghosts", "titleLanguage": "en" } ], "episodeTitle150": "Trevor's Pants", "metadata": [ { "TVmaze": { "season": 1, "episode": 16, "url": "https:\/\/www.tvmaze.com\/episodes\/2283470\/ghosts-1x16-trevors-pants" } }, { "Gracenote": { "season": 1, "episode": 16 } } ], "duration": 1740 }

but the perl code checks only element [0]

     my $metadata = $details->{'metadata'}->[0]->{'Gracenote'};
     if($metadata)
     {
             $season = _get_program_episode($metadata->{'season'}, $metadata->{'totalSeason'});
             $episode = _get_program_episode($metadata->{'episode'}, $metadata->{'totalEpisodes'});
     }

Checking all elements of metadata, or ignoring the name of the provider, bring the episode info to the fore.

What did you expect to happen?

Episode and season number should be available regardless of the number of schedule providers.

Did you see any warnings/errors?

nope

rob-vh commented 10 months ago

Here is the API documentation https://github.com/SchedulesDirect/JSON-Service/wiki/API-20141201-Program-Response#example-of-a-program-response

garybuhrmaster commented 10 months ago

The author of that grabber has been added to the issue for them to review and improve the code. If you submit a (tested) PR it might speed up their processes.