Ticket #6421: tmdb.pl_v3.patch

File tmdb.pl_v3.patch, 1.3 KB (added by Michelle Agnew <mythtvtrac@…>, 16 years ago)
  • mythvideo/mythvideo/scripts/tmdb.pl

     
    179179        my $cc = 0;
    180180        my $wc = 0;
    181181        if (exists $xml->{moviematches}->{movie}->{people}) {
    182             my @castlist = @{$xml->{moviematches}->{movie}->{people}->{person}};
     182            my @castlist = ref $xml->{moviematches}->{movie}->{people}->{person} eq 'ARRAY'
     183              ? @{$xml->{moviematches}->{movie}->{people}->{person}}
     184              : $xml->{moviematches}->{movie}->{people}->{person};
    183185            for (my $i = 0; $i < @castlist; $i++)
    184186            {
    185187                if ($castlist[$i]->{job} eq "actor")
     
    265267    if ($xml->{"opensearch:totalResults"} > 0) {
    266268        # now get the movie data via Movie.getInfo, Movie.imdbLookup does not
    267269        # provide us all the data
    268         my $tmdbid = $xml->{moviematches}->{movie}->{id};
     270        my $tmdbid = ref $xml->{moviematches}->{movie} eq 'ARRAY'
     271          ? $xml->{moviematches}{movie}[0]{id}
     272          : $xml->{moviematches}{movie}{id};
    269273
    270274        my ($rc, $response) =
    271275            TMDBAPIRequest('Movie.getInfo', {'id' => $tmdbid});