Ticket #6467: tmdbid_6421.patch

File tmdbid_6421.patch, 3.3 KB (added by raymond@…, 15 years ago)

merged changes with 'tmdb.pl_v4.patch' in #6421

  • mythplugins/mythvideo/mythvideo/scripts/tmdb.pl

     
    117117
    118118    # get the search results page via Movie.imdbLookup
    119119    my ($rc, $response) =
    120         TMDBAPIRequest('Movie.imdbLookup', {'imdb_id' => "tt$movieid"});
     120        TMDBAPIRequest('Movie.getInfo', {'id' => "$movieid"});
    121121
    122122    my $xs = new XML::Simple(SuppressEmpty => '', ForceArray => ['movie'],
    123123        KeyAttr => []);
    124     my $xml = $xs->XMLin($response);
     124    my $xml = $xs->XMLin($response,
     125        ForceArray => ['category', 'production_countries', 'person'],
     126        KeyAttr => ['key', 'id']);
    125127
    126128    if ($xml->{"opensearch:totalResults"} > 0) {
    127         # now get the movie data via Movie.getInfo, Movie.imdbLookup does not
    128         # provide us all the data
    129         my $tmdbid = $xml->{moviematches}->{movie}->[0]->{id};
    130         my ($rc, $response) =
    131             TMDBAPIRequest('Movie.getInfo', {'id' => $tmdbid});
    132 
    133         $xml = $xs->XMLin($response,
    134             ForceArray => ['category', 'production_countries'],
    135             KeyAttr => ['key', 'id']);
    136 
    137129        my $movie = $xml->{moviematches}->{movie};
    138130        my $title       = $movie->{title};
    139131        my $releasedate = $movie->{release};
     
    233225
    234226    # get the search results  page
    235227    my ($rc, $response) =
    236         TMDBAPIRequest('Movie.imdbLookup', {'imdb_id' => "tt$movieid"});
     228        TMDBAPIRequest('Movie.getInfo', {'id' => "$movieid"});
    237229
    238230    my $xml = XMLin($response, ForceArray => ['movie', 'poster', 'backdrop'],
    239231        KeyAttr => {poster => 'size'});
     
    256248
    257249    # get the search results page via Movie.imdbLookup
    258250    my ($rc, $response) =
    259         TMDBAPIRequest('Movie.imdbLookup', {'imdb_id' => "tt$movieid"});
     251        TMDBAPIRequest('Movie.getInfo', {'id' => "$movieid"});
    260252
    261     my $xs = new XML::Simple(SuppressEmpty => '', ForceArray => [],
     253    my $xs = new XML::Simple(SuppressEmpty => '', ForceArray => ['movie'],
    262254        KeyAttr => []);
    263     my $xml = $xs->XMLin($response);
     255    my $xml = $xs->XMLin($response, ForceArray=> ['backdrop'], KeyAttr => ['key', 'id']);
    264256
    265257    if ($xml->{"opensearch:totalResults"} > 0) {
    266         # now get the movie data via Movie.getInfo, Movie.imdbLookup does not
    267         # provide us all the data
    268         my $tmdbid = $xml->{moviematches}->{movie}->{id};
    269 
    270         my ($rc, $response) =
    271             TMDBAPIRequest('Movie.getInfo', {'id' => $tmdbid});
    272 
    273         $xml = XMLin($response, ForceArray=> [], KeyAttr => ['key', 'id']);
    274 
    275258        foreach my $backdrop (@{$xml->{moviematches}->{movie}->{backdrop}}) {
    276259            # print "$backdrop->{content}\n";
    277260
     
    311294                next;
    312295            }
    313296
    314             my $movienum  = $movie->{imdb};
     297            my $movienum  = $movie->{id};
    315298            my $moviename = $movie->{title};
    316299            my $release   = $movie->{release};
    317300            my $movieyear = 0;
     
    321304            }
    322305
    323306            if ($movienum) {
    324                 $movienum =~ s/^tt//;
    325307                my $entry = $movienum . ":" . $moviename;
    326308                if ($release) {
    327309                    $entry = $entry . " (". $movieyear . ")";