|
|
|
|
@ -19,20 +19,7 @@
|
|
|
|
|
*/
|
|
|
|
|
package com.omertron.themoviedbapi;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.omertron.themoviedbapi.MovieDbException.MovieDbExceptionType;
|
|
|
|
|
import com.omertron.themoviedbapi.model.*;
|
|
|
|
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
|
|
|
|
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
|
|
|
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
|
|
|
|
import com.omertron.themoviedbapi.tools.WebBrowser;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.*;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.http.client.methods.HttpGet;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.yamj.api.common.http.CommonHttpClient;
|
|
|
|
|
import static com.omertron.themoviedbapi.tools.ApiUrl.*;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
|
@ -43,7 +30,74 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import static com.omertron.themoviedbapi.tools.ApiUrl.*;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.http.client.methods.HttpGet;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.yamj.api.common.http.CommonHttpClient;
|
|
|
|
|
import org.yamj.api.common.http.DigestedResponse;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.omertron.themoviedbapi.MovieDbException.MovieDbExceptionType;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Account;
|
|
|
|
|
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Artwork;
|
|
|
|
|
import com.omertron.themoviedbapi.model.ArtworkType;
|
|
|
|
|
import com.omertron.themoviedbapi.model.ChangeKeyItem;
|
|
|
|
|
import com.omertron.themoviedbapi.model.ChangedItem;
|
|
|
|
|
import com.omertron.themoviedbapi.model.ChangedMovie;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Collection;
|
|
|
|
|
import com.omertron.themoviedbapi.model.CollectionInfo;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Company;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Discover;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Genre;
|
|
|
|
|
import com.omertron.themoviedbapi.model.JobDepartment;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Keyword;
|
|
|
|
|
import com.omertron.themoviedbapi.model.KeywordMovie;
|
|
|
|
|
import com.omertron.themoviedbapi.model.ListItemStatus;
|
|
|
|
|
import com.omertron.themoviedbapi.model.MovieDb;
|
|
|
|
|
import com.omertron.themoviedbapi.model.MovieDbList;
|
|
|
|
|
import com.omertron.themoviedbapi.model.MovieDbListStatus;
|
|
|
|
|
import com.omertron.themoviedbapi.model.MovieList;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Person;
|
|
|
|
|
import com.omertron.themoviedbapi.model.PersonCredit;
|
|
|
|
|
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Reviews;
|
|
|
|
|
import com.omertron.themoviedbapi.model.StatusCode;
|
|
|
|
|
import com.omertron.themoviedbapi.model.TmdbConfiguration;
|
|
|
|
|
import com.omertron.themoviedbapi.model.TokenAuthorisation;
|
|
|
|
|
import com.omertron.themoviedbapi.model.TokenSession;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Trailer;
|
|
|
|
|
import com.omertron.themoviedbapi.model.Translation;
|
|
|
|
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
|
|
|
|
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
|
|
|
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
|
|
|
|
import com.omertron.themoviedbapi.tools.WebBrowser;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperCollection;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperCompany;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperCompanyMovies;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperConfig;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperGenres;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperImages;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperJobList;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperKeywordMovies;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperKeywords;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperMovie;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieCasts;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieChanges;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieDbList;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieKeywords;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieList;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperPerson;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperPersonCredits;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperPersonList;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperReleaseInfo;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperReviews;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperTrailers;
|
|
|
|
|
import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The MovieDb API
|
|
|
|
|
@ -153,7 +207,18 @@ public class TheMovieDbApi {
|
|
|
|
|
throw new MovieDbException(MovieDbExceptionType.UNKNOWN_CAUSE, "Unable to proces delete request", url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webpage = httpClient.requestContent(httpGet);
|
|
|
|
|
final DigestedResponse response = httpClient.requestContent(httpGet);
|
|
|
|
|
if (response.getStatusCode() >= 300) {
|
|
|
|
|
|
|
|
|
|
if (response.getStatusCode() >= 500) {
|
|
|
|
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.HTTP_503_ERROR, response.getContent(), url, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.HTTP_404_ERROR, response.getContent(), url, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webpage = response.getContent();
|
|
|
|
|
|
|
|
|
|
} catch (URISyntaxException ex) {
|
|
|
|
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, url, ex);
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
|