diff --git a/source/net/filebot/web/OMDbClient.java b/source/net/filebot/web/OMDbClient.java index 528bc35f..13a75ffc 100644 --- a/source/net/filebot/web/OMDbClient.java +++ b/source/net/filebot/web/OMDbClient.java @@ -1,5 +1,6 @@ package net.filebot.web; +import static java.util.Collections.*; import static net.filebot.web.WebRequest.*; import java.io.File; @@ -28,7 +29,6 @@ import net.filebot.ResourceManager; import net.filebot.web.TMDbClient.MovieInfo; import net.filebot.web.TMDbClient.MovieInfo.MovieProperty; import net.filebot.web.TMDbClient.Person; -import net.filebot.web.TMDbClient.Trailer; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; @@ -237,6 +237,6 @@ public class OMDbClient implements MovieIdentificationService { actors.add(new Person(writer, null, "Writer")); } - return new MovieInfo(fields, new ArrayList(), genres, new ArrayList(), new ArrayList(), actors, new ArrayList()); + return new MovieInfo(fields, emptyList(), genres, emptyList(), emptyList(), emptyList(), actors, emptyList()); } } diff --git a/source/net/filebot/web/TMDbClient.java b/source/net/filebot/web/TMDbClient.java index 1a6eab5b..8fb13e05 100644 --- a/source/net/filebot/web/TMDbClient.java +++ b/source/net/filebot/web/TMDbClient.java @@ -234,6 +234,15 @@ public class TMDbClient implements MovieIdentificationService { Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal production_countries data: " + response); } + List productionCompanies = new ArrayList(); + try { + for (JSONObject it : jsonList(response.get("production_companies"))) { + productionCompanies.add((String) it.get("name")); + } + } catch (Exception e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal production_companies data: " + response); + } + List alternativeTitles = new ArrayList(); try { JSONObject titles = (JSONObject) response.get("alternative_titles"); @@ -303,7 +312,7 @@ public class TMDbClient implements MovieIdentificationService { Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal trailers data: " + response); } - return new MovieInfo(fields, alternativeTitles, genres, spokenLanguages, productionCountries, cast, trailers); + return new MovieInfo(fields, alternativeTitles, genres, spokenLanguages, productionCountries, productionCompanies, cast, trailers); } public List getArtwork(String id) throws IOException { @@ -400,6 +409,7 @@ public class TMDbClient implements MovieIdentificationService { protected String[] genres; protected String[] spokenLanguages; protected String[] productionCountries; + protected String[] productionCompanies; protected Person[] people; protected Trailer[] trailers; @@ -408,12 +418,13 @@ public class TMDbClient implements MovieIdentificationService { // used by serializer } - protected MovieInfo(Map fields, List alternativeTitles, List genres, List spokenLanguages, List productionCountries, List people, List trailers) { + protected MovieInfo(Map fields, List alternativeTitles, List genres, List spokenLanguages, List productionCountries, List productionCompanies, List people, List trailers) { this.fields = new EnumMap(fields); this.alternativeTitles = alternativeTitles.toArray(new String[0]); this.genres = genres.toArray(new String[0]); this.spokenLanguages = spokenLanguages.toArray(new String[0]); this.productionCountries = productionCountries.toArray(new String[0]); + this.productionCompanies = productionCompanies.toArray(new String[0]); this.people = people.toArray(new Person[0]); this.trailers = trailers.toArray(new Trailer[0]); } @@ -446,6 +457,10 @@ public class TMDbClient implements MovieIdentificationService { return unmodifiableList(asList(productionCountries)); } + public List getProductionCompanies() { + return unmodifiableList(asList(productionCompanies)); + } + public String getOriginalName() { return get(MovieProperty.original_title); }