|
|
/*
|
|
|
* Copyright (c) 2004-2015 Stuart Boston
|
|
|
*
|
|
|
* This file is part of TheMovieDB API.
|
|
|
*
|
|
|
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
* any later version.
|
|
|
*
|
|
|
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
* GNU General Public License for more details.
|
|
|
*
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*
|
|
|
*/
|
|
|
package com.omertron.themoviedbapi;
|
|
|
|
|
|
import com.omertron.themoviedbapi.enumeration.ExternalSource;
|
|
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
|
|
import com.omertron.themoviedbapi.enumeration.SearchType;
|
|
|
import com.omertron.themoviedbapi.enumeration.SortBy;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbAccount;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbAuthentication;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbCertifications;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbChanges;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbCollections;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbCompanies;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbConfiguration;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbCredits;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbDiscover;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbFind;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbGenres;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbKeywords;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbLists;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbMovies;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbNetworks;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbPeople;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbReviews;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbSearch;
|
|
|
import com.omertron.themoviedbapi.methods.TmdbTV;
|
|
|
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
|
|
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.model.keyword.KeywordMovie;
|
|
|
import com.omertron.themoviedbapi.model2.Certification;
|
|
|
import com.omertron.themoviedbapi.model2.FindResults;
|
|
|
import com.omertron.themoviedbapi.model2.MediaBasic;
|
|
|
import com.omertron.themoviedbapi.model2.StatusCode;
|
|
|
import com.omertron.themoviedbapi.model2.account.Account;
|
|
|
import com.omertron.themoviedbapi.model2.artwork.Artwork;
|
|
|
import com.omertron.themoviedbapi.model2.artwork.ArtworkMedia;
|
|
|
import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation;
|
|
|
import com.omertron.themoviedbapi.model2.authentication.TokenSession;
|
|
|
import com.omertron.themoviedbapi.model2.change.ChangeListItem;
|
|
|
import com.omertron.themoviedbapi.model2.collection.Collection;
|
|
|
import com.omertron.themoviedbapi.model2.collection.CollectionInfo;
|
|
|
import com.omertron.themoviedbapi.model2.company.Company;
|
|
|
import com.omertron.themoviedbapi.model2.config.Configuration;
|
|
|
import com.omertron.themoviedbapi.model2.config.JobDepartment;
|
|
|
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.MovieBasic;
|
|
|
import com.omertron.themoviedbapi.model2.network.Network;
|
|
|
import com.omertron.themoviedbapi.model2.person.CreditInfo;
|
|
|
import com.omertron.themoviedbapi.model2.person.CreditMovieBasic;
|
|
|
import com.omertron.themoviedbapi.model2.person.CreditTVBasic;
|
|
|
import com.omertron.themoviedbapi.model2.person.ExternalID;
|
|
|
import com.omertron.themoviedbapi.model2.person.Person;
|
|
|
import com.omertron.themoviedbapi.model2.person.PersonCredits;
|
|
|
import com.omertron.themoviedbapi.model2.person.PersonFind;
|
|
|
import com.omertron.themoviedbapi.model2.review.Review;
|
|
|
import com.omertron.themoviedbapi.model2.tv.TVBasic;
|
|
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
|
|
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
|
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
|
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
|
|
import java.net.URL;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.client.HttpClient;
|
|
|
import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
|
|
|
|
|
/**
|
|
|
* The MovieDb API
|
|
|
* <p>
|
|
|
* This is for version 3 of the API as specified here: http://help.themoviedb.org/kb/api/about-3
|
|
|
*
|
|
|
* @author stuart.boston
|
|
|
*/
|
|
|
public class TheMovieDbApi {
|
|
|
|
|
|
private HttpTools httpTools;
|
|
|
// Constants
|
|
|
private static final int YEAR_LENGTH = 4;
|
|
|
// Sub-methods
|
|
|
private static TmdbAccount tmdbAccount;
|
|
|
private static TmdbAuthentication tmdbAuth;
|
|
|
private static TmdbCertifications tmdbCertifications;
|
|
|
private static TmdbChanges tmdbChanges;
|
|
|
private static TmdbCollections tmdbCollections;
|
|
|
private static TmdbCompanies tmdbCompany;
|
|
|
private static TmdbConfiguration tmdbConfiguration;
|
|
|
private static TmdbCredits tmdbCredits;
|
|
|
private static TmdbDiscover tmdbDiscover;
|
|
|
private static TmdbFind tmdbFind;
|
|
|
private static TmdbGenres tmdbGenre;
|
|
|
private static TmdbKeywords tmdbKeywords;
|
|
|
private static TmdbLists tmdbList;
|
|
|
private static TmdbMovies tmdbMovies;
|
|
|
private static TmdbNetworks tmdbNetworks;
|
|
|
private static TmdbPeople tmdbPeople;
|
|
|
private static TmdbReviews tmdbReviews;
|
|
|
private static TmdbSearch tmdbSearch;
|
|
|
private static TmdbTV tmdbTv;
|
|
|
|
|
|
/**
|
|
|
* API for The Movie Db.
|
|
|
*
|
|
|
* @param apiKey
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TheMovieDbApi(String apiKey) throws MovieDbException {
|
|
|
this(apiKey, new SimpleHttpClientBuilder().build());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* API for The Movie Db.
|
|
|
*
|
|
|
* @param apiKey
|
|
|
* @param httpClient The httpClient to use for web requests.
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TheMovieDbApi(String apiKey, HttpClient httpClient) throws MovieDbException {
|
|
|
this.httpTools = new HttpTools(httpClient);
|
|
|
initialise(apiKey, httpTools);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Initialise the sub-classes once the API key and http client are known
|
|
|
*
|
|
|
* @param apiKey
|
|
|
* @param httpTools
|
|
|
*/
|
|
|
private void initialise(String apiKey, HttpTools httpTools) {
|
|
|
tmdbAccount = new TmdbAccount(apiKey, httpTools);
|
|
|
tmdbAuth = new TmdbAuthentication(apiKey, httpTools);
|
|
|
tmdbCertifications = new TmdbCertifications(apiKey, httpTools);
|
|
|
tmdbChanges = new TmdbChanges(apiKey, httpTools);
|
|
|
tmdbCollections = new TmdbCollections(apiKey, httpTools);
|
|
|
tmdbCompany = new TmdbCompanies(apiKey, httpTools);
|
|
|
tmdbConfiguration = new TmdbConfiguration(apiKey, httpTools);
|
|
|
tmdbCredits = new TmdbCredits(apiKey, httpTools);
|
|
|
tmdbDiscover = new TmdbDiscover(apiKey, httpTools);
|
|
|
tmdbFind = new TmdbFind(apiKey, httpTools);
|
|
|
tmdbGenre = new TmdbGenres(apiKey, httpTools);
|
|
|
tmdbKeywords = new TmdbKeywords(apiKey, httpTools);
|
|
|
tmdbList = new TmdbLists(apiKey, httpTools);
|
|
|
tmdbMovies = new TmdbMovies(apiKey, httpTools);
|
|
|
tmdbNetworks = new TmdbNetworks(apiKey, httpTools);
|
|
|
tmdbPeople = new TmdbPeople(apiKey, httpTools);
|
|
|
tmdbReviews = new TmdbReviews(apiKey, httpTools);
|
|
|
tmdbSearch = new TmdbSearch(apiKey, httpTools);
|
|
|
tmdbTv = new TmdbTV(apiKey, httpTools);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compare the MovieDB object with a title & year
|
|
|
*
|
|
|
* @param moviedb The moviedb object to compare too
|
|
|
* @param title The title of the movie to compare
|
|
|
* @param year The year of the movie to compare exact match
|
|
|
* @return True if there is a match, False otherwise.
|
|
|
*/
|
|
|
public static boolean compareMovies(MovieDb moviedb, String title, String year) {
|
|
|
return compareMovies(moviedb, title, year, 0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compare the MovieDB object with a title & year
|
|
|
*
|
|
|
* @param moviedb The moviedb object to compare too
|
|
|
* @param title The title of the movie to compare
|
|
|
* @param year The year of the movie to compare
|
|
|
* @param maxDistance The Levenshtein Distance between the two titles. 0 = exact match
|
|
|
* @param caseSensitive true if the comparison is to be case sensitive
|
|
|
* @return True if there is a match, False otherwise.
|
|
|
*/
|
|
|
public static boolean compareMovies(MovieDb moviedb, String title, String year, int maxDistance, boolean caseSensitive) {
|
|
|
if ((moviedb == null) || (StringUtils.isBlank(title))) {
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
String cmpTitle, cmpOtherTitle, cmpOriginalTitle;
|
|
|
if (caseSensitive) {
|
|
|
cmpTitle = title;
|
|
|
cmpOtherTitle = moviedb.getOriginalTitle();
|
|
|
cmpOriginalTitle = moviedb.getTitle();
|
|
|
} else {
|
|
|
cmpTitle = title.toLowerCase();
|
|
|
cmpOtherTitle = moviedb.getTitle().toLowerCase();
|
|
|
cmpOriginalTitle = moviedb.getOriginalTitle().toLowerCase();
|
|
|
}
|
|
|
|
|
|
if (isValidYear(year) && isValidYear(moviedb.getReleaseDate())) {
|
|
|
// Compare with year
|
|
|
String movieYear = moviedb.getReleaseDate().substring(0, YEAR_LENGTH);
|
|
|
if (movieYear.equals(year)) {
|
|
|
if (compareDistance(cmpOriginalTitle, cmpTitle, maxDistance)) {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
if (compareDistance(cmpOtherTitle, cmpTitle, maxDistance)) {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// Compare without year
|
|
|
if (compareDistance(cmpOriginalTitle, cmpTitle, maxDistance)) {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
if (compareDistance(cmpOtherTitle, cmpTitle, maxDistance)) {
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compare the MovieDB object with a title & year, case sensitive
|
|
|
*
|
|
|
* @param moviedb
|
|
|
* @param title
|
|
|
* @param year
|
|
|
* @param maxDistance
|
|
|
* @return
|
|
|
*/
|
|
|
public static boolean compareMovies(MovieDb moviedb, String title, String year, int maxDistance) {
|
|
|
return compareMovies(moviedb, title, year, maxDistance, true);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compare the Levenshtein Distance between the two strings
|
|
|
*
|
|
|
* @param title1
|
|
|
* @param title2
|
|
|
* @param distance
|
|
|
*/
|
|
|
private static boolean compareDistance(String title1, String title2, int distance) {
|
|
|
return StringUtils.getLevenshteinDistance(title1, title2) <= distance;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Check the year is not blank or UNKNOWN
|
|
|
*
|
|
|
* @param year
|
|
|
*/
|
|
|
private static boolean isValidYear(String year) {
|
|
|
return StringUtils.isNotBlank(year) && !"UNKNOWN".equals(year);
|
|
|
}
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Account">
|
|
|
/**
|
|
|
* Get the basic information for an account. You will need to have a valid session id.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public Account getAccount(String sessionId) throws MovieDbException {
|
|
|
return tmdbAccount.getAccount(sessionId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get all lists of a given user
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @return The lists
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<UserList> getUserLists(String sessionId, int accountId) throws MovieDbException {
|
|
|
return tmdbAccount.getUserLists(sessionId, accountId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the account favourite movies
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException {
|
|
|
return tmdbAccount.getFavoriteMovies(sessionId, accountId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Add or remove a movie to an accounts favourite list.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param mediaId
|
|
|
* @param mediaType
|
|
|
* @param isFavorite
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public StatusCode modifyFavoriteStatus(String sessionId, int accountId, Integer mediaId, MediaType mediaType, boolean isFavorite) throws MovieDbException {
|
|
|
return tmdbAccount.modifyFavoriteStatus(sessionId, accountId, mediaType, mediaId, isFavorite);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of rated movies (and associated rating) for an account.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param page
|
|
|
* @param sortBy
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
|
|
return tmdbAccount.getRatedMovies(sessionId, accountId, page, sortBy, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of rated TV shows (and associated rating) for an account.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param page
|
|
|
* @param sortBy
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<TVBasic> getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
|
|
return tmdbAccount.getRatedTV(sessionId, accountId, page, sortBy, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of movies on an accounts watchlist.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param page
|
|
|
* @param sortBy
|
|
|
* @param language
|
|
|
* @return The watchlist of the user
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
|
|
return tmdbAccount.getWatchListMovie(sessionId, accountId, page, sortBy, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of movies on an accounts watchlist.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param page
|
|
|
* @param sortBy
|
|
|
* @param language
|
|
|
* @return The watchlist of the user
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<TVBasic> getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
|
|
return tmdbAccount.getWatchListTV(sessionId, accountId, page, sortBy, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Add a movie to an accounts watch list.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param mediaId
|
|
|
* @param mediaType
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public StatusCode addToWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException {
|
|
|
return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, true);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Remove a movie from an accounts watch list.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @param mediaId
|
|
|
* @param mediaType
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public StatusCode removeFromWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException {
|
|
|
return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of favorite TV series for an account.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param accountId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List getFavoriteTv(String sessionId, int accountId) throws MovieDbException {
|
|
|
return tmdbAccount.getFavoriteTv(sessionId, accountId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get a list of rated movies for a specific guest session id.
|
|
|
*
|
|
|
* @param guestSessionId
|
|
|
* @param language
|
|
|
* @param page
|
|
|
* @param sortBy only CREATED_AT_ASC or CREATED_AT_DESC is supported
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException {
|
|
|
return tmdbAccount.getGuestRatedMovies(guestSessionId, language, page, sortBy);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Authentication">
|
|
|
/**
|
|
|
* This method is used to generate a valid request token for user based authentication.
|
|
|
*
|
|
|
* A request token is required in order to request a session id.
|
|
|
*
|
|
|
* You can generate any number of request tokens but they will expire after 60 minutes.
|
|
|
*
|
|
|
* As soon as a valid session id has been created the token will be destroyed.
|
|
|
*
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TokenAuthorisation getAuthorisationToken() throws MovieDbException {
|
|
|
return tmdbAuth.getAuthorisationToken();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method is used to generate a session id for user based authentication.
|
|
|
*
|
|
|
* A session id is required in order to use any of the write methods.
|
|
|
*
|
|
|
* @param token
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException {
|
|
|
return tmdbAuth.getSessionToken(token);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method is used to generate a session id for user based authentication. User must provide their username and password
|
|
|
*
|
|
|
* A session id is required in order to use any of the write methods.
|
|
|
*
|
|
|
* @param token Session token
|
|
|
* @param username User's username
|
|
|
* @param password User's password
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TokenAuthorisation getSessionTokenLogin(TokenAuthorisation token, String username, String password) throws MovieDbException {
|
|
|
return tmdbAuth.getSessionTokenLogin(token, username, password);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method is used to generate a guest session id.
|
|
|
*
|
|
|
* A guest session can be used to rate movies without having a registered TMDb user account.
|
|
|
*
|
|
|
* You should only generate a single guest session per user (or device) as you will be able to attach the ratings to a TMDb user
|
|
|
* account in the future.
|
|
|
*
|
|
|
* There are also IP limits in place so you should always make sure it's the end user doing the guest session actions.
|
|
|
*
|
|
|
* If a guest session is not used for the first time within 24 hours, it will be automatically discarded.
|
|
|
*
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TokenSession getGuestSessionToken() throws MovieDbException {
|
|
|
return tmdbAuth.getGuestSessionToken();
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Certifications">
|
|
|
/**
|
|
|
* Get a list of movies certification.
|
|
|
*
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
|
|
|
return tmdbCertifications.getMoviesCertification();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get a list of tv certification.
|
|
|
*
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsMap<String, List<Certification>> getTvCertification() throws MovieDbException {
|
|
|
return tmdbCertifications.getTvCertification();
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Changes">
|
|
|
/**
|
|
|
* Get a list of Movie IDs that have been edited.
|
|
|
*
|
|
|
* You can then use the movie changes API to get the actual data that has been changed.
|
|
|
*
|
|
|
* @param page
|
|
|
* @param startDate the start date of the changes, optional
|
|
|
* @param endDate the end date of the changes, optional
|
|
|
* @return List of changed movie
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<ChangeListItem> getMovieChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
|
|
return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get a list of TV IDs that have been edited.
|
|
|
*
|
|
|
* You can then use the TV changes API to get the actual data that has been changed.
|
|
|
*
|
|
|
* @param page
|
|
|
* @param startDate the start date of the changes, optional
|
|
|
* @param endDate the end date of the changes, optional
|
|
|
* @return List of changed movie
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<ChangeListItem> getTvChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
|
|
return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get a list of Person IDs that have been edited.
|
|
|
*
|
|
|
* You can then use the person changes API to get the actual data that has been changed.
|
|
|
*
|
|
|
* @param page
|
|
|
* @param startDate the start date of the changes, optional
|
|
|
* @param endDate the end date of the changes, optional
|
|
|
* @return List of changed movie
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<ChangeListItem> getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
|
|
return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Collections">
|
|
|
/**
|
|
|
* 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 collectionId
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public CollectionInfo getCollectionInfo(int collectionId, String language) throws MovieDbException {
|
|
|
return tmdbCollections.getCollectionInfo(collectionId, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get all of the images for a particular collection by collection id.
|
|
|
*
|
|
|
* @param collectionId
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Artwork> getCollectionImages(int collectionId, String language) throws MovieDbException {
|
|
|
return tmdbCollections.getCollectionImages(collectionId, language);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Companies">
|
|
|
/**
|
|
|
* This method is used to retrieve the basic information about a production company on TMDb.
|
|
|
*
|
|
|
* @param companyId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public Company getCompanyInfo(int companyId) throws MovieDbException {
|
|
|
return tmdbCompany.getCompanyInfo(companyId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method is used to retrieve the movies associated with a company.
|
|
|
*
|
|
|
* These movies are returned in order of most recently released to oldest. The default response will return 20 movies per page.
|
|
|
*
|
|
|
* TODO: Implement more than 20 movies
|
|
|
*
|
|
|
* @param companyId
|
|
|
* @param language
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getCompanyMovies(int companyId, String language, int page) throws MovieDbException {
|
|
|
return tmdbCompany.getCompanyMovies(companyId, language, page);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Configuration">
|
|
|
/**
|
|
|
* Get the configuration information
|
|
|
*
|
|
|
* @return
|
|
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
|
|
*/
|
|
|
public Configuration getConfiguration() throws MovieDbException {
|
|
|
return tmdbConfiguration.getConfig();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Generate the full image URL from the size and image path
|
|
|
*
|
|
|
* @param imagePath
|
|
|
* @param requiredSize
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException {
|
|
|
return tmdbConfiguration.getConfig().createImageUrl(imagePath, requiredSize);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get a list of valid jobs
|
|
|
*
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<JobDepartment> getJobs() throws MovieDbException {
|
|
|
return tmdbConfiguration.getJobs();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of supported timezones for the API methods that support them.
|
|
|
*
|
|
|
* @return @throws MovieDbException
|
|
|
*/
|
|
|
public Map<String, List<String>> getTimezones() throws MovieDbException {
|
|
|
return tmdbConfiguration.getTimezones();
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Credits">
|
|
|
/**
|
|
|
* Get the detailed information about a particular credit record.
|
|
|
* <p>
|
|
|
* This is currently only supported with the new credit model found in TV.
|
|
|
* <br/>
|
|
|
* These IDs can be found from any TV credit response as well as the TV_credits and combined_credits methods for people. <br/>
|
|
|
* The episodes object returns a list of episodes and are generally going to be guest stars. <br/>
|
|
|
* The season array will return a list of season numbers. <br/>
|
|
|
* Season credits are credits that were marked with the "add to every season" option in the editing interface and are assumed to
|
|
|
* be "season regulars".
|
|
|
*
|
|
|
* @param creditId
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public CreditInfo getCreditInfo(String creditId, String language) throws MovieDbException {
|
|
|
return tmdbCredits.getCreditInfo(creditId, language);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Discover">
|
|
|
/**
|
|
|
* Discover movies by different types of data like average rating, number of votes, genres and certifications.
|
|
|
*
|
|
|
* @param discover A discover object containing the search criteria required
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getDiscoverMovies(Discover discover) throws MovieDbException {
|
|
|
return tmdbDiscover.getDiscoverMovies(discover);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Discover movies by different types of data like average rating, number of votes, genres and certifications.
|
|
|
*
|
|
|
* @param discover A discover object containing the search criteria required
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<TVBasic> getDiscoverTV(Discover discover) throws MovieDbException {
|
|
|
return tmdbDiscover.getDiscoverTV(discover);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Find">
|
|
|
/**
|
|
|
* You con use this method to find movies, tv series or persons using external ids.
|
|
|
*
|
|
|
* Supported query ids are
|
|
|
* <ul>
|
|
|
* <li>Movies: imdb_id</li>
|
|
|
* <li>People: imdb_id, freebase_mid, freebase_id, tvrage_id</li>
|
|
|
* <li>TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id</li>
|
|
|
* <li>TV Seasons: freebase_mid, freebase_id, tvdb_id, tvrage_id</li>
|
|
|
* <li>TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_idimdb_id, freebase_mid, freebase_id, tvrage_id,
|
|
|
* tvdb_id.
|
|
|
* </ul>
|
|
|
*
|
|
|
* For details see http://docs.themoviedb.apiary.io/#find
|
|
|
*
|
|
|
* @param id the external id
|
|
|
* @param externalSource one of {@link ExternalSource}.
|
|
|
* @param language the language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public FindResults find(String id, ExternalSource externalSource, String language) throws MovieDbException {
|
|
|
return tmdbFind.find(id, externalSource, language);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Genres">
|
|
|
/**
|
|
|
* Get the list of Movie genres.
|
|
|
*
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Genre> getGenreMovieList(String language) throws MovieDbException {
|
|
|
return tmdbGenre.getGenreMovieList(language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of TV genres..
|
|
|
*
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Genre> getGenreTVList(String language) throws MovieDbException {
|
|
|
return tmdbGenre.getGenreTVList(language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get a list of movies per genre.
|
|
|
*
|
|
|
* It is important to understand that only movies with more than 10 votes get listed.
|
|
|
*
|
|
|
* This prevents movies from 1 10/10 rating from being listed first and for the first 5 pages.
|
|
|
*
|
|
|
* @param genreId
|
|
|
* @param language
|
|
|
* @param page
|
|
|
* @param includeAllMovies
|
|
|
* @param includeAdult
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public List<MovieBasic> getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException {
|
|
|
return tmdbGenre.getGenreMovies(genreId, language, page, includeAllMovies, includeAdult);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Keywords">
|
|
|
/**
|
|
|
* Get the basic information for a specific keyword id.
|
|
|
*
|
|
|
* @param keywordId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public Keyword getKeyword(String keywordId) throws MovieDbException {
|
|
|
return tmdbKeywords.getKeyword(keywordId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of movies for a particular keyword by id.
|
|
|
*
|
|
|
* @param keywordId
|
|
|
* @param language
|
|
|
* @param page
|
|
|
* @return List of movies with the keyword
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<KeywordMovie> getKeywordMovies(String keywordId, String language, int page) throws MovieDbException {
|
|
|
return tmdbKeywords.getKeywordMovies(keywordId, language, page);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Lists">
|
|
|
/**
|
|
|
* Get a list by its ID
|
|
|
*
|
|
|
* @param listId
|
|
|
* @return The list and its items
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public ListItem<MovieDb> getList(String listId) throws MovieDbException {
|
|
|
return tmdbList.getList(listId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method lets users create a new list. A valid session id is required.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param name
|
|
|
* @param description
|
|
|
* @return The list id
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public String createList(String sessionId, String name, String description) throws MovieDbException {
|
|
|
return tmdbList.createList(sessionId, name, description);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method lets users delete a list that they created. A valid session id is required.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param listId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public StatusCode deleteList(String sessionId, String listId) throws MovieDbException {
|
|
|
return tmdbList.deleteList(sessionId, listId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Check to see if an item is already on a list.
|
|
|
*
|
|
|
* @param listId
|
|
|
* @param mediaId
|
|
|
* @return true if the item is on the list
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public boolean checkItemStatus(String listId, Integer mediaId) throws MovieDbException {
|
|
|
return tmdbList.checkItemStatus(listId, mediaId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method lets users add new items to a list that they created.
|
|
|
*
|
|
|
* A valid session id is required.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param listId
|
|
|
* @param mediaId
|
|
|
* @return true if the movie is on the list
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public StatusCode addItemToList(String sessionId, String listId, Integer mediaId) throws MovieDbException {
|
|
|
return tmdbList.addItem(sessionId, listId, mediaId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This method lets users remove items from a list that they created.
|
|
|
*
|
|
|
* A valid session id is required.
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param listId
|
|
|
* @param mediaId
|
|
|
* @return true if the movie is on the list
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public StatusCode removeItemFromList(String sessionId, String listId, Integer mediaId) throws MovieDbException {
|
|
|
return tmdbList.removeItem(sessionId, listId, mediaId);
|
|
|
}
|
|
|
//</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 you’re 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.getMovieTrailers(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, int page, String... appendToResponse) throws MovieDbException {
|
|
|
return tmdbMovies.getSimilarMovies(movieId, language, page, 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, int page, String... appendToResponse) throws MovieDbException {
|
|
|
return tmdbMovies.getMovieLists(movieId, language, page, 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, int page) throws MovieDbException {
|
|
|
return tmdbMovies.getUpcoming(language, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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, int page) throws MovieDbException {
|
|
|
return tmdbMovies.getNowPlayingMovies(language, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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, int page) throws MovieDbException {
|
|
|
return tmdbMovies.getPopularMovieList(language, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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, int page) throws MovieDbException {
|
|
|
return tmdbMovies.getTopRatedMovies(language, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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">
|
|
|
/**
|
|
|
* This method is used to retrieve the basic information about a TV network.
|
|
|
* <p>
|
|
|
* You can use this ID to search for TV shows with the discover method.
|
|
|
*
|
|
|
* @param networkId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public Network getNetworkInfo(int networkId) throws MovieDbException {
|
|
|
return tmdbNetworks.getNetworkInfo(networkId);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="People">
|
|
|
/**
|
|
|
* Get the general person information for a specific id.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @param appendToResponse
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public Person getPersonInfo(int personId, String... appendToResponse) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonInfo(personId, appendToResponse);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the movie credits for a specific person id.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @param language
|
|
|
* @param appendToResponse
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public PersonCredits<CreditMovieBasic> getPersonMovieCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonMovieCredits(personId, language, appendToResponse);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the TV credits for a specific person id.
|
|
|
*
|
|
|
* To get the expanded details for each record, call the /credit method with the provided credit_id.
|
|
|
*
|
|
|
* This will provide details about which episode and/or season the credit is for.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @param language
|
|
|
* @param appendToResponse
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public PersonCredits<CreditTVBasic> getPersonTVCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonTVCredits(personId, language, appendToResponse);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the combined (movie and TV) credits for a specific person id.
|
|
|
*
|
|
|
* To get the expanded details for each TV record, call the /credit method with the provided credit_id.
|
|
|
*
|
|
|
* This will provide details about which episode and/or season the credit is for.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @param language
|
|
|
* @param appendToResponse
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public PersonCredits<CreditTVBasic> getPersonCombinedCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonCombinedCredits(personId, language, appendToResponse);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the external ids for a specific person id.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public ExternalID getPersonExternalIds(int personId) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonExternalIds(personId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the images for a specific person id.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Artwork> getPersonImages(int personId) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonImages(personId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the images that have been tagged with a specific person id.
|
|
|
*
|
|
|
* We return all of the image results with a media object mapped for each image.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @param page
|
|
|
* @param language
|
|
|
* @return
|
|
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<ArtworkMedia> getPersonTaggedImages(int personId, Integer page, String language) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonTaggedImages(personId, page, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the changes for a specific person id.
|
|
|
*
|
|
|
* Changes are grouped by key, and ordered by date in descending order.
|
|
|
*
|
|
|
* 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 language is present on fields that are translatable.
|
|
|
*
|
|
|
* @param personId
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
|
|
*/
|
|
|
public WrapperChanges getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonChanges(personId, startDate, endDate);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the list of popular people on The Movie Database.
|
|
|
*
|
|
|
* This list refreshes every day.
|
|
|
*
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<PersonFind> getPersonPopular(Integer page) throws MovieDbException {
|
|
|
return tmdbPeople.getPersonPopular(page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the latest person id.
|
|
|
*
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public Person getPersonLatest() throws MovieDbException {
|
|
|
return tmdbPeople.getPersonLatest();
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Review">
|
|
|
/**
|
|
|
*
|
|
|
* @param reviewId
|
|
|
* @return @throws MovieDbException
|
|
|
*/
|
|
|
public Review getReviews(String reviewId) throws MovieDbException {
|
|
|
return tmdbReviews.getReview(reviewId);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="Search">
|
|
|
/**
|
|
|
* Search Companies.
|
|
|
*
|
|
|
* You can use this method to search for production companies that are part of TMDb. The company IDs will map to those returned
|
|
|
* on movie calls.
|
|
|
*
|
|
|
* http://help.themoviedb.org/kb/api/search-companies
|
|
|
*
|
|
|
* @param query
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Company> searchCompanies(String query, Integer page) throws MovieDbException {
|
|
|
return tmdbSearch.searchCompanies(query, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Search for collections by name.
|
|
|
*
|
|
|
* @param query
|
|
|
* @param language
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Collection> searchCollection(String query, Integer page, String language) throws MovieDbException {
|
|
|
return tmdbSearch.searchCollection(query, page, language);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Search for keywords by name
|
|
|
*
|
|
|
* @param query
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<Keyword> searchKeyword(String query, Integer page) throws MovieDbException {
|
|
|
return tmdbSearch.searchKeyword(query, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Search for lists by name and description.
|
|
|
*
|
|
|
* @param query
|
|
|
* @param includeAdult
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<UserList> searchList(String query, Integer page, Boolean includeAdult) throws MovieDbException {
|
|
|
return tmdbSearch.searchList(query, page, includeAdult);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Search Movies This is a good starting point to start finding movies on TMDb.
|
|
|
*
|
|
|
* @param query
|
|
|
* @param searchYear Limit the search to the provided year. Zero (0) will get all years
|
|
|
* @param language The language to include. Can be blank/null.
|
|
|
* @param includeAdult true or false to include adult titles in the search
|
|
|
* @param page The page of results to return. 0 to get the default (first page)
|
|
|
* @param primaryReleaseYear
|
|
|
* @param searchType
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<MovieDb> searchMovie(String query,
|
|
|
Integer page,
|
|
|
String language,
|
|
|
Boolean includeAdult,
|
|
|
Integer searchYear,
|
|
|
Integer primaryReleaseYear,
|
|
|
SearchType searchType) throws MovieDbException {
|
|
|
return tmdbSearch.searchMovie(query, page, language, includeAdult, searchYear, primaryReleaseYear, searchType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Search the movie, tv show and person collections with a single query.
|
|
|
*
|
|
|
* Each item returned in the result array has a media_type field that maps to either movie, tv or person.
|
|
|
*
|
|
|
* Each mapped result is the same response you would get from each independent search
|
|
|
*
|
|
|
* @param query
|
|
|
* @param page
|
|
|
* @param language
|
|
|
* @param includeAdult
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<MediaBasic> searchMulti(String query, Integer page, String language, Boolean includeAdult) throws MovieDbException {
|
|
|
return tmdbSearch.searchMulti(query, page, language, includeAdult);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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.
|
|
|
*
|
|
|
* @param query
|
|
|
* @param includeAdult
|
|
|
* @param page
|
|
|
* @param searchType
|
|
|
* @return
|
|
|
* @throws MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<PersonFind> searchPeople(String query, Integer page, Boolean includeAdult, SearchType searchType) throws MovieDbException {
|
|
|
return tmdbSearch.searchPeople(query, page, includeAdult, searchType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Search for TV shows by title.
|
|
|
*
|
|
|
* @param query
|
|
|
* @param page
|
|
|
* @param language
|
|
|
* @param firstAirDateYear
|
|
|
* @param searchType
|
|
|
* @return
|
|
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
|
|
*/
|
|
|
public TmdbResultsList<TVBasic> searchTV(String query, Integer page, String language, Integer firstAirDateYear, SearchType searchType) throws MovieDbException {
|
|
|
return tmdbSearch.searchTV(query, page, language, firstAirDateYear, searchType);
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc="TV">
|
|
|
//</editor-fold>
|
|
|
}
|