/* * 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 . * */ 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 *

* 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); } // /** * 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 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 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 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 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 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 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 getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException { return tmdbAccount.getGuestRatedMovies(guestSessionId, language, page, sortBy); } // // /** * 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(); } // // /** * Get a list of movies certification. * * @return * @throws MovieDbException */ public TmdbResultsMap> getMoviesCertification() throws MovieDbException { return tmdbCertifications.getMoviesCertification(); } /** * Get a list of tv certification. * * @return * @throws MovieDbException */ public TmdbResultsMap> getTvCertification() throws MovieDbException { return tmdbCertifications.getTvCertification(); } // // /** * 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 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 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 getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException { return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate); } // // /** * 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 getCollectionImages(int collectionId, String language) throws MovieDbException { return tmdbCollections.getCollectionImages(collectionId, language); } // // /** * 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 getCompanyMovies(int companyId, String language, int page) throws MovieDbException { return tmdbCompany.getCompanyMovies(companyId, language, page); } // // /** * 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 getJobs() throws MovieDbException { return tmdbConfiguration.getJobs(); } /** * Get the list of supported timezones for the API methods that support them. * * @return @throws MovieDbException */ public Map> getTimezones() throws MovieDbException { return tmdbConfiguration.getTimezones(); } // // /** * Get the detailed information about a particular credit record. *

* This is currently only supported with the new credit model found in TV. *
* These IDs can be found from any TV credit response as well as the TV_credits and combined_credits methods for people.
* The episodes object returns a list of episodes and are generally going to be guest stars.
* The season array will return a list of season numbers.
* 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); } // // /** * 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 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 getDiscoverTV(Discover discover) throws MovieDbException { return tmdbDiscover.getDiscoverTV(discover); } // // /** * You con use this method to find movies, tv series or persons using external ids. * * Supported query ids are *

* * 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); } // // /** * Get the list of Movie genres. * * @param language * @return * @throws MovieDbException */ public TmdbResultsList getGenreMovieList(String language) throws MovieDbException { return tmdbGenre.getGenreMovieList(language); } /** * Get the list of TV genres.. * * @param language * @return * @throws MovieDbException */ public TmdbResultsList 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 getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { return tmdbGenre.getGenreMovies(genreId, language, page, includeAllMovies, includeAdult); } // // /** * 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 getKeywordMovies(String keywordId, String language, int page) throws MovieDbException { return tmdbKeywords.getKeywordMovies(keywordId, language, page); } // // /** * Get a list by its ID * * @param listId * @return The list and its items * @throws MovieDbException */ public ListItem 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); } // // /** * 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 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 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 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 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 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 // /** * This method is used to retrieve the basic information about a TV network. *

* 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); } // // /** * 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 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 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 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 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 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 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(); } // // /** * * @param reviewId * @return @throws MovieDbException */ public Review getReviews(String reviewId) throws MovieDbException { return tmdbReviews.getReview(reviewId); } // // /** * 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 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 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 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 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 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 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 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 searchTV(String query, Integer page, String language, Integer firstAirDateYear, SearchType searchType) throws MovieDbException { return tmdbSearch.searchTV(query, page, language, firstAirDateYear, searchType); } // // // }