diff --git a/themoviedbapi/pom.xml b/themoviedbapi/pom.xml
index b50c54a0d..22362ab20 100644
--- a/themoviedbapi/pom.xml
+++ b/themoviedbapi/pom.xml
@@ -40,9 +40,24 @@
junit
- commons-codec
- commons-codec
- 1.6
+ commons-lang
+ commons-lang
+ 2.6
+
+
+ log4j
+ log4j
+ 1.2.16
+
+
+ org.codehaus.jackson
+ jackson-core-lgpl
+ 1.9.4
+
+
+ org.codehaus.jackson
+ jackson-mapper-lgpl
+ 1.9.4
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDB.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDB.java
new file mode 100644
index 000000000..1fb78a653
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDB.java
@@ -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 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();
+ }
+ }
+
+ /**
+ * 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 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();
+ }
+
+ /**
+ * This method is used to retrieve all of the movie cast information.
+ * @param movieId
+ * @return
+ */
+ public List getMovieCasts(int movieId) {
+ List people = new ArrayList();
+
+ 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 getMovieImages(int movieId, String language) {
+ List artwork = new ArrayList();
+ 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 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();
+ }
+
+ /**
+ * 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 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();
+ }
+
+ /**
+ * 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 getMovieTrailers(int movieId, String language) {
+ List trailers = new ArrayList();
+ 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 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();
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/AlternativeTitle.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/AlternativeTitle.java
new file mode 100644
index 000000000..785d863e7
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/AlternativeTitle.java
@@ -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;
+
+ //
+ public String getCountry() {
+ return country;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+ //
+
+ //
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Artwork.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Artwork.java
new file mode 100644
index 000000000..89e209bf8
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Artwork.java
@@ -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;
+
+ //
+ 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;
+ }
+ //
+
+ //
+ 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;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ArtworkType.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ArtworkType.java
new file mode 100644
index 000000000..bc8c32e63
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ArtworkType.java
@@ -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
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Collection.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Collection.java
new file mode 100644
index 000000000..778c029fb
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Collection.java
@@ -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;
+
+ //
+ 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;
+ }
+ //
+
+ //
+ 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;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/CollectionInfo.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/CollectionInfo.java
new file mode 100644
index 000000000..ec7ed245b
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/CollectionInfo.java
@@ -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 parts = new ArrayList();
+
+ //
+ public String getBackdropPath() {
+ return backdropPath;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List getParts() {
+ return parts;
+ }
+
+ public String getPosterPath() {
+ return posterPath;
+ }
+ //
+
+ //
+ 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 parts) {
+ this.parts = parts;
+ }
+
+ public void setPosterPath(String posterPath) {
+ this.posterPath = posterPath;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Genre.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Genre.java
new file mode 100644
index 000000000..9f261fe83
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Genre.java
@@ -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;
+
+ //
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+ //
+
+ //
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Keyword.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Keyword.java
new file mode 100644
index 000000000..e53c02542
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Keyword.java
@@ -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;
+
+ //
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+ //
+
+ //
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Language.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Language.java
new file mode 100644
index 000000000..4238ee0df
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Language.java
@@ -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;
+
+ //
+ public String getIsoCode() {
+ return isoCode;
+ }
+
+ public String getName() {
+ return name;
+ }
+ //
+
+ //
+ public void setIsoCode(String isoCode) {
+ this.isoCode = isoCode;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java
new file mode 100644
index 000000000..98b367228
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java
@@ -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 genres;
+ @JsonProperty("homepage")
+ private String homepage;
+ @JsonProperty("imdb_id")
+ private String imdbID;
+ @JsonProperty("overview")
+ private String overview;
+ @JsonProperty("production_companies")
+ private List productionCompanies;
+ @JsonProperty("production_countries")
+ private List productionCountries;
+ @JsonProperty("revenue")
+ private int revenue;
+ @JsonProperty("runtime")
+ private int runtime;
+ @JsonProperty("spoken_languages")
+ private List spokenLanguages;
+ @JsonProperty("tagline")
+ private String tagline;
+ @JsonProperty("vote_average")
+ private float voteAverage;
+ @JsonProperty("vote_count")
+ private int voteCount;
+
+ //
+ 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 getGenres() {
+ return genres;
+ }
+
+ public String getHomepage() {
+ return homepage;
+ }
+
+ public String getImdbID() {
+ return imdbID;
+ }
+
+ public String getOverview() {
+ return overview;
+ }
+
+ public List getProductionCompanies() {
+ return productionCompanies;
+ }
+
+ public List getProductionCountries() {
+ return productionCountries;
+ }
+
+ public int getRevenue() {
+ return revenue;
+ }
+
+ public int getRuntime() {
+ return runtime;
+ }
+
+ public List getSpokenLanguages() {
+ return spokenLanguages;
+ }
+
+ public String getTagline() {
+ return tagline;
+ }
+
+ public float getVoteAverage() {
+ return voteAverage;
+ }
+
+ public int getVoteCount() {
+ return voteCount;
+ }
+ //
+
+ //
+ 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 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 productionCompanies) {
+ this.productionCompanies = productionCompanies;
+ }
+
+ public void setProductionCountries(List productionCountries) {
+ this.productionCountries = productionCountries;
+ }
+
+ public void setRevenue(int revenue) {
+ this.revenue = revenue;
+ }
+
+ public void setRuntime(int runtime) {
+ this.runtime = runtime;
+ }
+
+ public void setSpokenLanguages(List 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;
+ }
+ //
+
+ /**
+ * 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 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;
+ }
+ //
+
+ @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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java
new file mode 100644
index 000000000..97604115f
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java
@@ -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;
+ }
+
+ //
+ 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;
+ }
+ //
+
+ //
+ 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;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/PersonCast.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/PersonCast.java
new file mode 100644
index 000000000..9eb2e5968
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/PersonCast.java
@@ -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;
+
+ //
+ 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;
+ }
+ //
+
+ //
+ 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;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/PersonCrew.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/PersonCrew.java
new file mode 100644
index 000000000..29d58cd6a
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/PersonCrew.java
@@ -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;
+
+ //
+ 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;
+ }
+ //
+
+ //
+ 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;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ProductionCompany.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ProductionCompany.java
new file mode 100644
index 000000000..978b1038c
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ProductionCompany.java
@@ -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;
+
+ //
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+ //
+
+ //
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ProductionCountry.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ProductionCountry.java
new file mode 100644
index 000000000..2b3617e69
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ProductionCountry.java
@@ -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;
+
+ //
+ public String getIsoCode() {
+ return isoCode;
+ }
+
+ public String getName() {
+ return name;
+ }
+ //
+
+ //
+ public void setIsoCode(String isoCode) {
+ this.isoCode = isoCode;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ReleaseInfo.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ReleaseInfo.java
new file mode 100644
index 000000000..e46e6fb21
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/ReleaseInfo.java
@@ -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;
+
+ //
+ public String getCertification() {
+ return certification;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public String getReleaseDate() {
+ return releaseDate;
+ }
+ //
+
+ //
+ public void setCertification(String certification) {
+ this.certification = certification;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public void setReleaseDate(String releaseDate) {
+ this.releaseDate = releaseDate;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/StatusCode.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/StatusCode.java
new file mode 100644
index 000000000..3a59038ee
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/StatusCode.java
@@ -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;
+
+ //
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public void setStatusCode(int statusCode) {
+ this.statusCode = statusCode;
+ }
+ //
+
+ //
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/TmdbConfiguration.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/TmdbConfiguration.java
new file mode 100644
index 000000000..4ce101f2b
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/TmdbConfiguration.java
@@ -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 posterSizes;
+ @JsonProperty("backdrop_sizes")
+ private List backdropSizes;
+ @JsonProperty("profile_sizes")
+ private List profileSizes;
+
+ // //GEN-BEGIN:getterMethods
+ public List getBackdropSizes() {
+ return backdropSizes;
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ public List getPosterSizes() {
+ return posterSizes;
+ }
+
+ public List getProfileSizes() {
+ return profileSizes;
+ }
+ //
+
+ // //GEN-BEGIN:setterMethods
+ public void setBackdropSizes(List backdropSizes) {
+ this.backdropSizes = backdropSizes;
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
+ public void setPosterSizes(List posterSizes) {
+ this.posterSizes = posterSizes;
+ }
+
+ public void setProfileSizes(List profileSizes) {
+ this.profileSizes = profileSizes;
+ }
+//
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Trailer.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Trailer.java
new file mode 100644
index 000000000..c41fc69b0
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Trailer.java
@@ -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
+
+ //
+ public String getName() {
+ return name;
+ }
+
+ public String getSize() {
+ return size;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public String getWebsite() {
+ return website;
+ }
+ //
+
+ //
+ 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;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Translation.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Translation.java
new file mode 100644
index 000000000..f57ceed75
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Translation.java
@@ -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;
+
+ //
+ public String getEnglishName() {
+ return englishName;
+ }
+
+ public String getIsoCode() {
+ return isoCode;
+ }
+
+ public String getName() {
+ return name;
+ }
+ //
+
+ //
+ public void setEnglishName(String englishName) {
+ this.englishName = englishName;
+ }
+
+ public void setIsoCode(String isoCode) {
+ this.isoCode = isoCode;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ //
+
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/ApiUrl.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/ApiUrl.java
new file mode 100644
index 000000000..566956f48
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/ApiUrl.java
@@ -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;
+
+ //
+ public ApiUrl(String method) {
+ this.method = method;
+ this.submethod = DEFAULT_QUERY;
+ }
+
+ public ApiUrl(String method, String submethod) {
+ this.method = method;
+ this.submethod = submethod;
+ }
+ //
+
+ /**
+ * 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);
+ }
+
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/FilteringLayout.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/FilteringLayout.java
new file mode 100644
index 000000000..8774ec2e3
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/FilteringLayout.java
@@ -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);
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperAlternativeTitles.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperAlternativeTitles.java
new file mode 100644
index 000000000..a1987b9ee
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperAlternativeTitles.java
@@ -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 titles;
+
+ public int getId() {
+ return id;
+ }
+
+ public List getTitles() {
+ return titles;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setTitles(List 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());
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieCasts.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieCasts.java
new file mode 100644
index 000000000..abd7580f9
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieCasts.java
@@ -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 cast;
+ @JsonProperty("crew")
+ private List crew;
+
+ //
+ public List getCast() {
+ return cast;
+ }
+
+ public List getCrew() {
+ return crew;
+ }
+
+ public int getId() {
+ return id;
+ }
+ //
+
+ //
+ public void setCast(List cast) {
+ this.cast = cast;
+ }
+
+ public void setCrew(List crew) {
+ this.crew = crew;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ //
+
+ /**
+ * 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());
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieImages.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieImages.java
new file mode 100644
index 000000000..2c8ae3c15
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieImages.java
@@ -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 backdrops;
+ @JsonProperty("posters")
+ private List posters;
+
+ //
+ public List getBackdrops() {
+ return backdrops;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public List getPosters() {
+ return posters;
+ }
+ //
+
+ //
+ public void setBackdrops(List backdrops) {
+ this.backdrops = backdrops;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setPosters(List posters) {
+ this.posters = posters;
+ }
+ //
+
+ /**
+ * 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());
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieKeywords.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieKeywords.java
new file mode 100644
index 000000000..9225248ed
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperMovieKeywords.java
@@ -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 keywords;
+
+ //
+ public int getId() {
+ return id;
+ }
+
+ public List getKeywords() {
+ return keywords;
+ }
+ //
+
+ //
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setKeywords(List keywords) {
+ this.keywords = keywords;
+ }
+ //
+
+ /**
+ * 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());
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperReleaseInfo.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperReleaseInfo.java
new file mode 100644
index 000000000..195168111
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperReleaseInfo.java
@@ -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 countries;
+
+ //
+ public List getCountries() {
+ return countries;
+ }
+
+ public int getId() {
+ return id;
+ }
+ //
+
+ //
+ public void setCountries(List countries) {
+ this.countries = countries;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ //
+
+ /**
+ * 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());
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperResultList.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperResultList.java
new file mode 100644
index 000000000..51ac65507
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperResultList.java
@@ -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 results;
+ @JsonProperty("total_pages")
+ int totalPages;
+ @JsonProperty("total_results")
+ int totalResults;
+
+ //
+ public int getPage() {
+ return page;
+ }
+
+ public List getResults() {
+ return results;
+ }
+
+ public int getTotalPages() {
+ return totalPages;
+ }
+
+ public int getTotalResults() {
+ return totalResults;
+ }
+ //
+
+ //
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+ public void setResults(List results) {
+ this.results = results;
+ }
+
+ public void setTotalPages(int totalPages) {
+ this.totalPages = totalPages;
+ }
+
+ public void setTotalResults(int totalResults) {
+ this.totalResults = totalResults;
+ }
+ //
+ /**
+ * 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();
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperTrailers.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperTrailers.java
new file mode 100644
index 000000000..dd36047e8
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperTrailers.java
@@ -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 quicktime;
+ @JsonProperty("youtube")
+ private List youtube;
+
+ //
+ public int getId() {
+ return id;
+ }
+
+ public List getQuicktime() {
+ return quicktime;
+ }
+
+ public List getYoutube() {
+ return youtube;
+ }
+ //
+
+ //
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setQuicktime(List quicktime) {
+ this.quicktime = quicktime;
+ }
+
+ public void setYoutube(List youtube) {
+ this.youtube = youtube;
+ }
+ //
+
+ /**
+ * 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());
+ }
+}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperTranslations.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperTranslations.java
new file mode 100644
index 000000000..dc3a995cc
--- /dev/null
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/wrapper/WrapperTranslations.java
@@ -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 translations;
+
+ //
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setTranslations(List translations) {
+ this.translations = translations;
+ }
+ //
+
+ //
+ public int getId() {
+ return id;
+ }
+
+ public List getTranslations() {
+ return translations;
+ }
+ //
+
+ /**
+ * 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());
+ }
+}
diff --git a/themoviedbapi/src/main/resources/log4j.properties b/themoviedbapi/src/main/resources/log4j.properties
new file mode 100644
index 000000000..26b472d1e
--- /dev/null
+++ b/themoviedbapi/src/main/resources/log4j.properties
@@ -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
diff --git a/themoviedbapi/src/test/java/com/moviejukebox/themoviedb/TheMovieDBTest.java b/themoviedbapi/src/test/java/com/moviejukebox/themoviedb/TheMovieDBTest.java
new file mode 100644
index 000000000..f03cbedba
--- /dev/null
+++ b/themoviedbapi/src/test/java/com/moviejukebox/themoviedb/TheMovieDBTest.java
@@ -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 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 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 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 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 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 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 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 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());
+ }
+}