More movie methods

This commit is contained in:
Stuart Boston
2015-03-03 19:56:59 +00:00
parent d80f15a52d
commit 7a9ea47d4b
16 changed files with 122 additions and 382 deletions
@@ -43,11 +43,7 @@ import com.omertron.themoviedbapi.methods.TmdbReviews;
import com.omertron.themoviedbapi.methods.TmdbSearch;
import com.omertron.themoviedbapi.methods.TmdbTV;
import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model.keyword.KeywordMovie;
import com.omertron.themoviedbapi.model2.Certification;
import com.omertron.themoviedbapi.model2.FindResults;
@@ -68,7 +64,6 @@ import com.omertron.themoviedbapi.model2.discover.Discover;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.list.ListItem;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.movie.AlternativeTitle;
import com.omertron.themoviedbapi.model2.movie.MovieBasic;
import com.omertron.themoviedbapi.model2.network.Network;
import com.omertron.themoviedbapi.model2.person.CreditInfo;
@@ -924,266 +919,7 @@ public class TheMovieDbApi {
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Movies">
/**
* This method is used to retrieve all of the basic movie information.
*
* It will return the single highest rated poster and backdrop.
*
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
* found.
*
* @param movieId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public MovieDb getMovieInfo(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieInfo(movieId, language, appendToResponse);
}
/**
* This method is used to retrieve all of the basic movie information.
*
* It will return the single highest rated poster and backdrop.
*
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
* found.
*
* @param imdbId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public MovieDb getMovieInfoImdb(String imdbId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieInfoImdb(imdbId, language, appendToResponse);
}
/**
* This method is used to retrieve all of the alternative titles we have for
* a particular movie.
*
* @param movieId
* @param country
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieAlternativeTitles(movieId, country, appendToResponse);
}
/**
* Get the cast information for a specific movie id.
*
* TODO: Add a function to enrich the data with the people methods
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<com.omertron.themoviedbapi.model.person.Person> getMovieCasts(int movieId, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieCasts(movieId, appendToResponse);
}
/**
* This method should be used when youre wanting to retrieve all of the
* images for a particular movie.
*
* @param movieId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<Artwork> getMovieImages(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieImages(movieId, language, appendToResponse);
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<Keyword> getMovieKeywords(int movieId, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieKeywords(movieId, appendToResponse);
}
/**
* This method is used to retrieve all of the release and certification data
* we have for a specific movie.
*
* @param movieId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<ReleaseInfo> getMovieReleaseInfo(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieReleaseInfo(movieId, language, appendToResponse);
}
/**
* This method is used to retrieve all of the trailers for a particular
* movie.
*
* Supported sites are YouTube and QuickTime.
*
* @param movieId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<Video> getMovieTrailers(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieVideos(movieId, language, appendToResponse);
}
/**
* This method is used to retrieve a list of the available translations for
* a specific movie.
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<Translation> getMovieTranslations(int movieId, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieTranslations(movieId, appendToResponse);
}
/**
* The similar movies method will let you retrieve the similar movies for a
* particular movie.
*
* This data is created dynamically but with the help of users votes on
* TMDb.
*
* The data is much better with movies that have more keywords
*
* @param movieId
* @param language
* @param page
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getSimilarMovies(int movieId, String language, Integer page, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getSimilarMovies(movieId, page, language, appendToResponse);
}
/**
* Get the lists that the movie belongs to
*
* @param movieId
* @param language
* @param page
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieList> getMovieLists(int movieId, String language, Integer page, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieLists(movieId, page, language, appendToResponse);
}
/**
* This method is used to retrieve the newest movie that was added to TMDb.
*
* @return
* @throws MovieDbException
*/
public MovieDb getLatestMovie() throws MovieDbException {
return tmdbMovies.getLatestMovie();
}
/**
* Get the list of upcoming movies.
*
* This list refreshes every day.
*
* The maximum number of items this list will include is 100.
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getUpcoming(String language, Integer page) throws MovieDbException {
return tmdbMovies.getUpcoming(page, language);
}
/**
* This method is used to retrieve the movies currently in theatres.
*
* This is a curated list that will normally contain 100 movies. The default
* response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getNowPlayingMovies(String language, Integer page) throws MovieDbException {
return tmdbMovies.getNowPlayingMovies(page, language);
}
/**
* This method is used to retrieve the daily movie popularity list.
*
* This list is updated daily. The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getPopularMovieList(String language, Integer page) throws MovieDbException {
return tmdbMovies.getPopularMovieList(page, language);
}
/**
* This method is used to retrieve the top rated movies that have over 10
* votes on TMDb.
*
* The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getTopRatedMovies(String language, Integer page) throws MovieDbException {
return tmdbMovies.getTopRatedMovies(page, language);
}
/**
* This method lets users rate a movie.
*
* A valid session id is required.
*
* @param sessionId
* @param movieId
* @param rating
* @return
* @throws MovieDbException
*/
public boolean postMovieRating(String sessionId, Integer movieId, Integer rating) throws MovieDbException {
return tmdbMovies.postMovieRating(sessionId, movieId, rating);
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Networks">
@@ -22,7 +22,7 @@ package com.omertron.themoviedbapi.methods;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.collection.Collection;
import com.omertron.themoviedbapi.model2.company.Company;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
@@ -22,7 +22,7 @@ package com.omertron.themoviedbapi.methods;
import com.fasterxml.jackson.core.type.TypeReference;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.ListItemStatus;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model.MovieDbListStatus;
import com.omertron.themoviedbapi.model2.StatusCode;
import com.omertron.themoviedbapi.model2.list.ListItem;
@@ -130,8 +130,7 @@ public class TmdbLists extends AbstractMethod {
}
/**
* This method lets users delete a list that they created. A valid session
* id is required.
* This method lets users delete a list that they created. A valid session id is required.
*
* @param sessionId
* @param listId
@@ -219,8 +218,7 @@ public class TmdbLists extends AbstractMethod {
*
* This is a irreversible action and should be treated with caution.
*
* A valid session id is required. A call without confirm=true will return
* status code 29.
* A valid session id is required. A call without confirm=true will return status code 29.
*
* @param sessionId
* @param listId
@@ -20,15 +20,15 @@
package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model2.movie.Translation;
import com.omertron.themoviedbapi.model2.movie.Video;
import com.omertron.themoviedbapi.model2.media.MediaState;
import com.omertron.themoviedbapi.model2.StatusCode;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.media.MediaCreditList;
import com.omertron.themoviedbapi.model2.movie.AlternativeTitle;
import com.omertron.themoviedbapi.results.TmdbResultsList;
@@ -44,12 +44,12 @@ import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
import com.omertron.themoviedbapi.wrapper.WrapperImages;
import com.omertron.themoviedbapi.wrapper.WrapperMovie;
import com.omertron.themoviedbapi.wrapper.WrapperMovieKeywords;
import com.omertron.themoviedbapi.wrapper.WrapperMovieList;
import com.omertron.themoviedbapi.wrapper.WrapperReleaseInfo;
import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
import com.omertron.themoviedbapi.wrapper.WrapperVideos;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import org.yamj.api.common.exception.ApiExceptionType;
/**
@@ -77,8 +77,7 @@ public class TmdbMovies extends AbstractMethod {
*
* It will return the single highest rated poster and backdrop.
*
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
* found.
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found.
*
* @param movieId
* @param language
@@ -110,8 +109,7 @@ public class TmdbMovies extends AbstractMethod {
*
* It will return the single highest rated poster and backdrop.
*
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
* found.
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found.
*
* @param imdbId
* @param language
@@ -140,8 +138,8 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method lets a user get the status of whether or not the movie has
* been rated or added to their favourite or movie watch list.
* This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch
* list.
*
* A valid session id is required.
*
@@ -166,8 +164,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve all of the alternative titles we have for
* a particular movie.
* This method is used to retrieve all of the alternative titles we have for a particular movie.
*
* @param movieId
* @param country
@@ -216,8 +213,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method should be used when youre wanting to retrieve all of the
* images for a particular movie.
* This method should be used when youre wanting to retrieve all of the images for a particular movie.
*
* @param movieId
* @param language
@@ -245,8 +241,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve all of the keywords that have been added
* to a particular movie.
* This method is used to retrieve all of the keywords that have been added to a particular movie.
*
* Currently, only English keywords exist.
*
@@ -274,8 +269,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve all of the release and certification data
* we have for a specific movie.
* This method is used to retrieve all of the release and certification data we have for a specific movie.
*
* @param movieId
* @param language
@@ -303,8 +297,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve all of the trailers for a particular
* movie.
* This method is used to retrieve all of the trailers for a particular movie.
*
* Supported sites are YouTube and QuickTime.
*
@@ -334,8 +327,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve a list of the available translations for
* a specific movie.
* This method is used to retrieve a list of the available translations for a specific movie.
*
* @param movieId
* @param appendToResponse
@@ -361,11 +353,9 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* The similar movies method will let you retrieve the similar movies for a
* particular movie.
* The similar movies method will let you retrieve the similar movies for a particular movie.
*
* This data is created dynamically but with the help of users votes on
* TMDb.
* This data is created dynamically but with the help of users votes on TMDb.
*
* The data is much better with movies that have more keywords
*
@@ -428,7 +418,7 @@ public class TmdbMovies extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieList> getMovieLists(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
public TmdbResultsList<UserList> getMovieLists(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
@@ -436,16 +426,10 @@ public class TmdbMovies extends AbstractMethod {
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.LISTS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovieList wrapper = MAPPER.readValue(webpage, WrapperMovieList.class);
TmdbResultsList<MovieList> results = new TmdbResultsList<MovieList>(wrapper.getMovieList());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie lists", url, ex);
}
List<UserList> wrapper = processWrapperList(getTypeReference(UserList.class), url, "movie lists");
TmdbResultsList<UserList> results = new TmdbResultsList<UserList>(null);
results.getResults().addAll(wrapper);
return results;
}
/**
@@ -455,8 +439,7 @@ public class TmdbMovies extends AbstractMethod {
*
* By default, only the last 24 hours of changes are returned.
*
* The maximum number of days that can be returned in a single request is
* 14.
* The maximum number of days that can be returned in a single request is 14.
*
* The language is present on fields that are translatable.
*
@@ -565,8 +548,7 @@ public class TmdbMovies extends AbstractMethod {
/**
* This method is used to retrieve the movies currently in theatres.
*
* This is a curated list that will normally contain 100 movies. The default
* response will return 20 movies.
* This is a curated list that will normally contain 100 movies. The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
@@ -624,8 +606,7 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve the top rated movies that have over 10
* votes on TMDb.
* This method is used to retrieve the top rated movies that have over 10 votes on TMDb.
*
* The default response will return 20 movies.
*
@@ -22,7 +22,7 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.enumeration.SearchType;
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.media.MediaBasic;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.collection.Collection;
@@ -17,8 +17,9 @@
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
package com.omertron.themoviedbapi.model2.movie;
import com.omertron.themoviedbapi.model.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.person.PersonCast;
import com.omertron.themoviedbapi.model.person.PersonCrew;
@@ -26,14 +27,14 @@ import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.collection.Collection;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.movie.AlternativeTitle;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.review.Review;
import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
import com.omertron.themoviedbapi.wrapper.WrapperImages;
import com.omertron.themoviedbapi.wrapper.WrapperMovie;
import com.omertron.themoviedbapi.wrapper.WrapperMovieCasts;
import com.omertron.themoviedbapi.wrapper.WrapperMovieKeywords;
import com.omertron.themoviedbapi.wrapper.WrapperMovieList;
import com.omertron.themoviedbapi.wrapper.WrapperUserList;
import com.omertron.themoviedbapi.wrapper.WrapperReleaseInfo;
import com.omertron.themoviedbapi.wrapper.WrapperReviews;
import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
@@ -120,7 +121,7 @@ public class MovieDb extends AbstractJsonMapping {
@JsonProperty("reviews")
private WrapperReviews reviews;
@JsonProperty("lists")
private WrapperMovieList lists;
private WrapperUserList lists;
@JsonProperty("video")
private Boolean video = null;
@@ -373,8 +374,8 @@ public class MovieDb extends AbstractJsonMapping {
return similarMovies.getMovies();
}
public List<MovieList> getLists() {
return lists.getMovieList();
public List<UserList> getLists() {
return lists.getUserList();
}
public List<Review> getReviews() {
@@ -415,7 +416,7 @@ public class MovieDb extends AbstractJsonMapping {
this.similarMovies = similarMovies;
}
public void setLists(WrapperMovieList lists) {
public void setLists(WrapperUserList lists) {
this.lists = lists;
}
@@ -17,7 +17,7 @@
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
package com.omertron.themoviedbapi.model2.movie;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -40,6 +40,8 @@ public class ReleaseInfo extends AbstractJsonMapping {
private String certification;
@JsonProperty("release_date")
private String releaseDate;
@JsonProperty("primary")
private boolean primary;
public String getCertification() {
return certification;
@@ -65,6 +67,14 @@ public class ReleaseInfo extends AbstractJsonMapping {
this.releaseDate = releaseDate;
}
public boolean isPrimary() {
return primary;
}
public void setPrimary(boolean primary) {
this.primary = primary;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ReleaseInfo) {
@@ -73,6 +83,7 @@ public class ReleaseInfo extends AbstractJsonMapping {
.append(country, other.country)
.append(certification, other.certification)
.append(releaseDate, other.releaseDate)
.append(primary, other.primary)
.isEquals();
} else {
return false;
@@ -85,6 +96,7 @@ public class ReleaseInfo extends AbstractJsonMapping {
.append(country)
.append(certification)
.append(releaseDate)
.append(primary)
.toHashCode();
}
}
@@ -17,7 +17,7 @@
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
package com.omertron.themoviedbapi.model2.movie;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -17,7 +17,7 @@
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
package com.omertron.themoviedbapi.model2.movie;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -44,7 +44,7 @@ public class Video extends AbstractJsonMapping {
@JsonProperty("site")
private String site;
@JsonProperty("size")
private String size;
private int size;
@JsonProperty("type")
private String type;
@@ -56,7 +56,7 @@ public class Video extends AbstractJsonMapping {
return name;
}
public String getSize() {
public int getSize() {
return size;
}
@@ -84,7 +84,7 @@ public class Video extends AbstractJsonMapping {
this.name = name;
}
public void setSize(String size) {
public void setSize(int size) {
this.size = size;
}
@@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import java.io.Serializable;
import java.util.List;
@@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model2.movie.ReleaseInfo;
import java.io.Serializable;
import java.util.List;
@@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model2.movie.Translation;
import java.io.Serializable;
import java.util.List;
@@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model2.list.UserList;
import java.io.Serializable;
import java.util.List;
@@ -28,17 +28,17 @@ import java.util.List;
*
* @author Stuart
*/
public class WrapperMovieList extends AbstractWrapperAll implements Serializable {
public class WrapperUserList extends AbstractWrapperAll implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("results")
private List<MovieList> movieList;
private List<UserList> userList;
public List<MovieList> getMovieList() {
return movieList;
public List<UserList> getUserList() {
return userList;
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
public void setUserList(List<UserList> userList) {
this.userList = userList;
}
}
@@ -21,7 +21,7 @@ package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.omertron.themoviedbapi.model.Trailer;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.model2.movie.Video;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -71,7 +71,7 @@ public class WrapperVideos extends AbstractWrapperId implements Serializable {
video.setId("");
video.setLanguage("");
video.setSize("");
video.setSize(0);
video.setName(trailer.getName());
video.setKey(trailer.getSource());
video.setType(trailer.getType());
@@ -22,13 +22,14 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.AbstractTests;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.TestID;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.enumeration.ArtworkType;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model2.movie.Translation;
import com.omertron.themoviedbapi.model2.movie.Video;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.media.MediaCreditCast;
import com.omertron.themoviedbapi.model2.media.MediaCreditList;
import com.omertron.themoviedbapi.model2.media.MediaState;
@@ -73,7 +74,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieInfo() throws MovieDbException {
LOG.info("getMovieInfo");
@@ -93,7 +94,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieInfoImdb() throws MovieDbException {
LOG.info("getMovieInfoImdb");
String language = LANGUAGE_DEFAULT;
@@ -111,7 +112,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieAccountState() throws MovieDbException {
LOG.info("getMovieAccountState");
@@ -127,7 +128,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieAlternativeTitles() throws MovieDbException {
LOG.info("getMovieAlternativeTitles");
@@ -145,7 +146,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieCredits() throws MovieDbException {
LOG.info("getMovieCredits");
@@ -182,11 +183,27 @@ public class TmdbMoviesTest extends AbstractTests {
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
boolean foundBackdrop = false;
boolean foundPoster = false;
boolean foundOther = false;
for (TestID test : FILM_IDS) {
TmdbResultsList<Artwork> result = instance.getMovieImages(test.getTmdb(), language, appendToResponse);
assertFalse("No artwork", result.isEmpty());
for (Artwork artwork : result.getResults()) {
if (artwork.getArtworkType() == ArtworkType.BACKDROP) {
foundBackdrop = true;
continue;
} else if (artwork.getArtworkType() == ArtworkType.POSTER) {
foundPoster = true;
continue;
}
foundOther = true;
}
assertTrue("No backdrops", foundBackdrop);
assertTrue("No posters", foundPoster);
assertFalse("Something else found!", foundOther);
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -194,7 +211,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieKeywords() throws MovieDbException {
LOG.info("getMovieKeywords");
@@ -202,9 +219,8 @@ public class TmdbMoviesTest extends AbstractTests {
for (TestID test : FILM_IDS) {
TmdbResultsList<Keyword> result = instance.getMovieKeywords(test.getTmdb(), appendToResponse);
assertFalse("No keywords", result.isEmpty());
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -212,7 +228,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieReleaseInfo() throws MovieDbException {
LOG.info("getMovieReleaseInfo");
@@ -221,9 +237,8 @@ public class TmdbMoviesTest extends AbstractTests {
for (TestID test : FILM_IDS) {
TmdbResultsList<ReleaseInfo> result = instance.getMovieReleaseInfo(test.getTmdb(), language, appendToResponse);
assertFalse("No release info", result.isEmpty());
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -231,7 +246,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieVideos() throws MovieDbException {
LOG.info("getMovieVideos");
@@ -240,9 +255,8 @@ public class TmdbMoviesTest extends AbstractTests {
for (TestID test : FILM_IDS) {
TmdbResultsList<Video> result = instance.getMovieVideos(test.getTmdb(), language, appendToResponse);
assertFalse("No videos", result.isEmpty());
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -250,7 +264,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieTranslations() throws MovieDbException {
LOG.info("getMovieTranslations");
@@ -258,9 +272,8 @@ public class TmdbMoviesTest extends AbstractTests {
for (TestID test : FILM_IDS) {
TmdbResultsList<Translation> result = instance.getMovieTranslations(test.getTmdb(), appendToResponse);
assertFalse("No translations", result.isEmpty());
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -268,7 +281,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetSimilarMovies() throws MovieDbException {
LOG.info("getSimilarMovies");
@@ -278,9 +291,8 @@ public class TmdbMoviesTest extends AbstractTests {
for (TestID test : FILM_IDS) {
TmdbResultsList<MovieDb> result = instance.getSimilarMovies(test.getTmdb(), page, language, appendToResponse);
assertFalse("No similar movies", result.isEmpty());
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -288,7 +300,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieReviews() throws MovieDbException {
LOG.info("getMovieReviews");
@@ -308,7 +320,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieLists() throws MovieDbException {
LOG.info("getMovieLists");
@@ -317,10 +329,10 @@ public class TmdbMoviesTest extends AbstractTests {
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
TmdbResultsList<MovieList> result = instance.getMovieLists(test.getTmdb(), page, language, appendToResponse);
TmdbResultsList<UserList> result = instance.getMovieLists(test.getTmdb(), page, language, appendToResponse);
assertFalse("Empty list", result.isEmpty());
assertTrue(result.getTotalResults()>0);
}
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
@@ -328,7 +340,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetMovieChanges() throws MovieDbException {
LOG.info("getMovieChanges");
@@ -347,7 +359,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testPostMovieRating() throws MovieDbException {
LOG.info("postMovieRating");
Integer rating = new Random().nextInt(10) + 1;
@@ -364,7 +376,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetLatestMovie() throws MovieDbException {
LOG.info("getLatestMovie");
@@ -380,7 +392,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetUpcoming() throws MovieDbException {
LOG.info("getUpcoming");
Integer page = null;
@@ -398,7 +410,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetNowPlayingMovies() throws MovieDbException {
LOG.info("getNowPlayingMovies");
Integer page = null;
@@ -416,7 +428,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetPopularMovieList() throws MovieDbException {
LOG.info("getPopularMovieList");
Integer page = null;
@@ -434,7 +446,7 @@ public class TmdbMoviesTest extends AbstractTests {
*
* @throws com.omertron.themoviedbapi.MovieDbException
*/
// @Test
@Test
public void testGetTopRatedMovies() throws MovieDbException {
LOG.info("getTopRatedMovies");
Integer page = null;
@@ -22,12 +22,12 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.AbstractTests;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.enumeration.SearchType;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model2.media.MediaBasic;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.collection.Collection;
import com.omertron.themoviedbapi.model2.company.Company;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.person.PersonFind;
import com.omertron.themoviedbapi.model2.tv.TVBasic;
import com.omertron.themoviedbapi.results.TmdbResultsList;