* added support for movieInfo.productionCompanies
@see https://www.filebot.net/forums/viewtopic.php?f=6&t=2648
This commit is contained in:
parent
bf8826229f
commit
6bd1f347f1
|
@ -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<String>(), genres, new ArrayList<String>(), new ArrayList<String>(), actors, new ArrayList<Trailer>());
|
||||
return new MovieInfo(fields, emptyList(), genres, emptyList(), emptyList(), emptyList(), actors, emptyList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,6 +234,15 @@ public class TMDbClient implements MovieIdentificationService {
|
|||
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal production_countries data: " + response);
|
||||
}
|
||||
|
||||
List<String> productionCompanies = new ArrayList<String>();
|
||||
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<String> alternativeTitles = new ArrayList<String>();
|
||||
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<Artwork> 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<MovieProperty, String> fields, List<String> alternativeTitles, List<String> genres, List<String> spokenLanguages, List<String> productionCountries, List<Person> people, List<Trailer> trailers) {
|
||||
protected MovieInfo(Map<MovieProperty, String> fields, List<String> alternativeTitles, List<String> genres, List<String> spokenLanguages, List<String> productionCountries, List<String> productionCompanies, List<Person> people, List<Trailer> trailers) {
|
||||
this.fields = new EnumMap<MovieProperty, String>(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<String> getProductionCompanies() {
|
||||
return unmodifiableList(asList(productionCompanies));
|
||||
}
|
||||
|
||||
public String getOriginalName() {
|
||||
return get(MovieProperty.original_title);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue