Updated TV
This commit is contained in:
@@ -190,7 +190,7 @@ public class TmdbMovies extends AbstractMethod {
|
|||||||
results.copyWrapper(wrapper);
|
results.copyWrapper(wrapper);
|
||||||
return results;
|
return results;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie alternative titles", url, ex);
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get alternative titles", url, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,22 @@
|
|||||||
package com.omertron.themoviedbapi.methods;
|
package com.omertron.themoviedbapi.methods;
|
||||||
|
|
||||||
import com.omertron.themoviedbapi.MovieDbException;
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||||
import com.omertron.themoviedbapi.tools.ApiUrl;
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
import com.omertron.themoviedbapi.tools.MethodSub;
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
import com.omertron.themoviedbapi.tools.Param;
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to hold the TV Methods
|
* Class to hold the TV Methods
|
||||||
@@ -54,14 +63,20 @@ public class TmdbTV extends AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
public String getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
|
public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
|
||||||
TmdbParameters parameters = new TmdbParameters();
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
parameters.add(Param.ID, tvID);
|
parameters.add(Param.ID, tvID);
|
||||||
parameters.add(Param.LANGUAGE, language);
|
parameters.add(Param.LANGUAGE, language);
|
||||||
parameters.add(Param.APPEND, appendToResponse);
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
URL url = new ApiUrl(apiKey, MethodBase.TV).buildUrl(parameters);
|
URL url = new ApiUrl(apiKey, MethodBase.TV).buildUrl(parameters);
|
||||||
return null;
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TVInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Info", url, ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,13 +90,19 @@ public class TmdbTV extends AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
public String getTVAccountState(int tvID, String sessionID) throws MovieDbException {
|
public MediaState getTVAccountState(int tvID, String sessionID) throws MovieDbException {
|
||||||
TmdbParameters parameters = new TmdbParameters();
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
parameters.add(Param.ID, tvID);
|
parameters.add(Param.ID, tvID);
|
||||||
parameters.add(Param.SESSION, sessionID);
|
parameters.add(Param.SESSION, sessionID);
|
||||||
|
|
||||||
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
|
||||||
return null;
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaState.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,12 +112,20 @@ public class TmdbTV extends AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
public String getTVAlternativeTitles(int tvID) throws MovieDbException {
|
public TmdbResultsList<AlternativeTitle> getTVAlternativeTitles(int tvID) throws MovieDbException {
|
||||||
TmdbParameters parameters = new TmdbParameters();
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
parameters.add(Param.ID, tvID);
|
parameters.add(Param.ID, tvID);
|
||||||
|
|
||||||
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
|
||||||
return null;
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class);
|
||||||
|
TmdbResultsList<AlternativeTitle> results = new TmdbResultsList<AlternativeTitle>(wrapper.getTitles());
|
||||||
|
results.copyWrapper(wrapper);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get alternative titles", url, ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,14 +137,20 @@ public class TmdbTV extends AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
public String getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException {
|
public WrapperChanges getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException {
|
||||||
TmdbParameters parameters = new TmdbParameters();
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
parameters.add(Param.ID, tvID);
|
parameters.add(Param.ID, tvID);
|
||||||
parameters.add(Param.START_DATE, startDate);
|
parameters.add(Param.START_DATE, startDate);
|
||||||
parameters.add(Param.END_DATE, endDate);
|
parameters.add(Param.END_DATE, endDate);
|
||||||
|
|
||||||
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CHANGES).buildUrl(parameters);
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CHANGES).buildUrl(parameters);
|
||||||
return null;
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, WrapperChanges.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie changes", url, ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ public class Person extends PersonBasic {
|
|||||||
private String placeOfBirth;
|
private String placeOfBirth;
|
||||||
@JsonProperty("popularity")
|
@JsonProperty("popularity")
|
||||||
private float popularity;
|
private float popularity;
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath;
|
|
||||||
|
|
||||||
public boolean isAdult() {
|
public boolean isAdult() {
|
||||||
return adult;
|
return adult;
|
||||||
@@ -122,12 +120,4 @@ public class Person extends PersonBasic {
|
|||||||
this.popularity = popularity;
|
this.popularity = popularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model.person;
|
package com.omertron.themoviedbapi.model.person;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.AbstractIdName;
|
import com.omertron.themoviedbapi.model.AbstractIdName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,4 +28,14 @@ import com.omertron.themoviedbapi.model.AbstractIdName;
|
|||||||
public class PersonBasic extends AbstractIdName {
|
public class PersonBasic extends AbstractIdName {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@JsonProperty("profile_path")
|
||||||
|
private String profilePath;
|
||||||
|
|
||||||
|
public String getProfilePath() {
|
||||||
|
return profilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfilePath(String profilePath) {
|
||||||
|
this.profilePath = profilePath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* 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.model.tv;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.Genre;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.ProductionCompany;
|
||||||
|
import com.omertron.themoviedbapi.model.network.Network;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonBasic;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public class TVInfo extends TVBasic {
|
||||||
|
|
||||||
|
@JsonProperty("created_by")
|
||||||
|
private List<PersonBasic> createdBy;
|
||||||
|
@JsonProperty("episode_run_time")
|
||||||
|
private List<Integer> episodeRunTime;
|
||||||
|
@JsonProperty("genres")
|
||||||
|
private List<Genre> genres;
|
||||||
|
@JsonProperty("homepage")
|
||||||
|
private String homepage;
|
||||||
|
@JsonProperty("in_production")
|
||||||
|
private boolean inProduction;
|
||||||
|
@JsonProperty("languages")
|
||||||
|
private List<String> languages;
|
||||||
|
@JsonProperty("last_air_date")
|
||||||
|
private String lastAirDate;
|
||||||
|
@JsonProperty("networks")
|
||||||
|
private List<Network> networks;
|
||||||
|
@JsonProperty("number_of_episodes")
|
||||||
|
private int numberOfEpisodes;
|
||||||
|
@JsonProperty("number_of_seasons")
|
||||||
|
private int numberOfSeasons;
|
||||||
|
@JsonProperty("original_language")
|
||||||
|
private String originalLanguage;
|
||||||
|
@JsonProperty("overview")
|
||||||
|
private String overview;
|
||||||
|
@JsonProperty("production_companies")
|
||||||
|
private List<ProductionCompany> productionCompanies;
|
||||||
|
@JsonProperty("seasons")
|
||||||
|
private List<TVSeasonBasic> seasons;
|
||||||
|
@JsonProperty("status")
|
||||||
|
private String status;
|
||||||
|
@JsonProperty("type")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public List<PersonBasic> getCreatedBy() {
|
||||||
|
return createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBy(List<PersonBasic> createdBy) {
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getEpisodeRunTime() {
|
||||||
|
return episodeRunTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEpisodeRunTime(List<Integer> episodeRunTime) {
|
||||||
|
this.episodeRunTime = episodeRunTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Genre> getGenres() {
|
||||||
|
return genres;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGenres(List<Genre> genres) {
|
||||||
|
this.genres = genres;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHomepage() {
|
||||||
|
return homepage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHomepage(String homepage) {
|
||||||
|
this.homepage = homepage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInProduction() {
|
||||||
|
return inProduction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInProduction(boolean inProduction) {
|
||||||
|
this.inProduction = inProduction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getLanguages() {
|
||||||
|
return languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguages(List<String> languages) {
|
||||||
|
this.languages = languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastAirDate() {
|
||||||
|
return lastAirDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastAirDate(String lastAirDate) {
|
||||||
|
this.lastAirDate = lastAirDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Network> getNetworks() {
|
||||||
|
return networks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNetworks(List<Network> networks) {
|
||||||
|
this.networks = networks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumberOfEpisodes() {
|
||||||
|
return numberOfEpisodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumberOfEpisodes(int numberOfEpisodes) {
|
||||||
|
this.numberOfEpisodes = numberOfEpisodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumberOfSeasons() {
|
||||||
|
return numberOfSeasons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumberOfSeasons(int numberOfSeasons) {
|
||||||
|
this.numberOfSeasons = numberOfSeasons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalLanguage() {
|
||||||
|
return originalLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalLanguage(String originalLanguage) {
|
||||||
|
this.originalLanguage = originalLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOverview() {
|
||||||
|
return overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverview(String overview) {
|
||||||
|
this.overview = overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProductionCompany> getProductionCompanies() {
|
||||||
|
return productionCompanies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
|
||||||
|
this.productionCompanies = productionCompanies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TVSeasonBasic> getSeasons() {
|
||||||
|
return seasons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeasons(List<TVSeasonBasic> seasons) {
|
||||||
|
this.seasons = seasons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,12 +29,24 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
*/
|
*/
|
||||||
public class TVSeasonBasic extends AbstractJsonMapping {
|
public class TVSeasonBasic extends AbstractJsonMapping {
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id = -1;
|
||||||
@JsonProperty("air_date")
|
@JsonProperty("air_date")
|
||||||
private String airDate;
|
private String airDate;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
private String posterPath;
|
private String posterPath;
|
||||||
@JsonProperty("season_number")
|
@JsonProperty("season_number")
|
||||||
private int seasonNumber;
|
private int seasonNumber;
|
||||||
|
@JsonProperty("episode_count")
|
||||||
|
private int episodeCount = -1;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAirDate() {
|
public String getAirDate() {
|
||||||
return airDate;
|
return airDate;
|
||||||
@@ -59,4 +71,13 @@ public class TVSeasonBasic extends AbstractJsonMapping {
|
|||||||
public void setSeasonNumber(int seasonNumber) {
|
public void setSeasonNumber(int seasonNumber) {
|
||||||
this.seasonNumber = seasonNumber;
|
this.seasonNumber = seasonNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getEpisodeCount() {
|
||||||
|
return episodeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEpisodeCount(int episodeCount) {
|
||||||
|
this.episodeCount = episodeCount;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ public class TmdbMoviesTest extends AbstractTests {
|
|||||||
int maxCheck = 5;
|
int maxCheck = 5;
|
||||||
|
|
||||||
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||||
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.PERSON, null, null, null);
|
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||||
LOG.info("Found {} person changes to check", changeList.size());
|
LOG.info("Found {} changes to check, will check maximum of {}", changeList.size(), maxCheck);
|
||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
WrapperChanges result;
|
WrapperChanges result;
|
||||||
|
|||||||
@@ -20,10 +20,26 @@
|
|||||||
package com.omertron.themoviedbapi.methods;
|
package com.omertron.themoviedbapi.methods;
|
||||||
|
|
||||||
import com.omertron.themoviedbapi.AbstractTests;
|
import com.omertron.themoviedbapi.AbstractTests;
|
||||||
|
import static com.omertron.themoviedbapi.AbstractTests.getApiKey;
|
||||||
|
import static com.omertron.themoviedbapi.AbstractTests.getHttpTools;
|
||||||
import com.omertron.themoviedbapi.MovieDbException;
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
import com.omertron.themoviedbapi.TestID;
|
import com.omertron.themoviedbapi.TestID;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -47,8 +63,8 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
instance = new TmdbTV(getApiKey(), getHttpTools());
|
instance = new TmdbTV(getApiKey(), getHttpTools());
|
||||||
|
|
||||||
TV_IDS.add(new TestID("The Walking Dead", "tt1520211", 1402));
|
TV_IDS.add(new TestID("The Walking Dead", "tt1520211", 1402));
|
||||||
TV_IDS.add(new TestID("Supernatural", "tt0460681", 1622));
|
// TV_IDS.add(new TestID("Supernatural", "tt0460681", 1622));
|
||||||
TV_IDS.add(new TestID("The Big Bang Theory", "tt0898266", 1418));
|
// TV_IDS.add(new TestID("The Big Bang Theory", "tt0898266", 1418));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +72,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
// @Test
|
||||||
public void testGetTVInfo() throws MovieDbException {
|
public void testGetTVInfo() throws MovieDbException {
|
||||||
LOG.info("getTVInfo");
|
LOG.info("getTVInfo");
|
||||||
|
|
||||||
@@ -64,10 +80,13 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
String[] appendToResponse = null;
|
String[] appendToResponse = null;
|
||||||
|
|
||||||
for (TestID test : TV_IDS) {
|
for (TestID test : TV_IDS) {
|
||||||
String result = instance.getTVInfo(test.getTmdb(), language, appendToResponse);
|
TVInfo result = instance.getTVInfo(test.getTmdb(), language, appendToResponse);
|
||||||
|
assertTrue("No ID", result.getId() > 0);
|
||||||
|
assertFalse("No runtime", result.getEpisodeRunTime().isEmpty());
|
||||||
|
assertFalse("No genres", result.getGenres().isEmpty());
|
||||||
|
assertTrue("No season count", result.getNumberOfSeasons() > 0);
|
||||||
|
assertTrue("No episode count", result.getNumberOfEpisodes() > 0);
|
||||||
}
|
}
|
||||||
// TODO review the generated test code and remove the default call to fail.
|
|
||||||
fail("The test case is a prototype.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,15 +94,15 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
// @Test
|
||||||
public void testGetTVAccountState() throws MovieDbException {
|
public void testGetTVAccountState() throws MovieDbException {
|
||||||
LOG.info("getTVAccountState");
|
LOG.info("getTVAccountState");
|
||||||
|
|
||||||
for (TestID test : TV_IDS) {
|
for (TestID test : TV_IDS) {
|
||||||
String result = instance.getTVAccountState(test.getTmdb(), getSessionId());
|
MediaState result = instance.getTVAccountState(test.getTmdb(), getSessionId());
|
||||||
|
assertNotNull("Null result", result);
|
||||||
|
assertTrue("Invalid rating", result.getRated() > -2f);
|
||||||
}
|
}
|
||||||
// TODO review the generated test code and remove the default call to fail.
|
|
||||||
fail("The test case is a prototype.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,15 +110,14 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
// @Test
|
||||||
public void testGetTVAlternativeTitles() throws MovieDbException {
|
public void testGetTVAlternativeTitles() throws MovieDbException {
|
||||||
LOG.info("getTVAlternativeTitles");
|
LOG.info("getTVAlternativeTitles");
|
||||||
|
|
||||||
for (TestID test : TV_IDS) {
|
for (TestID test : TV_IDS) {
|
||||||
String result = instance.getTVAlternativeTitles(test.getTmdb());
|
TmdbResultsList<AlternativeTitle> result = instance.getTVAlternativeTitles(test.getTmdb());
|
||||||
|
assertFalse("No alt titles", result.isEmpty());
|
||||||
}
|
}
|
||||||
// TODO review the generated test code and remove the default call to fail.
|
|
||||||
fail("The test case is a prototype.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,18 +125,30 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
// @Test
|
||||||
public void testGetTVChanges() throws MovieDbException {
|
public void testGetTVChanges() throws MovieDbException {
|
||||||
LOG.info("getTVChanges");
|
LOG.info("getTVChanges");
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
String startDate = "";
|
String startDate = sdf.format(DateUtils.addDays(new Date(), -14));
|
||||||
String endDate = "";
|
String endDate = "";
|
||||||
|
int maxCheck = 5;
|
||||||
|
|
||||||
for (TestID test : TV_IDS) {
|
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||||
String result = instance.getTVChanges(test.getTmdb(), startDate, endDate);
|
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.TV, null, null, null);
|
||||||
|
LOG.info("Found {} changes to check, will check maximum of {}", changeList.size(), maxCheck);
|
||||||
|
|
||||||
|
int count = 1;
|
||||||
|
WrapperChanges result;
|
||||||
|
for (ChangeListItem item : changeList) {
|
||||||
|
result = instance.getTVChanges(item.getId(), startDate, endDate);
|
||||||
|
for (ChangeKeyItem ci : result.getChangedItems()) {
|
||||||
|
assertNotNull("Null changes", ci);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count++ > maxCheck) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO review the generated test code and remove the default call to fail.
|
|
||||||
fail("The test case is a prototype.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,8 +163,6 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
for (TestID test : TV_IDS) {
|
for (TestID test : TV_IDS) {
|
||||||
String result = instance.getTVContentRatings(test.getTmdb());
|
String result = instance.getTVContentRatings(test.getTmdb());
|
||||||
}
|
}
|
||||||
// TODO review the generated test code and remove the default call to fail.
|
|
||||||
fail("The test case is a prototype.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,7 +170,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVCredits() throws MovieDbException {
|
public void testGetTVCredits() throws MovieDbException {
|
||||||
LOG.info("getTVCredits");
|
LOG.info("getTVCredits");
|
||||||
|
|
||||||
@@ -161,7 +189,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVExternalIDs() throws MovieDbException {
|
public void testGetTVExternalIDs() throws MovieDbException {
|
||||||
LOG.info("getTVExternalIDs");
|
LOG.info("getTVExternalIDs");
|
||||||
|
|
||||||
@@ -179,7 +207,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVImages() throws MovieDbException {
|
public void testGetTVImages() throws MovieDbException {
|
||||||
LOG.info("getTVImages");
|
LOG.info("getTVImages");
|
||||||
|
|
||||||
@@ -198,7 +226,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVKeywords() throws MovieDbException {
|
public void testGetTVKeywords() throws MovieDbException {
|
||||||
LOG.info("getTVKeywords");
|
LOG.info("getTVKeywords");
|
||||||
|
|
||||||
@@ -216,7 +244,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testPostTVRating() throws MovieDbException {
|
public void testPostTVRating() throws MovieDbException {
|
||||||
LOG.info("postTVRating");
|
LOG.info("postTVRating");
|
||||||
|
|
||||||
@@ -234,7 +262,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVSimilar() throws MovieDbException {
|
public void testGetTVSimilar() throws MovieDbException {
|
||||||
LOG.info("getTVSimilar");
|
LOG.info("getTVSimilar");
|
||||||
|
|
||||||
@@ -254,7 +282,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVTranslations() throws MovieDbException {
|
public void testGetTVTranslations() throws MovieDbException {
|
||||||
LOG.info("getTVTranslations");
|
LOG.info("getTVTranslations");
|
||||||
|
|
||||||
@@ -270,7 +298,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVVideos() throws MovieDbException {
|
public void testGetTVVideos() throws MovieDbException {
|
||||||
LOG.info("getTVVideos");
|
LOG.info("getTVVideos");
|
||||||
|
|
||||||
@@ -288,7 +316,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVLatest() throws MovieDbException {
|
public void testGetTVLatest() throws MovieDbException {
|
||||||
LOG.info("getTVLatest");
|
LOG.info("getTVLatest");
|
||||||
|
|
||||||
@@ -304,7 +332,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVOnTheAir() throws MovieDbException {
|
public void testGetTVOnTheAir() throws MovieDbException {
|
||||||
LOG.info("getTVOnTheAir");
|
LOG.info("getTVOnTheAir");
|
||||||
Integer page = null;
|
Integer page = null;
|
||||||
@@ -322,7 +350,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVAiringToday() throws MovieDbException {
|
public void testGetTVAiringToday() throws MovieDbException {
|
||||||
LOG.info("getTVAiringToday");
|
LOG.info("getTVAiringToday");
|
||||||
Integer page = null;
|
Integer page = null;
|
||||||
@@ -341,7 +369,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVTopRated() throws MovieDbException {
|
public void testGetTVTopRated() throws MovieDbException {
|
||||||
LOG.info("getTVTopRated");
|
LOG.info("getTVTopRated");
|
||||||
Integer page = null;
|
Integer page = null;
|
||||||
@@ -359,7 +387,7 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
*
|
*
|
||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void testGetTVPopular() throws MovieDbException {
|
public void testGetTVPopular() throws MovieDbException {
|
||||||
LOG.info("getTVPopular");
|
LOG.info("getTVPopular");
|
||||||
Integer page = null;
|
Integer page = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user