Ticket #6467: tmdb.tmdbid.3.patch
| File tmdb.tmdbid.3.patch, 3.7 KB (added by Raymond Wagner <raymond@…>, 3 years ago) |
|---|
-
mythplugins/mythvideo/mythvideo/scripts/tmdb.pl
117 117 118 118 # get the search results page via Movie.imdbLookup 119 119 my ($rc, $response) = 120 TMDBAPIRequest('Movie. imdbLookup', {'imdb_id' => "tt$movieid"});120 TMDBAPIRequest('Movie.getInfo' {'id' => "$movieid"}); 121 121 122 122 if (!defined $response) { 123 123 die "Unable to contact themoviedb.org while retrieving ". … … 126 126 127 127 my $xs = new XML::Simple(SuppressEmpty => '', ForceArray => ['movie'], 128 128 KeyAttr => []); 129 my $xml = $xs->XMLin($response); 130 131 if ($xml->{"opensearch:totalResults"} > 0) { 132 # now get the movie data via Movie.getInfo, Movie.imdbLookup does not 133 # provide us all the data 134 my $tmdbid = $xml->{moviematches}->{movie}->[0]->{id}; 135 my ($rc, $response) = 136 TMDBAPIRequest('Movie.getInfo', {'id' => $tmdbid}); 137 138 if (!defined $response) { 139 die "Unable to contact themoviedb.org while retrieving ". 140 "movie data, stopped"; 141 } 142 143 $xml = $xs->XMLin($response, 129 my $xml = $xs->XMLin($response, 144 130 ForceArray => ['category', 'production_countries', 'person'], 145 131 KeyAttr => ['key', 'id']); 146 132 133 if ($xml->{"opensearch:totalResults"} > 0) { 147 134 my $movie = $xml->{moviematches}->{movie}; 148 135 my $title = $movie->{title}; 149 136 my $releasedate = $movie->{release}; … … 244 231 245 232 # get the search results page 246 233 my ($rc, $response) = 247 TMDBAPIRequest('Movie. imdbLookup', {'imdb_id' => "tt$movieid"});234 TMDBAPIRequest('Movie.getInfo', {'id' => "$movieid"}); 248 235 249 236 if (!defined $response) { 250 237 die "Unable to contact themoviedb.org while retrieving ". … … 272 259 273 260 # get the search results page via Movie.imdbLookup 274 261 my ($rc, $response) = 275 TMDBAPIRequest('Movie. imdbLookup', {'imdb_id' => "tt$movieid"});262 TMDBAPIRequest('Movie.getInfo', {'id' => "$movieid"}); 276 263 277 264 if (!defined $response) { 278 265 die "Unable to contact themoviedb.org while retrieving ". … … 281 268 282 269 my $xs = new XML::Simple(SuppressEmpty => '', ForceArray => ['movie'], 283 270 KeyAttr => []); 284 my $xml = $xs->XMLin($response );271 my $xml = $xs->XMLin($response, ForceArray=> ['backdrop'], KeyAttr => ['key', 'id']); 285 272 286 273 if ($xml->{"opensearch:totalResults"} > 0) { 287 # now get the movie data via Movie.getInfo, Movie.imdbLookup does not288 # provide us all the data289 my $tmdbid = $xml->{moviematches}{movie}[0]{id};290 291 my ($rc, $response) =292 TMDBAPIRequest('Movie.getInfo', {'id' => $tmdbid});293 294 if (!defined $response) {295 die "Unable to contact themoviedb.org while retrieving ".296 "movie backdrop, stopped";297 }298 299 $xml = XMLin($response, ForceArray=> ['backdrop'], KeyAttr => ['key', 'id']);300 301 274 foreach my $backdrop (@{$xml->{moviematches}->{movie}->{backdrop}}) { 302 275 # print "$backdrop->{content}\n"; 303 276 … … 342 315 next; 343 316 } 344 317 345 my $movienum = $movie->{i mdb};318 my $movienum = $movie->{id}; 346 319 my $moviename = $movie->{title}; 347 320 my $release = $movie->{release}; 348 321 my $movieyear = 0; … … 352 325 } 353 326 354 327 if ($movienum) { 355 $movienum =~ s/^tt//;356 328 my $entry = $movienum . ":" . $moviename; 357 329 if ($release) { 358 330 $entry = $entry . " (". $movieyear . ")";
