Added person methods
This commit is contained in:
@@ -26,7 +26,7 @@ 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:
|
||||
* 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
|
||||
@@ -55,7 +55,7 @@ public class TheMovieDb {
|
||||
private static final ApiUrl TMDB_MOVIE_RELEASE_INFO = new ApiUrl("movie/", "/releases");
|
||||
private static final ApiUrl TMDB_MOVIE_TRAILERS = new ApiUrl("movie/", "/trailers");
|
||||
private static final ApiUrl TMDB_MOVIE_TRANSLATIONS = new ApiUrl("movie/", "/translations");
|
||||
private static final ApiUrl TMDB_PERSON_INFO = new ApiUrl("person");
|
||||
private static final ApiUrl TMDB_PERSON_INFO = new ApiUrl("person/");
|
||||
private static final ApiUrl TMDB_PERSON_CREDITS = new ApiUrl("person/", "/credits");
|
||||
private static final ApiUrl TMDB_PERSON_IMAGES = new ApiUrl("person/", "/images");
|
||||
private static final ApiUrl TMDB_LATEST_MOVIE = new ApiUrl("latest/movie");
|
||||
@@ -67,6 +67,7 @@ public class TheMovieDb {
|
||||
|
||||
/**
|
||||
* API for The Movie Db.
|
||||
*
|
||||
* @param apiKey
|
||||
* @throws IOException
|
||||
*/
|
||||
@@ -91,15 +92,16 @@ public class TheMovieDb {
|
||||
* 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
|
||||
* TODO: Make the allResults work
|
||||
*/
|
||||
public List<MovieDB> searchMovie(String movieName, String language, boolean allResults) {
|
||||
public List<MovieDb> searchMovie(String movieName, String language, boolean allResults) {
|
||||
try {
|
||||
URL url = TMDB_SEARCH_MOVIE.getQueryUrl(movieName, language, 1);
|
||||
WrapperResultList resultList = mapper.readValue(url, WrapperResultList.class);
|
||||
return resultList.getResults();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to find movie: " + ex.getMessage());
|
||||
return new ArrayList<MovieDB>();
|
||||
return new ArrayList<MovieDb>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,14 +113,14 @@ public class TheMovieDb {
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public MovieDB getMovieInfo(int movieId, String language) {
|
||||
public MovieDb getMovieInfo(int movieId, String language) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_INFO.getIdUrl(movieId, language);
|
||||
return mapper.readValue(url, MovieDB.class);
|
||||
return mapper.readValue(url, MovieDb.class);
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get movie info: " + ex.getMessage());
|
||||
}
|
||||
return new MovieDB();
|
||||
return new MovieDb();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,14 +131,14 @@ public class TheMovieDb {
|
||||
* @param language
|
||||
* @return
|
||||
*/
|
||||
public MovieDB getMovieInfoImdb(String imdbId, String language) {
|
||||
public MovieDb getMovieInfoImdb(String imdbId, String language) {
|
||||
try {
|
||||
URL url = TMDB_MOVIE_INFO.getIdUrl(imdbId, language);
|
||||
return mapper.readValue(url, MovieDB.class);
|
||||
return mapper.readValue(url, MovieDb.class);
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get movie info: " + ex.getMessage());
|
||||
}
|
||||
return new MovieDB();
|
||||
return new MovieDb();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +161,8 @@ public class TheMovieDb {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the movie cast information.
|
||||
* This method is used to retrieve all of the movie cast information. TODO:
|
||||
* Add a function to enrich the data with the people methods
|
||||
*
|
||||
* @param movieId
|
||||
* @return
|
||||
@@ -204,7 +207,7 @@ public class TheMovieDb {
|
||||
List<Artwork> artwork = new ArrayList<Artwork>();
|
||||
try {
|
||||
URL url = TMDB_MOVIE_IMAGES.getIdUrl(movieId, language);
|
||||
WrapperMovieImages mi = mapper.readValue(url, WrapperMovieImages.class);
|
||||
WrapperImages mi = mapper.readValue(url, WrapperImages.class);
|
||||
|
||||
// Add all the posters to the list
|
||||
for (Artwork poster : mi.getPosters()) {
|
||||
@@ -368,4 +371,98 @@ public class TheMovieDb {
|
||||
|
||||
return returnUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a good starting point to start finding people on TMDb. The idea
|
||||
* is to be a quick and light method so you can iterate through people
|
||||
* quickly. TODO: Fix allResults
|
||||
*/
|
||||
public List<Person> searchPeople(String personName, boolean allResults) {
|
||||
|
||||
try {
|
||||
URL url = TMDB_SEARCH_PEOPLE.getQueryUrl(personName, "", 1);
|
||||
WrapperPerson resultList = mapper.readValue(url, WrapperPerson.class);
|
||||
return resultList.getResults();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to find person: " + ex.getMessage());
|
||||
return new ArrayList<Person>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the basic person information. It
|
||||
* will return the single highest rated profile image.
|
||||
*
|
||||
* @param personId
|
||||
* @return
|
||||
*/
|
||||
public Person getPersonInfo(int personId) {
|
||||
try {
|
||||
URL url = TMDB_PERSON_INFO.getIdUrl(personId);
|
||||
return mapper.readValue(url, Person.class);
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get movie info: " + ex.getMessage());
|
||||
return new Person();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the cast & crew information for
|
||||
* the person. It will return the single highest rated poster for each movie
|
||||
* record.
|
||||
*
|
||||
* @param personId
|
||||
* @return
|
||||
*/
|
||||
public List<PersonCredit> getPersonCredits(int personId) {
|
||||
List<PersonCredit> personCredits = new ArrayList<PersonCredit>();
|
||||
|
||||
try {
|
||||
URL url = TMDB_PERSON_CREDITS.getIdUrl(personId);
|
||||
WrapperPersonCredits pc = mapper.readValue(url, WrapperPersonCredits.class);
|
||||
|
||||
// Add a cast member
|
||||
for (PersonCredit cast : pc.getCast()) {
|
||||
cast.setPersonType(PersonType.CAST);
|
||||
personCredits.add(cast);
|
||||
}
|
||||
|
||||
// Add a crew member
|
||||
for (PersonCredit crew : pc.getCrew()) {
|
||||
crew.setPersonType(PersonType.CREW);
|
||||
personCredits.add(crew);
|
||||
}
|
||||
|
||||
return personCredits;
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get person credits: " + ex.getMessage());
|
||||
return personCredits;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to retrieve all of the profile images for a person.
|
||||
*
|
||||
* @param personId
|
||||
* @return
|
||||
*/
|
||||
public List<Artwork> getPersonImages(int personId) {
|
||||
List<Artwork> personImages = new ArrayList<Artwork>();
|
||||
|
||||
try {
|
||||
URL url = TMDB_PERSON_IMAGES.getIdUrl(personId);
|
||||
WrapperImages images = mapper.readValue(url, WrapperImages.class);
|
||||
|
||||
// Update the image type
|
||||
for (Artwork artwork : images.getProfiles()) {
|
||||
artwork.setArtworkType(ArtworkType.PROFILE);
|
||||
personImages.add(artwork);
|
||||
}
|
||||
|
||||
return personImages;
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to get person images: " + ex.getMessage());
|
||||
return personImages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
* The artwork type information
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Artwork {
|
||||
@@ -115,6 +116,7 @@ public class Artwork {
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
|
||||
@@ -17,5 +17,7 @@ package com.moviejukebox.themoviedb.model;
|
||||
*/
|
||||
public enum ArtworkType {
|
||||
|
||||
POSTER, BACKDROP
|
||||
POSTER, // Poster artwork
|
||||
BACKDROP, // Fanart/backdrop
|
||||
PROFILE // Person image
|
||||
}
|
||||
|
||||
@@ -1,407 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.model;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
/**
|
||||
* Movie Bean
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class MovieDB {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOGGER = Logger.getLogger(MovieDB.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty(("backdrop_path"))
|
||||
private String backdropPath;
|
||||
@JsonProperty(("id"))
|
||||
private int id;
|
||||
@JsonProperty(("original_title"))
|
||||
private String originalTitle;
|
||||
@JsonProperty(("popularity"))
|
||||
private float popularity;
|
||||
@JsonProperty(("poster_path"))
|
||||
private String posterPath;
|
||||
@JsonProperty(("release_date"))
|
||||
private String releaseDate;
|
||||
@JsonProperty(("title"))
|
||||
private String title;
|
||||
@JsonProperty("adult")
|
||||
private boolean adult;
|
||||
@JsonProperty("belongs_to_collection")
|
||||
private Collection belongsToCollection;
|
||||
@JsonProperty("budget")
|
||||
private int budget;
|
||||
@JsonProperty("genres")
|
||||
private List<Genre> genres;
|
||||
@JsonProperty("homepage")
|
||||
private String homepage;
|
||||
@JsonProperty("imdb_id")
|
||||
private String imdbID;
|
||||
@JsonProperty("overview")
|
||||
private String overview;
|
||||
@JsonProperty("production_companies")
|
||||
private List<ProductionCompany> productionCompanies;
|
||||
@JsonProperty("production_countries")
|
||||
private List<ProductionCountry> productionCountries;
|
||||
@JsonProperty("revenue")
|
||||
private int revenue;
|
||||
@JsonProperty("runtime")
|
||||
private int runtime;
|
||||
@JsonProperty("spoken_languages")
|
||||
private List<Language> spokenLanguages;
|
||||
@JsonProperty("tagline")
|
||||
private String tagline;
|
||||
@JsonProperty("vote_average")
|
||||
private float voteAverage;
|
||||
@JsonProperty("vote_count")
|
||||
private int voteCount;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getOriginalTitle() {
|
||||
return originalTitle;
|
||||
}
|
||||
|
||||
public float getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public Collection getBelongsToCollection() {
|
||||
return belongsToCollection;
|
||||
}
|
||||
|
||||
public int getBudget() {
|
||||
return budget;
|
||||
}
|
||||
|
||||
public List<Genre> getGenres() {
|
||||
return genres;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
|
||||
public String getImdbID() {
|
||||
return imdbID;
|
||||
}
|
||||
|
||||
public String getOverview() {
|
||||
return overview;
|
||||
}
|
||||
|
||||
public List<ProductionCompany> getProductionCompanies() {
|
||||
return productionCompanies;
|
||||
}
|
||||
|
||||
public List<ProductionCountry> getProductionCountries() {
|
||||
return productionCountries;
|
||||
}
|
||||
|
||||
public int getRevenue() {
|
||||
return revenue;
|
||||
}
|
||||
|
||||
public int getRuntime() {
|
||||
return runtime;
|
||||
}
|
||||
|
||||
public List<Language> getSpokenLanguages() {
|
||||
return spokenLanguages;
|
||||
}
|
||||
|
||||
public String getTagline() {
|
||||
return tagline;
|
||||
}
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setOriginalTitle(String originalTitle) {
|
||||
this.originalTitle = originalTitle;
|
||||
}
|
||||
|
||||
public void setPopularity(float popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
|
||||
public void setBelongsToCollection(Collection belongsToCollection) {
|
||||
this.belongsToCollection = belongsToCollection;
|
||||
}
|
||||
|
||||
public void setBudget(int budget) {
|
||||
this.budget = budget;
|
||||
}
|
||||
|
||||
public void setGenres(List<Genre> genres) {
|
||||
this.genres = genres;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
|
||||
public void setImdbID(String imdbID) {
|
||||
this.imdbID = imdbID;
|
||||
}
|
||||
|
||||
public void setOverview(String overview) {
|
||||
this.overview = overview;
|
||||
}
|
||||
|
||||
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
|
||||
this.productionCompanies = productionCompanies;
|
||||
}
|
||||
|
||||
public void setProductionCountries(List<ProductionCountry> productionCountries) {
|
||||
this.productionCountries = productionCountries;
|
||||
}
|
||||
|
||||
public void setRevenue(int revenue) {
|
||||
this.revenue = revenue;
|
||||
}
|
||||
|
||||
public void setRuntime(int runtime) {
|
||||
this.runtime = runtime;
|
||||
}
|
||||
|
||||
public void setSpokenLanguages(List<Language> spokenLanguages) {
|
||||
this.spokenLanguages = spokenLanguages;
|
||||
}
|
||||
|
||||
public void setTagline(String tagline) {
|
||||
this.tagline = tagline;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOGGER.warn(sb.toString());
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final MovieDB other = (MovieDB) obj;
|
||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.originalTitle == null) ? (other.originalTitle != null) : !this.originalTitle.equals(other.originalTitle)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(this.popularity) != Float.floatToIntBits(other.popularity)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.posterPath == null) ? (other.posterPath != null) : !this.posterPath.equals(other.posterPath)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
if (this.adult != other.adult) {
|
||||
return false;
|
||||
}
|
||||
if (this.belongsToCollection != other.belongsToCollection && (this.belongsToCollection == null || !this.belongsToCollection.equals(other.belongsToCollection))) {
|
||||
return false;
|
||||
}
|
||||
if (this.budget != other.budget) {
|
||||
return false;
|
||||
}
|
||||
if (this.genres != other.genres && (this.genres == null || !this.genres.equals(other.genres))) {
|
||||
return false;
|
||||
}
|
||||
if ((this.homepage == null) ? (other.homepage != null) : !this.homepage.equals(other.homepage)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.overview == null) ? (other.overview != null) : !this.overview.equals(other.overview)) {
|
||||
return false;
|
||||
}
|
||||
if (this.productionCompanies != other.productionCompanies && (this.productionCompanies == null || !this.productionCompanies.equals(other.productionCompanies))) {
|
||||
return false;
|
||||
}
|
||||
if (this.productionCountries != other.productionCountries && (this.productionCountries == null || !this.productionCountries.equals(other.productionCountries))) {
|
||||
return false;
|
||||
}
|
||||
if (this.revenue != other.revenue) {
|
||||
return false;
|
||||
}
|
||||
if (this.runtime != other.runtime) {
|
||||
return false;
|
||||
}
|
||||
if (this.spokenLanguages != other.spokenLanguages && (this.spokenLanguages == null || !this.spokenLanguages.equals(other.spokenLanguages))) {
|
||||
return false;
|
||||
}
|
||||
if ((this.tagline == null) ? (other.tagline != null) : !this.tagline.equals(other.tagline)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(this.voteAverage) != Float.floatToIntBits(other.voteAverage)) {
|
||||
return false;
|
||||
}
|
||||
if (this.voteCount != other.voteCount) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 97 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
||||
hash = 97 * hash + this.id;
|
||||
hash = 97 * hash + (this.originalTitle != null ? this.originalTitle.hashCode() : 0);
|
||||
hash = 97 * hash + Float.floatToIntBits(this.popularity);
|
||||
hash = 97 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
||||
hash = 97 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
hash = 97 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
hash = 97 * hash + (this.adult ? 1 : 0);
|
||||
hash = 97 * hash + (this.belongsToCollection != null ? this.belongsToCollection.hashCode() : 0);
|
||||
hash = 97 * hash + this.budget;
|
||||
hash = 97 * hash + (this.genres != null ? this.genres.hashCode() : 0);
|
||||
hash = 97 * hash + (this.homepage != null ? this.homepage.hashCode() : 0);
|
||||
hash = 97 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
|
||||
hash = 97 * hash + (this.overview != null ? this.overview.hashCode() : 0);
|
||||
hash = 97 * hash + (this.productionCompanies != null ? this.productionCompanies.hashCode() : 0);
|
||||
hash = 97 * hash + (this.productionCountries != null ? this.productionCountries.hashCode() : 0);
|
||||
hash = 97 * hash + this.revenue;
|
||||
hash = 97 * hash + this.runtime;
|
||||
hash = 97 * hash + (this.spokenLanguages != null ? this.spokenLanguages.hashCode() : 0);
|
||||
hash = 97 * hash + (this.tagline != null ? this.tagline.hashCode() : 0);
|
||||
hash = 97 * hash + Float.floatToIntBits(this.voteAverage);
|
||||
hash = 97 * hash + this.voteCount;
|
||||
return hash;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[MovieDB=");
|
||||
sb.append("[backdropPath=").append(backdropPath);
|
||||
sb.append("],[id=").append(id);
|
||||
sb.append("],[originalTitle=").append(originalTitle);
|
||||
sb.append("],[popularity=").append(popularity);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("],[adult=").append(adult);
|
||||
sb.append("],[belongsToCollection=").append(belongsToCollection);
|
||||
sb.append("],[budget=").append(budget);
|
||||
sb.append("],[genres=").append(genres);
|
||||
sb.append("],[homepage=").append(homepage);
|
||||
sb.append("],[imdbID=").append(imdbID);
|
||||
sb.append("],[overview=").append(overview);
|
||||
sb.append("],[productionCompanies=").append(productionCompanies);
|
||||
sb.append("],[productionCountries=").append(productionCountries);
|
||||
sb.append("],[revenue=").append(revenue);
|
||||
sb.append("],[runtime=").append(runtime);
|
||||
sb.append("],[spokenLanguages=").append(spokenLanguages);
|
||||
sb.append("],[tagline=").append(tagline);
|
||||
sb.append("],[voteAverage=").append(voteAverage);
|
||||
sb.append("],[voteCount=").append(voteCount);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,11 @@
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -31,25 +34,39 @@ public class Person {
|
||||
*/
|
||||
private static final String CAST_DEPARTMENT = "acting";
|
||||
private static final String CAST_JOB = "actor";
|
||||
private static final String DEFAULT_STRING = "";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id = -1;
|
||||
@JsonProperty("name")
|
||||
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
|
||||
}
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath = DEFAULT_STRING;
|
||||
private PersonType personType = PersonType.PERSON;
|
||||
private String department = DEFAULT_STRING; // Crew
|
||||
private String job = DEFAULT_STRING; // Crew
|
||||
private String character = DEFAULT_STRING; // Cast
|
||||
private int order = -1; // Cast
|
||||
@JsonProperty("adult")
|
||||
private boolean adult = false; // Person info
|
||||
@JsonProperty("also_known_as")
|
||||
private List<String> aka = new ArrayList<String>();
|
||||
@JsonProperty("biography")
|
||||
private String biography = DEFAULT_STRING;
|
||||
@JsonProperty("birthday")
|
||||
private String birthday = DEFAULT_STRING;
|
||||
@JsonProperty("deathday")
|
||||
private String deathday = DEFAULT_STRING;
|
||||
@JsonProperty("homepage")
|
||||
private String homepage = DEFAULT_STRING;
|
||||
@JsonProperty("place_of_birth")
|
||||
private String birthplace = DEFAULT_STRING;
|
||||
|
||||
/**
|
||||
* Add a crew member
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param profilePath
|
||||
@@ -69,6 +86,7 @@ public class Person {
|
||||
|
||||
/**
|
||||
* Add a cast member
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param profilePath
|
||||
@@ -118,6 +136,34 @@ public class Person {
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public List<String> getAka() {
|
||||
return aka;
|
||||
}
|
||||
|
||||
public String getBiography() {
|
||||
return biography;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public String getBirthplace() {
|
||||
return birthplace;
|
||||
}
|
||||
|
||||
public String getDeathday() {
|
||||
return deathday;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
@@ -152,10 +198,39 @@ public class Person {
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
|
||||
public void setAka(List<String> aka) {
|
||||
this.aka = aka;
|
||||
}
|
||||
|
||||
public void setBiography(String biography) {
|
||||
this.biography = biography;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public void setBirthplace(String birthplace) {
|
||||
this.birthplace = birthplace;
|
||||
}
|
||||
|
||||
public void setDeathday(String deathday) {
|
||||
this.deathday = deathday;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@@ -224,6 +299,13 @@ public class Person {
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[order=").append(order);
|
||||
sb.append("],[adult=").append(adult);
|
||||
sb.append("],[=aka").append(aka.toString());
|
||||
sb.append("],[biography=").append(biography);
|
||||
sb.append("],[birthday=").append(birthday);
|
||||
sb.append("],[deathday=").append(deathday);
|
||||
sb.append("],[homepage=").append(homepage);
|
||||
sb.append("],[birthplace=").append(birthplace);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* 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.boston
|
||||
*/
|
||||
public class PersonCredit {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(PersonCredit.class);
|
||||
private static final String DEFAULT_STRING = "";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int movieId = 0;
|
||||
@JsonProperty("character")
|
||||
private String character = DEFAULT_STRING;
|
||||
@JsonProperty("original_title")
|
||||
private String movieOriginalTitle = DEFAULT_STRING;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath = DEFAULT_STRING;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate = DEFAULT_STRING;
|
||||
@JsonProperty("title")
|
||||
private String movieTitle = DEFAULT_STRING;
|
||||
@JsonProperty("department")
|
||||
private String department = DEFAULT_STRING;
|
||||
@JsonProperty("job")
|
||||
private String job = DEFAULT_STRING;
|
||||
private PersonType personType = PersonType.PERSON;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public int getMovieId() {
|
||||
return movieId;
|
||||
}
|
||||
|
||||
public String getMovieOriginalTitle() {
|
||||
return movieOriginalTitle;
|
||||
}
|
||||
|
||||
public String getMovieTitle() {
|
||||
return movieTitle;
|
||||
}
|
||||
|
||||
public PersonType getPersonType() {
|
||||
return personType;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setCharacter(String character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void setMovieId(int movieId) {
|
||||
this.movieId = movieId;
|
||||
}
|
||||
|
||||
public void setMovieOriginalTitle(String movieOriginalTitle) {
|
||||
this.movieOriginalTitle = movieOriginalTitle;
|
||||
}
|
||||
|
||||
public void setMovieTitle(String movieTitle) {
|
||||
this.movieTitle = movieTitle;
|
||||
}
|
||||
|
||||
public void setPersonType(PersonType personType) {
|
||||
this.personType = personType;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOGGER.warn(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[PersonCredit=");
|
||||
sb.append("[movieId=").append(movieId);
|
||||
sb.append("],[personType=").append(personType);
|
||||
sb.append("],[originalTitle=").append(movieOriginalTitle);
|
||||
sb.append("],[movieTitle=").append(movieTitle);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[department=").append(department);
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public enum PersonType {
|
||||
|
||||
CAST, // A member of the cast
|
||||
CREW, // A member of the crew
|
||||
PERSON // No specific type
|
||||
}
|
||||
+21
-10
@@ -22,12 +22,12 @@ import org.codehaus.jackson.annotate.JsonProperty;
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieImages {
|
||||
public class WrapperImages {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(WrapperMovieImages.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(WrapperImages.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@@ -37,37 +37,48 @@ public class WrapperMovieImages {
|
||||
private List<Artwork> backdrops;
|
||||
@JsonProperty("posters")
|
||||
private List<Artwork> posters;
|
||||
@JsonProperty("profiles")
|
||||
private List<Artwork> profiles;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<Artwork> getBackdrops() {
|
||||
return backdrops;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Artwork> getBackdrops() {
|
||||
return backdrops;
|
||||
}
|
||||
|
||||
public List<Artwork> getPosters() {
|
||||
return posters;
|
||||
}
|
||||
|
||||
public List<Artwork> getProfiles() {
|
||||
return profiles;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdrops(List<Artwork> backdrops) {
|
||||
this.backdrops = backdrops;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setBackdrops(List<Artwork> backdrops) {
|
||||
this.backdrops = backdrops;
|
||||
}
|
||||
|
||||
public void setPosters(List<Artwork> posters) {
|
||||
this.posters = posters;
|
||||
}
|
||||
|
||||
public void setProfiles(List<Artwork> profiles) {
|
||||
this.profiles = profiles;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.Person;
|
||||
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 WrapperPerson {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(WrapperPerson.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("page")
|
||||
private int page;
|
||||
@JsonProperty("results")
|
||||
private List<Person> results;
|
||||
@JsonProperty("total_pages")
|
||||
private int totalPages;
|
||||
@JsonProperty("total_results")
|
||||
private int totalResults;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<Person> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public int getTotalPages() {
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
public int getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public void setResults(List<Person> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public void setTotalPages(int totalPages) {
|
||||
this.totalPages = totalPages;
|
||||
}
|
||||
|
||||
public void setTotalResults(int totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOGGER.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2012 YAMJ Members
|
||||
* http://code.google.com/p/moviejukebox/people/list
|
||||
*
|
||||
* Web: http://code.google.com/p/moviejukebox/
|
||||
*
|
||||
* This software is licensed under a Creative Commons License
|
||||
* See this page: http://code.google.com/p/moviejukebox/wiki/License
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the
|
||||
* license terms of this work.
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.PersonCredit;
|
||||
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 WrapperPersonCredits {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(WrapperMovieCasts.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("cast")
|
||||
private List<PersonCredit> cast;
|
||||
@JsonProperty("crew")
|
||||
private List<PersonCredit> crew;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<PersonCredit> getCast() {
|
||||
return cast;
|
||||
}
|
||||
|
||||
public List<PersonCredit> getCrew() {
|
||||
return crew;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCast(List<PersonCredit> cast) {
|
||||
this.cast = cast;
|
||||
}
|
||||
|
||||
public void setCrew(List<PersonCredit> crew) {
|
||||
this.crew = crew;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOGGER.warn(sb.toString());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
package com.moviejukebox.themoviedb.wrapper;
|
||||
|
||||
import com.moviejukebox.themoviedb.model.MovieDB;
|
||||
import com.moviejukebox.themoviedb.model.MovieDb;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.jackson.annotate.JsonAnySetter;
|
||||
@@ -34,7 +34,7 @@ public class WrapperResultList {
|
||||
@JsonProperty("page")
|
||||
private int page;
|
||||
@JsonProperty("results")
|
||||
private List<MovieDB> results;
|
||||
private List<MovieDb> results;
|
||||
@JsonProperty("total_pages")
|
||||
private int totalPages;
|
||||
@JsonProperty("total_results")
|
||||
@@ -45,7 +45,7 @@ public class WrapperResultList {
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<MovieDB> getResults() {
|
||||
public List<MovieDb> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class WrapperResultList {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public void setResults(List<MovieDB> results) {
|
||||
public void setResults(List<MovieDb> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public class TheMovieDbTest {
|
||||
*/
|
||||
private static final int ID_BLADE_RUNNER = 78;
|
||||
private static final int ID_STAR_WARS_COLLECTION = 10;
|
||||
private static final int ID_BRUCE_WILLIS = 62;
|
||||
|
||||
public TheMovieDbTest() throws IOException {
|
||||
tmdb = new TheMovieDb(API_KEY);
|
||||
@@ -60,7 +61,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getConfiguration method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testConfiguration() throws IOException {
|
||||
LOGGER.info("Test Configuration");
|
||||
|
||||
@@ -76,12 +77,12 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of searchMovie method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testSearchMovie() throws UnsupportedEncodingException {
|
||||
LOGGER.info("searchMovie");
|
||||
|
||||
// Try a movie with less than 1 page of results
|
||||
List<MovieDB> movieList = tmdb.searchMovie("Blade Runner", "", true);
|
||||
List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", "", true);
|
||||
assertTrue("No movies found, should be at least 1", movieList.size() > 0);
|
||||
|
||||
// Try a russian langugage movie
|
||||
@@ -96,18 +97,18 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieInfo method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieInfo() {
|
||||
LOGGER.info("getMovieInfo");
|
||||
String language = "en";
|
||||
MovieDB result = tmdb.getMovieInfo(ID_BLADE_RUNNER, language);
|
||||
MovieDb result = tmdb.getMovieInfo(ID_BLADE_RUNNER, language);
|
||||
assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieAlternativeTitles method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieAlternativeTitles() {
|
||||
LOGGER.info("getMovieAlternativeTitles");
|
||||
String country = "";
|
||||
@@ -123,7 +124,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieCasts method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieCasts() {
|
||||
LOGGER.info("getMovieCasts");
|
||||
List<Person> people = tmdb.getMovieCasts(ID_BLADE_RUNNER);
|
||||
@@ -145,13 +146,12 @@ public class TheMovieDbTest {
|
||||
}
|
||||
assertTrue("Couldn't find " + name1, foundName1);
|
||||
assertTrue("Couldn't find " + name2, foundName2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieImages method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieImages() {
|
||||
LOGGER.info("getMovieImages");
|
||||
String language = "";
|
||||
@@ -162,7 +162,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieKeywords method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieKeywords() {
|
||||
LOGGER.info("getMovieKeywords");
|
||||
List<Keyword> result = tmdb.getMovieKeywords(ID_BLADE_RUNNER);
|
||||
@@ -172,7 +172,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieReleaseInfo method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieReleaseInfo() {
|
||||
LOGGER.info("getMovieReleaseInfo");
|
||||
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_BLADE_RUNNER, "");
|
||||
@@ -182,7 +182,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieTrailers method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieTrailers() {
|
||||
LOGGER.info("getMovieTrailers");
|
||||
List<Trailer> result = tmdb.getMovieTrailers(ID_BLADE_RUNNER, "");
|
||||
@@ -192,7 +192,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieTranslations method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieTranslations() {
|
||||
LOGGER.info("getMovieTranslations");
|
||||
List<Translation> result = tmdb.getMovieTranslations(ID_BLADE_RUNNER);
|
||||
@@ -202,7 +202,7 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getCollectionInfo method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetCollectionInfo() {
|
||||
LOGGER.info("getCollectionInfo");
|
||||
String language = "";
|
||||
@@ -210,10 +210,10 @@ public class TheMovieDbTest {
|
||||
assertFalse("No collection information", result.getParts().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void testCreateImageUrl() {
|
||||
LOGGER.info("createImageUrl");
|
||||
MovieDB movie = tmdb.getMovieInfo(ID_BLADE_RUNNER, "");
|
||||
MovieDb movie = tmdb.getMovieInfo(ID_BLADE_RUNNER, "");
|
||||
String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString();
|
||||
assertTrue("Error compiling image URL", !result.isEmpty());
|
||||
}
|
||||
@@ -221,11 +221,84 @@ public class TheMovieDbTest {
|
||||
/**
|
||||
* Test of getMovieInfoImdb method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
//@Test
|
||||
public void testGetMovieInfoImdb() {
|
||||
LOGGER.info("getMovieInfoImdb");
|
||||
MovieDB result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
|
||||
MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
|
||||
assertTrue("Error getting the movie from IMDB ID", result.getId() == 11);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getApiKey method, of class TheMovieDb.
|
||||
*/
|
||||
//@Test
|
||||
public void testGetApiKey() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getApiBase method, of class TheMovieDb.
|
||||
*/
|
||||
//@Test
|
||||
public void testGetApiBase() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getConfiguration method, of class TheMovieDb.
|
||||
*/
|
||||
//@Test
|
||||
public void testGetConfiguration() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchPeople method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchPeople() {
|
||||
LOGGER.info("searchPeople");
|
||||
String personName = "Bruce Willis";
|
||||
boolean allResults = false;
|
||||
List<Person> result = tmdb.searchPeople(personName, allResults);
|
||||
assertTrue("Couldn't find the person", result.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonInfo method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonInfo() {
|
||||
LOGGER.info("getPersonInfo");
|
||||
Person result = tmdb.getPersonInfo(ID_BRUCE_WILLIS);
|
||||
assertTrue("Wrong actor returned", result.getId() == ID_BRUCE_WILLIS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonCredits method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonCredits() {
|
||||
LOGGER.info("getPersonCredits");
|
||||
|
||||
List<PersonCredit> people = tmdb.getPersonCredits(ID_BRUCE_WILLIS);
|
||||
assertTrue("No cast information", people.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonImages method, of class TheMovieDb.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonImages() {
|
||||
LOGGER.info("getPersonImages");
|
||||
|
||||
List<Artwork> artwork = tmdb.getPersonImages(ID_BRUCE_WILLIS);
|
||||
assertTrue("No cast information", artwork.size() > 0);
|
||||
|
||||
for(Artwork a:artwork) {
|
||||
LOGGER.info(" " + a.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user