This commit is contained in:
Stuart Boston
2015-03-04 19:54:48 +00:00
parent 286b748a34
commit 27dcc56492
6 changed files with 667 additions and 9 deletions
@@ -103,6 +103,12 @@ public class TmdbConfiguration extends AbstractMethod {
}
}
/**
* Get the list of supported timezones for the API methods that support them
*
* @return
* @throws MovieDbException
*/
public Map<String, List<String>> getTimezones() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.TIMEZONES).subMethod(MethodSub.LIST).buildUrl();
String webpage = httpTools.getRequest(url);
@@ -384,7 +384,7 @@ public class TmdbMovies extends AbstractMethod {
parameters.add(Param.PAGE, page);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.SIMILAR_MOVIES).buildUrl(parameters);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.SIMILAR).buildUrl(parameters);
WrapperGenericList<MovieDb> wrapper = processWrapper(getTypeReference(MovieDb.class), url, "similar movies");
return wrapper.getTmdbResultsList();
}
@@ -19,7 +19,14 @@
*/
package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
import com.omertron.themoviedbapi.tools.MethodSub;
import com.omertron.themoviedbapi.tools.Param;
import com.omertron.themoviedbapi.tools.TmdbParameters;
import java.net.URL;
/**
* Class to hold the TV Methods
@@ -37,4 +44,327 @@ public class TmdbTV extends AbstractMethod {
public TmdbTV(String apiKey, HttpTools httpTools) {
super(apiKey, httpTools);
}
/**
* Get the primary information about a TV series by id.
*
* @param tvID
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).buildUrl(parameters);
return null;
}
/**
* This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch
* lists.
*
* A valid session id is required.
*
* @param tvID
* @param sessionID
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVAccountState(int tvID, String sessionID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.SESSION, sessionID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
return null;
}
/**
* Get the alternative titles for a specific show ID.
*
* @param tvID
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVAlternativeTitles(int tvID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
return null;
}
/**
* Get the changes for a specific TV show id.
*
* @param tvID
* @param startDate
* @param endDate
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.START_DATE, startDate);
parameters.add(Param.END_DATE, endDate);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CHANGES).buildUrl(parameters);
return null;
}
/**
* Get the content ratings for a specific TV show id.
*
* @param tvID
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVContentRatings(int tvID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CONTENT_RATINGS).buildUrl(parameters);
return null;
}
/**
* Get the cast & crew information about a TV series.
*
* @param tvID
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVCredits(int tvID, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CREDITS).buildUrl(parameters);
return null;
}
/**
* Get the external ids that we have stored for a TV series.
*
* @param tvID
* @param language
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVExternalIDs(int tvID, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters);
return null;
}
/**
* Get the images (posters and backdrops) for a TV series.
*
* @param tvID
* @param language
* @param includeImageLanguage
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVImages(int tvID, String language, String... includeImageLanguage) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.IMAGES).buildUrl(parameters);
return null;
}
/**
* Get the plot keywords for a specific TV show id.
*
* @param tvID
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVKeywords(int tvID, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.KEYWORDS).buildUrl(parameters);
return null;
}
/**
* This method lets users rate a TV show.
*
* A valid session id or guest session id is required.
*
* @param tvID
* @param rating
* @param sessionID
* @param guestSessionID
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.SESSION, sessionID);
parameters.add(Param.GUEST_SESSION_ID, guestSessionID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.RATING).buildUrl(parameters);
return null;
}
/**
* Get the similar TV shows for a specific tv id.
*
* @param tvID
* @param page
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVSimilar(int tvID, Integer page, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.SIMILAR).buildUrl(parameters);
return null;
}
/**
* Get the list of translations that exist for a TV series. These translations cascade down to the episode level.
*
* @param tvID
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVTranslations(int tvID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters);
return null;
}
/**
* Get the videos that have been added to a TV series (trailers, opening credits, etc...)
*
* @param tvID
* @param language
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVVideos(int tvID, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.VIDEOS).buildUrl(parameters);
return null;
}
/**
* Get the latest TV show id.
*
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVLatest() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.LATEST).buildUrl();
return null;
}
/**
* Get the list of TV shows that are currently on the air.
*
* This query looks for any TV show that has an episode with an air date in the next 7 days.
*
* @param page
* @param language
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVOnTheAir(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ON_THE_AIR).buildUrl(parameters);
return null;
}
/**
* Get the list of TV shows that air today.
*
* Without a specified timezone, this query defaults to EST
*
* @param page
* @param language
* @param timezone
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVAiringToday(Integer page, String language, String timezone) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.TIMEZONE, timezone);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.AIRING_TODAY).buildUrl(parameters);
return null;
}
/**
* Get the list of top rated TV shows.
*
* By default, this list will only include TV shows that have 2 or more votes.
*
* This list refreshes every day.
*
* @param page
* @param language
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVTopRated(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.TOP_RATED).buildUrl(parameters);
return null;
}
/**
* Get the list of popular TV shows. This list refreshes every day.
*
* @param page
* @param language
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public String getTVPopular(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.POPULAR).buildUrl(parameters);
return null;
}
}
@@ -26,11 +26,13 @@ public enum MethodSub {
ACCOUNT_STATES("account_states"),
ADD_ITEM("add_item"),
AIRING_TODAY("airing_today"),
ALT_TITLES("alternative_titles"),
CASTS("casts"),
CHANGES("changes"),
CLEAR("clear"),
COLLECTION("collection"),
CONTENT_RATINGS("content_ratings"),
COMBINED_CREDITS("combined_credits"),
COMPANY("company"),
CREDITS("credits"),
@@ -52,6 +54,7 @@ public enum MethodSub {
MOVIE_LIST("movie/list"),
MULTI("multi"),
NOW_PLAYING("now-playing"),
ON_THE_AIR("on_the_air"),
PERSON("person"),
POPULAR("popular"),
RATED_MOVIES("rated/movies"),
@@ -62,7 +65,7 @@ public enum MethodSub {
REMOVE_ITEM("remove_item"),
REVIEWS("reviews"),
SESSION_NEW("session/new"),
SIMILAR_MOVIES("similar_movies"),
SIMILAR("similar"),
TAGGED_IMAGES("tagged_images"),
TOKEN_NEW("token/new"),
TOKEN_VALIDATE("token/validate_with_login"),
@@ -50,6 +50,7 @@ public enum Param {
SEARCH_TYPE("search_type="),
SESSION("session_id="),
START_DATE("start_date="),
TIMEZONE("timezone="),
TOKEN("request_token="),
USERNAME("username="),
VALUE("value="),