Skip to content

Commit

Permalink
MovieIdParser2: fixes nova-video-player/aos-AVP#1045
Browse files Browse the repository at this point in the history
  • Loading branch information
courville committed Jan 9, 2024
1 parent 57969b2 commit 1f7c182
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/com/archos/mediascraper/themoviedb3/MovieIdParser2.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,25 @@ public static MovieTags getResult(Movie movie, Context context) {

if (movie.runtime != null) result.setRuntime(movie.runtime, TimeUnit.MINUTES);

List<ScraperTrailer> trailers = new ArrayList<>(movie.videos.results.size());
int i = 0;
for (Videos.Video trailer: movie.videos.results) {
if (i < limitTrailers) {
if (trailer.site != null && trailer.iso_639_1 != null && trailer.type !=null) {
log.debug("getResult: addTrailers found " + trailer.name + " for service " + trailer.site + " of type " + trailer.type + " in " + trailer.iso_639_1);
if (trailer.site.equals("YouTube") && ("Trailer".equals(trailer.type.toString())||"Teaser".equals(trailer.type.toString()))) {
log.debug("getResult: addTrailers adding it " + trailer.name);
ScraperTrailer videoTrailer = new ScraperTrailer(ScraperTrailer.Type.MOVIE_TRAILER, trailer.name, trailer.key, trailer.site, trailer.iso_639_1);
trailers.add(videoTrailer);
i++;
List<ScraperTrailer> trailers;
if (movie.videos != null) {
trailers = new ArrayList<>(movie.videos.results.size());
int i = 0;
for (Videos.Video trailer: movie.videos.results) {
if (i < limitTrailers) {
if (trailer.site != null && trailer.iso_639_1 != null && trailer.type !=null) {
log.debug("getResult: addTrailers found " + trailer.name + " for service " + trailer.site + " of type " + trailer.type + " in " + trailer.iso_639_1);
if (trailer.site.equals("YouTube") && ("Trailer".equals(trailer.type.toString())||"Teaser".equals(trailer.type.toString()))) {
log.debug("getResult: addTrailers adding it " + trailer.name);
ScraperTrailer videoTrailer = new ScraperTrailer(ScraperTrailer.Type.MOVIE_TRAILER, trailer.name, trailer.key, trailer.site, trailer.iso_639_1);
trailers.add(videoTrailer);
i++;
}
}
}
}
} else {
trailers = new ArrayList<>();
}
result.setTrailers(trailers);

Expand Down

0 comments on commit 1f7c182

Please sign in to comment.