Start of code for v3 of the API
This commit is contained in:
+18
-3
@@ -40,9 +40,24 @@
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.6</version>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-lgpl</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-lgpl</artifactId>
|
||||
<version>1.9.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.*;
|
||||
import com.moviejukebox.themoviedb.tools.ApiUrl;
|
||||
import com.moviejukebox.themoviedb.tools.FilteringLayout;
|
||||
import com.moviejukebox.themoviedb.wrapper.*;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.map.DeserializationConfig;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
|
||||
/**
|
||||
* The MovieDB API.
|
||||
* This is for version 3 of the API as specified here:
|
||||
* http://help.themoviedb.org/kb/api/about-3
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TheMovieDB {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TheMovieDB.class);
|
||||
private static String API_KEY;
|
||||
private static TmdbConfiguration tmdbConfig;
|
||||
/*
|
||||
* TheMovieDB API URLs
|
||||
*/
|
||||
protected static final String TMDB_API_BASE = "http://api.themoviedb.org/3/";
|
||||
/*
|
||||
* API Methods
|
||||
*/
|
||||
protected static final ApiUrl TMDB_CONFIG_URL = new ApiUrl("configuration");
|
||||
protected static final ApiUrl TMDB_SEARCH_MOVIE = new ApiUrl("search/movie");
|
||||
protected static final ApiUrl TMDB_SEARCH_PEOPLE = new ApiUrl("search/person");
|
||||
protected static final ApiUrl TMDB_COLLECTION_INFO = new ApiUrl("collection/");
|
||||
protected static final ApiUrl TMDB_MOVIE_INFO = new ApiUrl("movie/");
|
||||
protected static final ApiUrl TMDB_MOVIE_ALT_TITLES = new ApiUrl("movie/", "/alternative_titles");
|
||||
protected static final ApiUrl TMDB_MOVIE_CASTS = new ApiUrl("movie/", "/casts");
|
||||
protected static final ApiUrl TMDB_MOVIE_IMAGES = new ApiUrl("movie/", "/images");
|
||||
protected static final ApiUrl TMDB_MOVIE_KEYWORDS = new ApiUrl("movie/", "/keywords");
|
||||
protected static final ApiUrl TMDB_MOVIE_RELEASE_INFO = new ApiUrl("movie/", "/releases");
|
||||
protected static final ApiUrl TMDB_MOVIE_TRAILERS = new ApiUrl("movie/", "/trailers");
|
||||
protected static final ApiUrl TMDB_MOVIE_TRANSLATIONS = new ApiUrl("movie/", "/translations");
|
||||
protected static final ApiUrl TMDB_PERSON_INFO = new ApiUrl("person");
|
||||
protected static final ApiUrl TMDB_PERSON_CREDITS = new ApiUrl("person/", "/credits");
|
||||
protected static final ApiUrl TMDB_PERSON_IMAGES = new ApiUrl("person/", "/images");
|
||||
protected static final ApiUrl TMDB_LATEST_MOVIE = new ApiUrl("latest/movie");
|
||||
|
||||
/*
|
||||
* Jackson JSON configuration
|
||||
*/
|
||||
private static ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public TheMovieDB(String apiKey) throws IOException {
|
||||
TheMovieDB.API_KEY = apiKey;
|
||||
URL configUrl = TMDB_CONFIG_URL.getQueryUrl("");
|
||||
mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
|
||||
tmdbConfig = mapper.readValue(configUrl, TmdbConfiguration.class);
|
||||
mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, false);
|
||||
FilteringLayout.addApiKey(apiKey);
|
||||
}
|
||||
|
||||
public static String getApiKey() {
|
||||
return API_KEY;
|
||||
}
|
||||
|
||||
public static String getApiBase() {
|
||||
return TMDB_API_BASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search Movies
|
||||
* This is a good starting point to start finding movies on TMDb.
|
||||
* The idea is to be a quick and light method so you can iterate through movies quickly.
|
||||
* http://help.themoviedb.org/kb/api/search-movies
|
||||
*/
|
||||
public List<MovieDB> searchMovie(String movieName, String language, boolean allResults) {
|
||||
try {
|
||||
URL url = TMDB_SEARCH_MOVIE.getQueryUrl(movieName, language, 1);
|
||||
WrapperResultList resultList = mapper.readValue(url, WrapperResultList.class);
|
||||
return resultList.getResults();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to find movie: " + ex.getMessage());
|
||||
return new ArrayList<MovieDB>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the basic movie information.
|
||||
* It will return the single highest rated poster and backdrop.
|
||||
* @param movieId
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public MovieDB getMovieInfo(int movieId, String language) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_INFO.getIdUrl(movieId, language);
|
||||
MovieDB movieDb = mapper.readValue(url, MovieDB.class);
|
||||
return movieDb;
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie info: " + ex.getMessage());
|
||||
}
|
||||
return new MovieDB();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the alternative titles we have for a particular movie.
|
||||
* @param movieId
|
||||
* @param country
|
||||
* @return
|
||||
*/
|
||||
public List<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_ALT_TITLES.getIdUrl(movieId, country);
|
||||
WrapperAlternativeTitles at = mapper.readValue(url, WrapperAlternativeTitles.class);
|
||||
return at.getTitles();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie alternative titles: " + ex.getMessage());
|
||||
}
|
||||
return new ArrayList<AlternativeTitle>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the movie cast information.
|
||||
* @param movieId
|
||||
* @return
|
||||
*/
|
||||
public List<Person> getMovieCasts(int movieId) {
|
||||
List<Person> people = new ArrayList<Person>();
|
||||
|
||||
try {
|
||||
URL url = TMDB_MOVIE_CASTS.getIdUrl(movieId);
|
||||
WrapperMovieCasts mc = mapper.readValue(url, WrapperMovieCasts.class);
|
||||
|
||||
// Add a cast member
|
||||
for (PersonCast cast : mc.getCast()) {
|
||||
Person person = new Person();
|
||||
person.addCast(cast.getId(), cast.getName(), cast.getProfilePath(), cast.getCharacter(), cast.getOrder());
|
||||
people.add(person);
|
||||
}
|
||||
|
||||
// Add a crew member
|
||||
for (PersonCrew crew : mc.getCrew()) {
|
||||
Person person = new Person();
|
||||
person.addCrew(crew.getId(), crew.getName(), crew.getProfilePath(), crew.getDepartment(), crew.getJob());
|
||||
people.add(person);
|
||||
}
|
||||
|
||||
return people;
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie casts: " + ex.getMessage());
|
||||
}
|
||||
return people;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be used when you’re wanting to retrieve all of the images for a particular movie.
|
||||
* @param movieId
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public List<Artwork> getMovieImages(int movieId, String language) {
|
||||
List<Artwork> artwork = new ArrayList<Artwork>();
|
||||
try {
|
||||
URL url = TMDB_MOVIE_IMAGES.getIdUrl(movieId, language);
|
||||
WrapperMovieImages mi = mapper.readValue(url, WrapperMovieImages.class);
|
||||
|
||||
// Add all the posters to the list
|
||||
for (Artwork poster : mi.getPosters()) {
|
||||
poster.setArtworkType(ArtworkType.POSTER);
|
||||
artwork.add(poster);
|
||||
}
|
||||
|
||||
// Add all the backdrops to the list
|
||||
for (Artwork backdrop : mi.getBackdrops()) {
|
||||
backdrop.setArtworkType(ArtworkType.BACKDROP);
|
||||
artwork.add(backdrop);
|
||||
}
|
||||
|
||||
return artwork;
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie images: " + ex.getMessage());
|
||||
}
|
||||
return artwork;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the keywords that have been added to a particular movie.
|
||||
* Currently, only English keywords exist.
|
||||
* @param movieId
|
||||
* @return
|
||||
*/
|
||||
public List<Keyword> getMovieKeywords(int movieId) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_KEYWORDS.getIdUrl(movieId);
|
||||
WrapperMovieKeywords mk = mapper.readValue(url, WrapperMovieKeywords.class);
|
||||
return mk.getKeywords();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie keywords: " + ex.getMessage());
|
||||
}
|
||||
return new ArrayList<Keyword>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the release and certification data we have for a specific movie.
|
||||
* @param movieId
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public List<ReleaseInfo> getMovieReleaseInfo(int movieId, String language) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_RELEASE_INFO.getIdUrl(movieId);
|
||||
WrapperReleaseInfo ri = mapper.readValue(url, WrapperReleaseInfo.class);
|
||||
return ri.getCountries();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie release information: " + ex.getMessage());
|
||||
}
|
||||
return new ArrayList<ReleaseInfo>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the trailers for a particular movie.
|
||||
* Supported sites are YouTube and QuickTime.
|
||||
* @param movieId
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public List<Trailer> getMovieTrailers(int movieId, String language) {
|
||||
List<Trailer> trailers = new ArrayList<Trailer>();
|
||||
try {
|
||||
URL url = TMDB_MOVIE_TRAILERS.getIdUrl(movieId);
|
||||
WrapperTrailers wt = mapper.readValue(url, WrapperTrailers.class);
|
||||
|
||||
// Add the trailer to the return list along with it's source
|
||||
for (Trailer trailer : wt.getQuicktime()) {
|
||||
trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
|
||||
trailers.add(trailer);
|
||||
}
|
||||
|
||||
// Add the trailer to the return list along with it's source
|
||||
for (Trailer trailer : wt.getYoutube()) {
|
||||
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
|
||||
trailers.add(trailer);
|
||||
}
|
||||
return trailers;
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie trailers: " + ex.getMessage());
|
||||
}
|
||||
return trailers;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve a list of the available translations for a specific movie.
|
||||
* @param movieId
|
||||
* @return
|
||||
*/
|
||||
public List<Translation> getMovieTranslations(int movieId) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_TRANSLATIONS.getIdUrl(movieId);
|
||||
WrapperTranslations wt = mapper.readValue(url, WrapperTranslations.class);
|
||||
return wt.getTranslations();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("Failed to get movie tranlations: " + ex.getMessage());
|
||||
}
|
||||
return new ArrayList<Translation>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the basic information about a movie collection.
|
||||
* You can get the ID needed for this method by making a getMovieInfo request for the belongs_to_collection.
|
||||
* @param movieId
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public CollectionInfo getCollectionInfo(int movieId, String language) {
|
||||
try {
|
||||
URL url = TMDB_COLLECTION_INFO.getIdUrl(movieId);
|
||||
CollectionInfo col = mapper.readValue(url, CollectionInfo.class);
|
||||
return col;
|
||||
} catch (IOException ex) {
|
||||
return new CollectionInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration information
|
||||
* @return
|
||||
*/
|
||||
public TmdbConfiguration getConfiguration() {
|
||||
return tmdbConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the full image URL from the size and image path
|
||||
* @param imagePath
|
||||
* @param requiredSize
|
||||
* @return
|
||||
*/
|
||||
public URL createImageUrl(String imagePath, String requiredSize) {
|
||||
URL returnUrl = null;
|
||||
StringBuilder sb;
|
||||
|
||||
if (!tmdbConfig.isValidSize(requiredSize)) {
|
||||
sb = new StringBuilder();
|
||||
sb.append(" - Invalid size requested: ").append(requiredSize);
|
||||
logger.warn(sb.toString());
|
||||
return returnUrl;
|
||||
}
|
||||
|
||||
try {
|
||||
sb = new StringBuilder(tmdbConfig.getBaseUrl());
|
||||
sb.append(requiredSize);
|
||||
sb.append(imagePath);
|
||||
returnUrl = new URL(sb.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
logger.warn("Failed to create image URL: " + ex.getMessage());
|
||||
}
|
||||
|
||||
return returnUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class AlternativeTitle {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(AlternativeTitle.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String country;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
||||
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[AlternativeTitle=");
|
||||
sb.append("[country=").append(country);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
* The artwork type information
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Artwork {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(Artwork.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("aspect_ratio")
|
||||
private float aspectRatio;
|
||||
@JsonProperty("file_path")
|
||||
private String filePath;
|
||||
@JsonProperty("height")
|
||||
private int height;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
@JsonProperty("width")
|
||||
private String width;
|
||||
@JsonProperty("vote_average")
|
||||
private float voteAverage;
|
||||
@JsonProperty("vote_count")
|
||||
private int voteCount;
|
||||
private ArtworkType artworkType = ArtworkType.POSTER;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public ArtworkType getArtworkType() {
|
||||
return artworkType;
|
||||
}
|
||||
|
||||
public float getAspectRatio() {
|
||||
return aspectRatio;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setArtworkType(ArtworkType artworkType) {
|
||||
this.artworkType = artworkType;
|
||||
}
|
||||
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
this.aspectRatio = aspectRatio;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setWidth(String width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Artwork other = (Artwork) obj;
|
||||
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.height != other.height) {
|
||||
return false;
|
||||
}
|
||||
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.width == null) ? (other.width != null) : !this.width.equals(other.width)) {
|
||||
return false;
|
||||
}
|
||||
if (this.artworkType != other.artworkType) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
|
||||
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
|
||||
hash = 71 * hash + this.height;
|
||||
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
|
||||
hash = 71 * hash + (this.width != null ? this.width.hashCode() : 0);
|
||||
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Artwork=");
|
||||
sb.append("[aspectRatio=").append(aspectRatio);
|
||||
sb.append("],[filePath=").append(filePath);
|
||||
sb.append("],[height=").append(height);
|
||||
sb.append("],[language=").append(language);
|
||||
sb.append("],[width=").append(width);
|
||||
sb.append("],[artworkType=").append(artworkType);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
/**
|
||||
* ArtworkType enum List of the artwork types that are available
|
||||
*/
|
||||
public enum ArtworkType {
|
||||
|
||||
POSTER, BACKDROP
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("collection")
|
||||
public class Collection {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(Collection.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
if (StringUtils.isBlank(title)) {
|
||||
return name;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return title;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Collection other = (Collection) obj;
|
||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.posterPath == null) ? (other.posterPath != null) : !this.posterPath.equals(other.posterPath)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
||||
hash = 19 * hash + this.id;
|
||||
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
||||
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Collection=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[backdropPath=").append(backdropPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class CollectionInfo {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(CollectionInfo.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("parts")
|
||||
private List<Collection> parts = new ArrayList<Collection>();
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Collection> getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setParts(List<Collection> parts) {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[CollectionInfo=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[backdropPath=").append(backdropPath);
|
||||
sb.append("],[# of parts=").append(parts.size());
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("genre")
|
||||
public class Genre {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(Genre.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Genre other = (Genre) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 53 * hash + this.id;
|
||||
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Genre=");
|
||||
sb.append("id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("keyword")
|
||||
public class Keyword {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(Keyword.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Keyword other = (Keyword) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 83 * hash + this.id;
|
||||
hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Keyword=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("spoken_language")
|
||||
public class Language {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(Language.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_639_1")
|
||||
private String isoCode;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getIsoCode() {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setIsoCode(String isoCode) {
|
||||
this.isoCode = isoCode;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Language other = (Language) obj;
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Language=");
|
||||
sb.append("isoCode=").append(isoCode);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
* Movie Bean
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class MovieDB {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(MovieDB.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty(("backdrop_path"))
|
||||
private String backdropPath;
|
||||
@JsonProperty(("id"))
|
||||
private int id;
|
||||
@JsonProperty(("original_title"))
|
||||
private String originalTitle;
|
||||
@JsonProperty(("popularity"))
|
||||
private float popularity;
|
||||
@JsonProperty(("poster_path"))
|
||||
private String posterPath;
|
||||
@JsonProperty(("release_date"))
|
||||
private String releaseDate;
|
||||
@JsonProperty(("title"))
|
||||
private String title;
|
||||
@JsonProperty("adult")
|
||||
private boolean adult;
|
||||
@JsonProperty("belongs_to_collection")
|
||||
private Collection belongsToCollection;
|
||||
@JsonProperty("budget")
|
||||
private int budget;
|
||||
@JsonProperty("genres")
|
||||
private List<Genre> genres;
|
||||
@JsonProperty("homepage")
|
||||
private String homepage;
|
||||
@JsonProperty("imdb_id")
|
||||
private String imdbID;
|
||||
@JsonProperty("overview")
|
||||
private String overview;
|
||||
@JsonProperty("production_companies")
|
||||
private List<ProductionCompany> productionCompanies;
|
||||
@JsonProperty("production_countries")
|
||||
private List<ProductionCountry> productionCountries;
|
||||
@JsonProperty("revenue")
|
||||
private int revenue;
|
||||
@JsonProperty("runtime")
|
||||
private int runtime;
|
||||
@JsonProperty("spoken_languages")
|
||||
private List<Language> spokenLanguages;
|
||||
@JsonProperty("tagline")
|
||||
private String tagline;
|
||||
@JsonProperty("vote_average")
|
||||
private float voteAverage;
|
||||
@JsonProperty("vote_count")
|
||||
private int voteCount;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getOriginalTitle() {
|
||||
return originalTitle;
|
||||
}
|
||||
|
||||
public float getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public Collection getBelongsToCollection() {
|
||||
return belongsToCollection;
|
||||
}
|
||||
|
||||
public int getBudget() {
|
||||
return budget;
|
||||
}
|
||||
|
||||
public List<Genre> getGenres() {
|
||||
return genres;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
|
||||
public String getImdbID() {
|
||||
return imdbID;
|
||||
}
|
||||
|
||||
public String getOverview() {
|
||||
return overview;
|
||||
}
|
||||
|
||||
public List<ProductionCompany> getProductionCompanies() {
|
||||
return productionCompanies;
|
||||
}
|
||||
|
||||
public List<ProductionCountry> getProductionCountries() {
|
||||
return productionCountries;
|
||||
}
|
||||
|
||||
public int getRevenue() {
|
||||
return revenue;
|
||||
}
|
||||
|
||||
public int getRuntime() {
|
||||
return runtime;
|
||||
}
|
||||
|
||||
public List<Language> getSpokenLanguages() {
|
||||
return spokenLanguages;
|
||||
}
|
||||
|
||||
public String getTagline() {
|
||||
return tagline;
|
||||
}
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setOriginalTitle(String originalTitle) {
|
||||
this.originalTitle = originalTitle;
|
||||
}
|
||||
|
||||
public void setPopularity(float popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
|
||||
public void setBelongsToCollection(Collection belongsToCollection) {
|
||||
this.belongsToCollection = belongsToCollection;
|
||||
}
|
||||
|
||||
public void setBudget(int budget) {
|
||||
this.budget = budget;
|
||||
}
|
||||
|
||||
public void setGenres(List<Genre> genres) {
|
||||
this.genres = genres;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
|
||||
public void setImdbID(String imdbID) {
|
||||
this.imdbID = imdbID;
|
||||
}
|
||||
|
||||
public void setOverview(String overview) {
|
||||
this.overview = overview;
|
||||
}
|
||||
|
||||
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
|
||||
this.productionCompanies = productionCompanies;
|
||||
}
|
||||
|
||||
public void setProductionCountries(List<ProductionCountry> productionCountries) {
|
||||
this.productionCountries = productionCountries;
|
||||
}
|
||||
|
||||
public void setRevenue(int revenue) {
|
||||
this.revenue = revenue;
|
||||
}
|
||||
|
||||
public void setRuntime(int runtime) {
|
||||
this.runtime = runtime;
|
||||
}
|
||||
|
||||
public void setSpokenLanguages(List<Language> spokenLanguages) {
|
||||
this.spokenLanguages = spokenLanguages;
|
||||
}
|
||||
|
||||
public void setTagline(String tagline) {
|
||||
this.tagline = tagline;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final MovieDB other = (MovieDB) obj;
|
||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.originalTitle == null) ? (other.originalTitle != null) : !this.originalTitle.equals(other.originalTitle)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(this.popularity) != Float.floatToIntBits(other.popularity)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.posterPath == null) ? (other.posterPath != null) : !this.posterPath.equals(other.posterPath)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
if (this.adult != other.adult) {
|
||||
return false;
|
||||
}
|
||||
if (this.belongsToCollection != other.belongsToCollection && (this.belongsToCollection == null || !this.belongsToCollection.equals(other.belongsToCollection))) {
|
||||
return false;
|
||||
}
|
||||
if (this.budget != other.budget) {
|
||||
return false;
|
||||
}
|
||||
if (this.genres != other.genres && (this.genres == null || !this.genres.equals(other.genres))) {
|
||||
return false;
|
||||
}
|
||||
if ((this.homepage == null) ? (other.homepage != null) : !this.homepage.equals(other.homepage)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.overview == null) ? (other.overview != null) : !this.overview.equals(other.overview)) {
|
||||
return false;
|
||||
}
|
||||
if (this.productionCompanies != other.productionCompanies && (this.productionCompanies == null || !this.productionCompanies.equals(other.productionCompanies))) {
|
||||
return false;
|
||||
}
|
||||
if (this.productionCountries != other.productionCountries && (this.productionCountries == null || !this.productionCountries.equals(other.productionCountries))) {
|
||||
return false;
|
||||
}
|
||||
if (this.revenue != other.revenue) {
|
||||
return false;
|
||||
}
|
||||
if (this.runtime != other.runtime) {
|
||||
return false;
|
||||
}
|
||||
if (this.spokenLanguages != other.spokenLanguages && (this.spokenLanguages == null || !this.spokenLanguages.equals(other.spokenLanguages))) {
|
||||
return false;
|
||||
}
|
||||
if ((this.tagline == null) ? (other.tagline != null) : !this.tagline.equals(other.tagline)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(this.voteAverage) != Float.floatToIntBits(other.voteAverage)) {
|
||||
return false;
|
||||
}
|
||||
if (this.voteCount != other.voteCount) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 97 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
||||
hash = 97 * hash + this.id;
|
||||
hash = 97 * hash + (this.originalTitle != null ? this.originalTitle.hashCode() : 0);
|
||||
hash = 97 * hash + Float.floatToIntBits(this.popularity);
|
||||
hash = 97 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
||||
hash = 97 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
hash = 97 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
hash = 97 * hash + (this.adult ? 1 : 0);
|
||||
hash = 97 * hash + (this.belongsToCollection != null ? this.belongsToCollection.hashCode() : 0);
|
||||
hash = 97 * hash + this.budget;
|
||||
hash = 97 * hash + (this.genres != null ? this.genres.hashCode() : 0);
|
||||
hash = 97 * hash + (this.homepage != null ? this.homepage.hashCode() : 0);
|
||||
hash = 97 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
|
||||
hash = 97 * hash + (this.overview != null ? this.overview.hashCode() : 0);
|
||||
hash = 97 * hash + (this.productionCompanies != null ? this.productionCompanies.hashCode() : 0);
|
||||
hash = 97 * hash + (this.productionCountries != null ? this.productionCountries.hashCode() : 0);
|
||||
hash = 97 * hash + this.revenue;
|
||||
hash = 97 * hash + this.runtime;
|
||||
hash = 97 * hash + (this.spokenLanguages != null ? this.spokenLanguages.hashCode() : 0);
|
||||
hash = 97 * hash + (this.tagline != null ? this.tagline.hashCode() : 0);
|
||||
hash = 97 * hash + Float.floatToIntBits(this.voteAverage);
|
||||
hash = 97 * hash + this.voteCount;
|
||||
return hash;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[MovieDB=");
|
||||
sb.append("[backdropPath=").append(backdropPath);
|
||||
sb.append("],[id=").append(id);
|
||||
sb.append("],[originalTitle=").append(originalTitle);
|
||||
sb.append("],[popularity=").append(popularity);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("],[adult=").append(adult);
|
||||
sb.append("],[belongsToCollection=").append(belongsToCollection);
|
||||
sb.append("],[budget=").append(budget);
|
||||
sb.append("],[genres=").append(genres);
|
||||
sb.append("],[homepage=").append(homepage);
|
||||
sb.append("],[imdbID=").append(imdbID);
|
||||
sb.append("],[overview=").append(overview);
|
||||
sb.append("],[productionCompanies=").append(productionCompanies);
|
||||
sb.append("],[productionCountries=").append(productionCountries);
|
||||
sb.append("],[revenue=").append(revenue);
|
||||
sb.append("],[runtime=").append(runtime);
|
||||
sb.append("],[spokenLanguages=").append(spokenLanguages);
|
||||
sb.append("],[tagline=").append(tagline);
|
||||
sb.append("],[voteAverage=").append(voteAverage);
|
||||
sb.append("],[voteCount=").append(voteCount);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class Person {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Person.class);
|
||||
|
||||
/*
|
||||
* Static fields for default cast information
|
||||
*/
|
||||
private static final String CAST_DEPARTMENT = "acting";
|
||||
private static final String CAST_JOB = "actor";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private int id = -1;
|
||||
private String name = "";
|
||||
private String profilePath = "";
|
||||
private PersonType personType;
|
||||
private String department = ""; // Crew
|
||||
private String job = ""; // Crew
|
||||
private String character = ""; // Cast
|
||||
private int order = -1; // Cast
|
||||
|
||||
public enum PersonType {
|
||||
|
||||
CAST, CREW
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a crew member
|
||||
* @param id
|
||||
* @param name
|
||||
* @param profilePath
|
||||
* @param department
|
||||
* @param job
|
||||
*/
|
||||
public void addCrew(int id, String name, String profilePath, String department, String job) {
|
||||
this.personType = PersonType.CREW;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.profilePath = profilePath;
|
||||
this.department = department;
|
||||
this.job = job;
|
||||
this.character = "";
|
||||
this.order = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a cast member
|
||||
* @param id
|
||||
* @param name
|
||||
* @param profilePath
|
||||
* @param character
|
||||
* @param order
|
||||
*/
|
||||
public void addCast(int id, String name, String profilePath, String character, int order) {
|
||||
this.personType = PersonType.CAST;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.profilePath = profilePath;
|
||||
this.character = character;
|
||||
this.order = order;
|
||||
this.department = CAST_DEPARTMENT;
|
||||
this.job = CAST_JOB;
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public PersonType getPersonType() {
|
||||
return personType;
|
||||
}
|
||||
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCharacter(String character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public void setPersonType(PersonType personType) {
|
||||
this.personType = personType;
|
||||
}
|
||||
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Person other = (Person) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.personType != other.personType) {
|
||||
return false;
|
||||
}
|
||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 37 * hash + this.id;
|
||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
|
||||
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
|
||||
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
|
||||
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Person=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[profilePath=").append(profilePath);
|
||||
sb.append("],[personType=").append(personType);
|
||||
sb.append("],[department=").append(department);
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[order=").append(order);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class PersonCast {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PersonCast.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("character")
|
||||
private String character;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("order")
|
||||
private int order;
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCharacter(String character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonCast other = (PersonCast) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.order != other.order) {
|
||||
return false;
|
||||
}
|
||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + this.id;
|
||||
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
|
||||
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 41 * hash + this.order;
|
||||
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[PersonCast=");
|
||||
sb.append("id=").append(id);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[order=").append(order);
|
||||
sb.append("],[profilePath=").append(profilePath);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class PersonCrew {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PersonCrew.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("department")
|
||||
private String department;
|
||||
@JsonProperty("job")
|
||||
private String job;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonCrew other = (PersonCrew) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 59 * hash + this.id;
|
||||
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
|
||||
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
|
||||
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[PersonCrew=");
|
||||
sb.append("id=").append(id);
|
||||
sb.append("],[department=").append(department);
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[profilePath=").append(profilePath);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("production_company")
|
||||
public class ProductionCompany {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ProductionCompany.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ProductionCompany other = (ProductionCompany) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 37 * hash + this.id;
|
||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ProductionCompany=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("production_country")
|
||||
public class ProductionCountry {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ProductionCountry.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String isoCode;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getIsoCode() {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setIsoCode(String isoCode) {
|
||||
this.isoCode = isoCode;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ProductionCountry other = (ProductionCountry) obj;
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ProductionCountry=");
|
||||
sb.append("[isoCode=").append(isoCode);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class ReleaseInfo {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ReleaseInfo.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String country;
|
||||
@JsonProperty("certification")
|
||||
private String certification;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCertification() {
|
||||
return certification;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCertification(String certification) {
|
||||
this.certification = certification;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ReleaseInfo other = (ReleaseInfo) obj;
|
||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
||||
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
|
||||
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ReleaseInfo=");
|
||||
sb.append("[country=").append(country);
|
||||
sb.append("],[certification=").append(certification);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class StatusCode {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(StatusCode.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("status_code")
|
||||
int statusCode;
|
||||
@JsonProperty("status_message")
|
||||
String statusMessage;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public String getStatusMessage() {
|
||||
return statusMessage;
|
||||
}
|
||||
|
||||
public void setStatusMessage(String statusMessage) {
|
||||
this.statusMessage = statusMessage;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Status Code: ").append(statusCode);
|
||||
sb.append(", Message: ").append(statusMessage);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.codehaus.jackson.map.annotate.JsonRootName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("images")
|
||||
public class TmdbConfiguration {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(TmdbConfiguration.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("base_url")
|
||||
private String baseUrl;
|
||||
@JsonProperty("poster_sizes")
|
||||
private List<String> posterSizes;
|
||||
@JsonProperty("backdrop_sizes")
|
||||
private List<String> backdropSizes;
|
||||
@JsonProperty("profile_sizes")
|
||||
private List<String> profileSizes;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods
|
||||
public List<String> getBackdropSizes() {
|
||||
return backdropSizes;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public List<String> getPosterSizes() {
|
||||
return posterSizes;
|
||||
}
|
||||
|
||||
public List<String> getProfileSizes() {
|
||||
return profileSizes;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods
|
||||
public void setBackdropSizes(List<String> backdropSizes) {
|
||||
this.backdropSizes = backdropSizes;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public void setPosterSizes(List<String> posterSizes) {
|
||||
this.posterSizes = posterSizes;
|
||||
}
|
||||
|
||||
public void setProfileSizes(List<String> profileSizes) {
|
||||
this.profileSizes = profileSizes;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Copy the data from the passed object to this one
|
||||
* @param config
|
||||
*/
|
||||
public void clone(TmdbConfiguration config) {
|
||||
backdropSizes = config.getBackdropSizes();
|
||||
baseUrl = config.getBaseUrl();
|
||||
posterSizes = config.getPosterSizes();
|
||||
profileSizes = config.getProfileSizes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the poster size is valid
|
||||
* @param posterSize
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidPosterSize(String posterSize) {
|
||||
return posterSizes.contains(posterSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the backdrop size is valid
|
||||
* @param backdropSize
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidBackdropSize(String backdropSize) {
|
||||
return backdropSizes.contains(backdropSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the profile size is valid
|
||||
* @param profileSize
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidProfileSize(String profileSize) {
|
||||
return profileSizes.contains(profileSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the size is valid for any of the images types
|
||||
* @param sizeToCheck
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidSize(String sizeToCheck) {
|
||||
return (isValidPosterSize(sizeToCheck) || isValidBackdropSize(sizeToCheck) || isValidProfileSize(sizeToCheck));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ImageConfiguration=");
|
||||
sb.append("[baseUrl=").append(baseUrl);
|
||||
sb.append("],[posterSizes=").append(posterSizes.toString());
|
||||
sb.append("],[backdropSizes=").append(backdropSizes.toString());
|
||||
sb.append("],[profileSizes=").append(profileSizes.toString());
|
||||
sb.append(("]]"));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Trailer {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Trailer.class);
|
||||
/*
|
||||
* Website sources
|
||||
*/
|
||||
public static final String WEBSITE_YOUTUBE = "youtube";
|
||||
public static final String WEBSITE_QUICKTIME = "quicktime";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private String name;
|
||||
private String size;
|
||||
private String source;
|
||||
private String website; // The website of the trailer
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getWebsite() {
|
||||
return website;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setSize(String size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public void setWebsite(String website) {
|
||||
this.website = website;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Trailer other = (Trailer) obj;
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.website == null) ? (other.website != null) : !this.website.equals(other.website)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
|
||||
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
|
||||
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Trailer=");
|
||||
sb.append("name=").append(name);
|
||||
sb.append("],[size=").append(size);
|
||||
sb.append("],[source=").append(source);
|
||||
sb.append("],[website=").append(website);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Translation {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Translation.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("english_name")
|
||||
private String englishName;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String isoCode;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public String getIsoCode() {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public void setIsoCode(String isoCode) {
|
||||
this.isoCode = isoCode;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Translation other = (Translation) obj;
|
||||
if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
|
||||
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Translation=");
|
||||
sb.append("[englishName=").append(englishName);
|
||||
sb.append("],[isoCode=").append(isoCode);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.tools;
|
||||
|
||||
import com.moviejukebox.themoviedb.TheMovieDB;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* The API URL that is used to construct the API call
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class ApiUrl {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(ApiUrl.class);
|
||||
/*
|
||||
* Parameter configuration
|
||||
*/
|
||||
private static final String DELIMITER_FIRST = "?";
|
||||
private static final String DELIMITER_SUBSEQUENT = "&";
|
||||
private static final String PARAMETER_API_KEY = "api_key="; // The API Key is always needed and always first
|
||||
private static final String PARAMETER_QUERY = "query=";
|
||||
private static final String PARAMETER_LANGUAGE = DELIMITER_SUBSEQUENT + "language=";
|
||||
private static final String PARAMETER_COUNTRY = DELIMITER_SUBSEQUENT + "country=";
|
||||
private static final String PARAMETER_PAGE = DELIMITER_SUBSEQUENT + "page=";
|
||||
private static final String DEFAULT_QUERY = "";
|
||||
private static final int DEFAULT_ID = -1;
|
||||
private static final String DEFAULT_LANGUAGE = "";
|
||||
private static final String DEFAULT_COUNTRY = "";
|
||||
private static final int DEFAULT_PAGE = -1;
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private String method;
|
||||
private String submethod;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Constructor Methods">
|
||||
public ApiUrl(String method) {
|
||||
this.method = method;
|
||||
this.submethod = DEFAULT_QUERY;
|
||||
}
|
||||
|
||||
public ApiUrl(String method, String submethod) {
|
||||
this.method = method;
|
||||
this.submethod = submethod;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Create the full URL with the API.
|
||||
*
|
||||
* @param query
|
||||
* @param tmdbId
|
||||
* @param language
|
||||
* @param country
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private URL getFullUrl(String query, int tmdbId, String language, String country, int page) {
|
||||
StringBuilder urlString = new StringBuilder(TheMovieDB.getApiBase());
|
||||
|
||||
// Get the start of the URL
|
||||
urlString.append(method);
|
||||
|
||||
// Append the search term if required
|
||||
if (StringUtils.isNotBlank(query)) {
|
||||
urlString.append(DELIMITER_FIRST);
|
||||
urlString.append(PARAMETER_QUERY);
|
||||
|
||||
try {
|
||||
urlString.append(URLEncoder.encode(query, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
// If we can't encode it, try it raw
|
||||
urlString.append(query);
|
||||
}
|
||||
}
|
||||
|
||||
// Append the ID if provided
|
||||
if (tmdbId > DEFAULT_ID) {
|
||||
urlString.append(tmdbId);
|
||||
}
|
||||
|
||||
// Append the suffix of the API URL
|
||||
urlString.append(submethod);
|
||||
|
||||
// Append the key information
|
||||
if (StringUtils.isBlank(query)) {
|
||||
// This is the first parameter
|
||||
urlString.append(DELIMITER_FIRST);
|
||||
} else {
|
||||
// The first parameter was the query
|
||||
urlString.append(DELIMITER_SUBSEQUENT);
|
||||
}
|
||||
urlString.append(PARAMETER_API_KEY);
|
||||
urlString.append(TheMovieDB.getApiKey());
|
||||
|
||||
// Append the language to the URL
|
||||
if (StringUtils.isNotBlank(language)) {
|
||||
urlString.append(PARAMETER_LANGUAGE);
|
||||
urlString.append(language);
|
||||
}
|
||||
|
||||
// Append the country to the URL
|
||||
if (StringUtils.isNotBlank(country)) {
|
||||
urlString.append(PARAMETER_COUNTRY);
|
||||
urlString.append(country);
|
||||
}
|
||||
|
||||
// Append the page to the URL
|
||||
if (page > DEFAULT_PAGE) {
|
||||
urlString.append(PARAMETER_PAGE);
|
||||
urlString.append(page);
|
||||
}
|
||||
|
||||
try {
|
||||
logger.trace("URL: " + urlString.toString());
|
||||
return new URL(urlString.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
logger.warn("Failed to create URL " + urlString.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an URL using a query (string) and optional language and page
|
||||
* @param query
|
||||
* @param language
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public URL getQueryUrl(String query, String language, int page) {
|
||||
return getFullUrl(query, DEFAULT_ID, language, null, page);
|
||||
}
|
||||
|
||||
public URL getQueryUrl(String query) {
|
||||
return getQueryUrl(query, DEFAULT_LANGUAGE, DEFAULT_PAGE);
|
||||
}
|
||||
|
||||
public URL getQueryUrl(String query, String language) {
|
||||
return getQueryUrl(query, language, DEFAULT_PAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an URL using the TheMovieDB ID and optional language an country codes
|
||||
* @param tmdbId
|
||||
* @param language
|
||||
* @param country
|
||||
* @return
|
||||
*/
|
||||
public URL getIdUrl(int tmdbId, String language, String country) {
|
||||
return getFullUrl(DEFAULT_QUERY, tmdbId, language, country, DEFAULT_PAGE);
|
||||
}
|
||||
|
||||
public URL getIdUrl(int tmdbId) {
|
||||
return getIdUrl(tmdbId, DEFAULT_LANGUAGE, DEFAULT_COUNTRY);
|
||||
}
|
||||
|
||||
public URL getIdUrl(int tmdbId, String language) {
|
||||
return getIdUrl(tmdbId, language, DEFAULT_COUNTRY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.tools;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PatternLayout;
|
||||
import org.apache.log4j.spi.LoggingEvent;
|
||||
|
||||
/**
|
||||
* Log4J Filtering routine to remove API keys from the output
|
||||
* @author Stuart.Boston
|
||||
*
|
||||
*/
|
||||
public class FilteringLayout extends PatternLayout {
|
||||
private static Pattern API_KEYS = Pattern.compile("DO_NOT_MATCH");
|
||||
|
||||
public static void addApiKey(String apiKey) {
|
||||
API_KEYS = Pattern.compile(apiKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the format to remove the API_KEYS from the output
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String format(LoggingEvent event) {
|
||||
if (event.getMessage() instanceof String) {
|
||||
String message = event.getRenderedMessage();
|
||||
|
||||
Matcher matcher = API_KEYS.matcher(message);
|
||||
if (matcher.find()) {
|
||||
String maskedMessage = matcher.replaceAll("[APIKEY]");
|
||||
|
||||
Throwable throwable = event.getThrowableInformation() != null ?
|
||||
event.getThrowableInformation().getThrowable() : null;
|
||||
|
||||
LoggingEvent maskedEvent = new LoggingEvent(event.fqnOfCategoryClass,
|
||||
Logger.getLogger(event.getLoggerName()), event.timeStamp,
|
||||
event.getLevel(), maskedMessage, throwable);
|
||||
|
||||
return super.format(maskedEvent);
|
||||
}
|
||||
}
|
||||
return super.format(event);
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.AlternativeTitle;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperAlternativeTitles {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperAlternativeTitles.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("titles")
|
||||
private List<AlternativeTitle> titles;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<AlternativeTitle> getTitles() {
|
||||
return titles;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTitles(List<AlternativeTitle> titles) {
|
||||
this.titles = titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.PersonCast;
|
||||
import com.moviejukebox.themoviedb.model.PersonCrew;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieCasts {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperMovieCasts.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("cast")
|
||||
private List<PersonCast> cast;
|
||||
@JsonProperty("crew")
|
||||
private List<PersonCrew> crew;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<PersonCast> getCast() {
|
||||
return cast;
|
||||
}
|
||||
|
||||
public List<PersonCrew> getCrew() {
|
||||
return crew;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCast(List<PersonCast> cast) {
|
||||
this.cast = cast;
|
||||
}
|
||||
|
||||
public void setCrew(List<PersonCrew> crew) {
|
||||
this.crew = crew;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.Artwork;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieImages {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperMovieImages.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("backdrops")
|
||||
private List<Artwork> backdrops;
|
||||
@JsonProperty("posters")
|
||||
private List<Artwork> posters;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<Artwork> getBackdrops() {
|
||||
return backdrops;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Artwork> getPosters() {
|
||||
return posters;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdrops(List<Artwork> backdrops) {
|
||||
this.backdrops = backdrops;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setPosters(List<Artwork> posters) {
|
||||
this.posters = posters;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.Keyword;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieKeywords {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperMovieKeywords.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("keywords")
|
||||
private List<Keyword> keywords;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Keyword> getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setKeywords(List<Keyword> keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.ReleaseInfo;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperReleaseInfo {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperReleaseInfo.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("countries")
|
||||
private List<ReleaseInfo> countries;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<ReleaseInfo> getCountries() {
|
||||
return countries;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCountries(List<ReleaseInfo> countries) {
|
||||
this.countries = countries;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.MovieDB;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperResultList {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperResultList.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("page")
|
||||
int page;
|
||||
@JsonProperty("results")
|
||||
List<MovieDB> results;
|
||||
@JsonProperty("total_pages")
|
||||
int totalPages;
|
||||
@JsonProperty("total_results")
|
||||
int totalResults;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<MovieDB> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public int getTotalPages() {
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
public int getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public void setResults(List<MovieDB> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public void setTotalPages(int totalPages) {
|
||||
this.totalPages = totalPages;
|
||||
}
|
||||
|
||||
public void setTotalResults(int totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
//</editor-fold>
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ResultList=[");
|
||||
sb.append("[page=").append(page);
|
||||
sb.append("],[pageResults=").append(results.size());
|
||||
sb.append("],[totalPages=").append(totalPages);
|
||||
sb.append("],[totalResults=").append(totalResults);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.Trailer;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperTrailers {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperTrailers.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("quicktime")
|
||||
private List<Trailer> quicktime;
|
||||
@JsonProperty("youtube")
|
||||
private List<Trailer> youtube;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Trailer> getQuicktime() {
|
||||
return quicktime;
|
||||
}
|
||||
|
||||
public List<Trailer> getYoutube() {
|
||||
return youtube;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setQuicktime(List<Trailer> quicktime) {
|
||||
this.quicktime = quicktime;
|
||||
}
|
||||
|
||||
public void setYoutube(List<Trailer> youtube) {
|
||||
this.youtube = youtube;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.Translation;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperTranslations {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WrapperTranslations.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private int id;
|
||||
private List<Translation> translations;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTranslations(List<Translation> translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Translation> getTranslations() {
|
||||
return translations;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
logger.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
log4j.rootLogger=DEBUG, CONSOLE
|
||||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.CONSOLE.layout=com.moviejukebox.themoviedb.tools.FilteringLayout
|
||||
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.CONSOLE.layout.ConversionPattern=[TheMovieDB API-%C{1}] %m%n
|
||||
#log4j.appender.CONSOLE.Threshold=DEBUG
|
||||
log4j.appender.CONSOLE.Encoding=UTF-8
|
||||
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.*;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.*;
|
||||
|
||||
/**
|
||||
* Test cases for TheMovieDB API
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TheMovieDBTest {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TheMovieDBTest.class);
|
||||
private static final String API_KEY = "5a1a77e2eba8984804586122754f969f";
|
||||
private static TheMovieDB tmdb;
|
||||
/*
|
||||
* Test data
|
||||
*/
|
||||
private static final int ID_BLADE_RUNNER = 78;
|
||||
private static final int ID_STAR_WARS_COLLECTION = 10;
|
||||
|
||||
public TheMovieDBTest() throws IOException {
|
||||
tmdb = new TheMovieDB(API_KEY);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() throws Exception {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getConfiguration method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testConfiguration() throws IOException {
|
||||
logger.info("Test Configuration");
|
||||
|
||||
TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
|
||||
assertNotNull("Configuration failed", tmdbConfig);
|
||||
assertTrue("No base URL", StringUtils.isNotBlank(tmdbConfig.getBaseUrl()));
|
||||
assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0);
|
||||
assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0);
|
||||
assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0);
|
||||
logger.info(tmdbConfig.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchMovie method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchMovie() throws UnsupportedEncodingException {
|
||||
logger.info("searchMovie");
|
||||
|
||||
// Try a movie with less than 1 page of results
|
||||
List<MovieDB> movieList = tmdb.searchMovie("Blade Runner", "", true);
|
||||
assertTrue("No movies found, should be at least 1", movieList.size() > 0);
|
||||
|
||||
// Try a russian langugage movie
|
||||
movieList = tmdb.searchMovie("О чём говорят мужчины", "ru", true);
|
||||
assertTrue("No movies found, should be at least 1", movieList.size() > 0);
|
||||
|
||||
// Try a movie with more than 20 results
|
||||
movieList = tmdb.searchMovie("Star Wars", "en", false);
|
||||
assertTrue("Not enough movies found, should be 20", movieList.size() == 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieInfo method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieInfo() {
|
||||
logger.info("getMovieInfo");
|
||||
String language = "en";
|
||||
MovieDB result = tmdb.getMovieInfo(ID_BLADE_RUNNER, language);
|
||||
assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieAlternativeTitles method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieAlternativeTitles() {
|
||||
logger.info("getMovieAlternativeTitles");
|
||||
String country = "";
|
||||
List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_BLADE_RUNNER, country);
|
||||
assertTrue("No alternative titles found", results.size() > 0);
|
||||
|
||||
country = "US";
|
||||
results = tmdb.getMovieAlternativeTitles(ID_BLADE_RUNNER, country);
|
||||
assertTrue("No alternative titles found", results.size() > 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieCasts method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieCasts() {
|
||||
logger.info("getMovieCasts");
|
||||
List<Person> people = tmdb.getMovieCasts(ID_BLADE_RUNNER);
|
||||
assertTrue("No cast information", people.size() > 0);
|
||||
|
||||
String name1 = "Harrison Ford";
|
||||
String name2 = "Charles Knode";
|
||||
boolean foundName1 = Boolean.FALSE;
|
||||
boolean foundName2 = Boolean.FALSE;
|
||||
|
||||
for (Person person : people) {
|
||||
if (!foundName1 && person.getName().equalsIgnoreCase(name1)) {
|
||||
foundName1 = Boolean.TRUE;
|
||||
}
|
||||
|
||||
if (!foundName2 && person.getName().equalsIgnoreCase(name2)) {
|
||||
foundName2 = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
assertTrue("Couldn't find " + name1, foundName1);
|
||||
assertTrue("Couldn't find " + name2, foundName2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieImages method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieImages() {
|
||||
logger.info("getMovieImages");
|
||||
String language = "";
|
||||
List<Artwork> result = tmdb.getMovieImages(ID_BLADE_RUNNER, language);
|
||||
assertFalse("No artwork found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieKeywords method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieKeywords() {
|
||||
logger.info("getMovieKeywords");
|
||||
List<Keyword> result = tmdb.getMovieKeywords(ID_BLADE_RUNNER);
|
||||
assertFalse("No keywords found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieReleaseInfo method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieReleaseInfo() {
|
||||
logger.info("getMovieReleaseInfo");
|
||||
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_BLADE_RUNNER, "");
|
||||
assertFalse("Release information missing", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieTrailers method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieTrailers() {
|
||||
logger.info("getMovieTrailers");
|
||||
List<Trailer> result = tmdb.getMovieTrailers(ID_BLADE_RUNNER, "");
|
||||
assertFalse("Movie trailers missing", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieTranslations method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieTranslations() {
|
||||
logger.info("getMovieTranslations");
|
||||
List<Translation> result = tmdb.getMovieTranslations(ID_BLADE_RUNNER);
|
||||
assertFalse("No translations found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCollectionInfo method, of class TheMovieDB.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCollectionInfo() {
|
||||
logger.info("getCollectionInfo");
|
||||
String language = "";
|
||||
CollectionInfo result = tmdb.getCollectionInfo(ID_STAR_WARS_COLLECTION, language);
|
||||
assertFalse("No collection information", result.getParts().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateImageUrl() {
|
||||
logger.info("createImageUrl");
|
||||
MovieDB movie = tmdb.getMovieInfo(ID_BLADE_RUNNER, "");
|
||||
String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString();
|
||||
assertTrue("Error compiling image URL", !result.isEmpty());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user