TV Seasons
This commit is contained in:
@@ -64,12 +64,12 @@ import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
|
||||
import com.omertron.themoviedbapi.model.movie.Translation;
|
||||
import com.omertron.themoviedbapi.model.movie.Video;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.network.Network;
|
||||
import com.omertron.themoviedbapi.model.person.ContentRating;
|
||||
import com.omertron.themoviedbapi.model.person.CreditInfo;
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.omertron.themoviedbapi.model.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model.company.Company;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.person.ContentRating;
|
||||
|
||||
@@ -27,11 +27,11 @@ import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
|
||||
import com.omertron.themoviedbapi.model.movie.Translation;
|
||||
import com.omertron.themoviedbapi.model.movie.Video;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.review.Review;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||
|
||||
@@ -26,9 +26,9 @@ import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.Translation;
|
||||
import com.omertron.themoviedbapi.model.movie.Video;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.person.ContentRating;
|
||||
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||
@@ -158,7 +158,7 @@ public class TmdbTV extends AbstractMethod {
|
||||
try {
|
||||
return MAPPER.readValue(webpage, WrapperChanges.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie changes", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class TmdbTV extends AbstractMethod {
|
||||
try {
|
||||
return MAPPER.readValue(webpage, MediaCreditList.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie credits", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ public class TmdbTV extends AbstractMethod {
|
||||
try {
|
||||
return MAPPER.readValue(webpage, TVInfo.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest movie", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest TV show", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,27 @@
|
||||
package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||
import com.omertron.themoviedbapi.model.tv.TVSeasonInfo;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
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 com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperImages;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperVideos;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yamj.api.common.exception.ApiExceptionType;
|
||||
|
||||
/**
|
||||
* Class to hold the TV Methods
|
||||
@@ -57,7 +71,7 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonInfo(int tvID, int seasonNumber, String language, String... appendToResponse) throws MovieDbException {
|
||||
public TVSeasonInfo getSeasonInfo(int tvID, int seasonNumber, String language, String... appendToResponse) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, tvID);
|
||||
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||
@@ -65,7 +79,14 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
parameters.add(Param.APPEND, appendToResponse);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEASON).buildUrl(parameters);
|
||||
return null;
|
||||
String webpage = httpTools.getRequest(url);
|
||||
|
||||
try {
|
||||
return MAPPER.readValue(webpage, TVSeasonInfo.class);
|
||||
} catch (IOException ex) {
|
||||
LoggerFactory.getLogger("test").warn("{}", ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV SeasonInfo", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,14 +98,20 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonChanges(int tvID, String startDate, String endDate) throws MovieDbException {
|
||||
public WrapperChanges getSeasonChanges(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.SEASON).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 changes", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,13 +125,19 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonAccountState(int tvID, String sessionID) throws MovieDbException {
|
||||
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, tvID);
|
||||
parameters.add(Param.SESSION_ID, sessionID);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEASON).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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,13 +148,18 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonCredits(int tvID, int seasonNumber) throws MovieDbException {
|
||||
public MediaCreditList getSeasonCredits(int tvID, int seasonNumber) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, tvID);
|
||||
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.CREDITS).buildUrl(parameters);
|
||||
return null;
|
||||
String webpage = httpTools.getRequest(url);
|
||||
try {
|
||||
return MAPPER.readValue(webpage, MediaCreditList.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,14 +172,20 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException {
|
||||
public ExternalID getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, tvID);
|
||||
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||
parameters.add(Param.LANGUAGE, language);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters);
|
||||
return null;
|
||||
String webpage = httpTools.getRequest(url);
|
||||
|
||||
try {
|
||||
return MAPPER.readValue(webpage, ExternalID.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get external IDs", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +198,7 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonImages(int tvID, int seasonNumber, String language, String... includeImageLanguage) throws MovieDbException {
|
||||
public TmdbResultsList<Artwork> getSeasonImages(int tvID, int seasonNumber, String language, String... includeImageLanguage) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, tvID);
|
||||
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||
@@ -162,7 +206,16 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
parameters.add(Param.APPEND, includeImageLanguage);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.IMAGES).buildUrl(parameters);
|
||||
return null;
|
||||
String webpage = httpTools.getRequest(url);
|
||||
|
||||
try {
|
||||
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||
TmdbResultsList<Artwork> results = new TmdbResultsList<Artwork>(wrapper.getAll());
|
||||
results.copyWrapper(wrapper);
|
||||
return results;
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,13 +228,22 @@ public class TmdbTVSeasons extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public String getSeasonVideos(int tvID, int seasonNumber, String language) throws MovieDbException {
|
||||
public TmdbResultsList<Video> getSeasonVideos(int tvID, int seasonNumber, String language) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, tvID);
|
||||
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||
parameters.add(Param.LANGUAGE, language);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.VIDEOS).buildUrl(parameters);
|
||||
return null;
|
||||
String webpage = httpTools.getRequest(url);
|
||||
|
||||
try {
|
||||
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
|
||||
TmdbResultsList<Video> results = new TmdbResultsList<Video>(wrapper.getVideos());
|
||||
results.copyWrapper(wrapper);
|
||||
return results;
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model.movie;
|
||||
package com.omertron.themoviedbapi.model.media;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model.movie;
|
||||
package com.omertron.themoviedbapi.model.media;
|
||||
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model.movie;
|
||||
package com.omertron.themoviedbapi.model.media;
|
||||
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model.movie;
|
||||
package com.omertron.themoviedbapi.model.media;
|
||||
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@@ -19,6 +19,9 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model.movie;
|
||||
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.media.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditCrew;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TV Episode information
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TVEpisodeInfo extends TVEpisodeBasic {
|
||||
|
||||
@JsonProperty("crew")
|
||||
private List<MediaCreditCrew> crew;
|
||||
@JsonProperty("guest_stars")
|
||||
private List<MediaCreditCast> guestStars;
|
||||
@JsonProperty("production_code")
|
||||
private String productionCode;
|
||||
|
||||
public List<MediaCreditCrew> getCrew() {
|
||||
return crew;
|
||||
}
|
||||
|
||||
public void setCrew(List<MediaCreditCrew> crew) {
|
||||
this.crew = crew;
|
||||
}
|
||||
|
||||
public List<MediaCreditCast> getGuestStars() {
|
||||
return guestStars;
|
||||
}
|
||||
|
||||
public void setGuestStars(List<MediaCreditCast> guestStars) {
|
||||
this.guestStars = guestStars;
|
||||
}
|
||||
|
||||
public String getProductionCode() {
|
||||
return productionCode;
|
||||
}
|
||||
|
||||
public void setProductionCode(String productionCode) {
|
||||
this.productionCode = productionCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 java.util.List;
|
||||
|
||||
/**
|
||||
* TV Season information
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TVSeasonInfo extends TVSeasonBasic {
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("overview")
|
||||
private String overview;
|
||||
@JsonProperty("episodes")
|
||||
private List<TVEpisodeInfo> episodes;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getOverview() {
|
||||
return overview;
|
||||
}
|
||||
|
||||
public void setOverview(String overview) {
|
||||
this.overview = overview;
|
||||
}
|
||||
|
||||
public List<TVEpisodeInfo> getEpisodes() {
|
||||
return episodes;
|
||||
}
|
||||
|
||||
public void setEpisodes(List<TVEpisodeInfo> episodes) {
|
||||
this.episodes = episodes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.movie.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import com.omertron.themoviedbapi.model.movie.Trailer;
|
||||
import com.omertron.themoviedbapi.model.movie.Video;
|
||||
import com.omertron.themoviedbapi.model.media.Trailer;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -34,11 +34,11 @@ import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
|
||||
import com.omertron.themoviedbapi.model.movie.Translation;
|
||||
import com.omertron.themoviedbapi.model.movie.Video;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.review.Review;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeInfo() throws MovieDbException {
|
||||
System.out.println("getEpisodeInfo");
|
||||
LOG.info("getEpisodeInfo");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
@@ -93,7 +93,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeChanges() throws MovieDbException {
|
||||
System.out.println("getEpisodeChanges");
|
||||
LOG.info("getEpisodeChanges");
|
||||
int episodeID = 0;
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
@@ -112,7 +112,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeAccountState() throws MovieDbException {
|
||||
System.out.println("getEpisodeAccountState");
|
||||
LOG.info("getEpisodeAccountState");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
@@ -132,7 +132,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeCredits() throws MovieDbException {
|
||||
System.out.println("getEpisodeCredits");
|
||||
LOG.info("getEpisodeCredits");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
@@ -151,7 +151,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeExternalID() throws MovieDbException {
|
||||
System.out.println("getEpisodeExternalID");
|
||||
LOG.info("getEpisodeExternalID");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
@@ -171,7 +171,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeImages() throws MovieDbException {
|
||||
System.out.println("getEpisodeImages");
|
||||
LOG.info("getEpisodeImages");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
@@ -190,7 +190,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testPostEpisodeRating() throws MovieDbException {
|
||||
System.out.println("postEpisodeRating");
|
||||
LOG.info("postEpisodeRating");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
@@ -212,7 +212,7 @@ public class TmdbTVEpisodesTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetEpisodeVideos() throws MovieDbException {
|
||||
System.out.println("getEpisodeVideos");
|
||||
LOG.info("getEpisodeVideos");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
int episodeNumber = 0;
|
||||
|
||||
@@ -25,11 +25,31 @@ import static com.omertron.themoviedbapi.AbstractTests.getApiKey;
|
||||
import static com.omertron.themoviedbapi.AbstractTests.getHttpTools;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestID;
|
||||
import com.omertron.themoviedbapi.enumeration.ArtworkType;
|
||||
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||
import com.omertron.themoviedbapi.model.tv.TVSeasonInfo;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -75,17 +95,19 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonInfo() throws MovieDbException {
|
||||
System.out.println("getSeasonInfo");
|
||||
int tvID = 0;
|
||||
int seasonNumber = 0;
|
||||
LOG.info("getSeasonInfo");
|
||||
|
||||
int seasonNumber = 1;
|
||||
String language = LANGUAGE_DEFAULT;
|
||||
String[] appendToResponse = null;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonInfo(tvID, seasonNumber, language, appendToResponse);
|
||||
TVSeasonInfo result = instance.getSeasonInfo(test.getTmdb(), seasonNumber, language, appendToResponse);
|
||||
assertTrue("No ID", result.getId() > 0);
|
||||
assertTrue("No name", StringUtils.isNotBlank(result.getName()));
|
||||
assertTrue("No overview", StringUtils.isNotBlank(result.getOverview()));
|
||||
assertTrue("No episodes", result.getEpisodes().size() > 0);
|
||||
}
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,16 +117,30 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonChanges() throws MovieDbException {
|
||||
System.out.println("getSeasonChanges");
|
||||
int tvID = 0;
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
LOG.info("getSeasonChanges");
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonChanges(tvID, startDate, endDate);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startDate = sdf.format(DateUtils.addDays(new Date(), -14));
|
||||
String endDate = "";
|
||||
int maxCheck = 5;
|
||||
|
||||
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
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.getSeasonChanges(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.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,15 +150,13 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonAccountState() throws MovieDbException {
|
||||
System.out.println("getSeasonAccountState");
|
||||
int tvID = 0;
|
||||
String sessionID = "";
|
||||
LOG.info("getSeasonAccountState");
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonAccountState(tvID, sessionID);
|
||||
MediaState result = instance.getSeasonAccountState(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.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,15 +166,27 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonCredits() throws MovieDbException {
|
||||
System.out.println("getSeasonCredits");
|
||||
int tvID = 0;
|
||||
LOG.info("getSeasonCredits");
|
||||
|
||||
int seasonNumber = 0;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonCredits(tvID, seasonNumber);
|
||||
MediaCreditList result = instance.getSeasonCredits(test.getTmdb(), seasonNumber);
|
||||
assertNotNull(result);
|
||||
assertFalse(result.getCast().isEmpty());
|
||||
|
||||
boolean found = false;
|
||||
for (MediaCreditCast p : result.getCast()) {
|
||||
if (test.getOther().equals(p.getName())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(test.getOther() + " not found in cast!", found);
|
||||
|
||||
assertFalse(result.getCrew().isEmpty());
|
||||
break;
|
||||
}
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,16 +196,15 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonExternalID() throws MovieDbException {
|
||||
System.out.println("getSeasonExternalID");
|
||||
int tvID = 0;
|
||||
LOG.info("getSeasonExternalID");
|
||||
|
||||
int seasonNumber = 0;
|
||||
String language = LANGUAGE_DEFAULT;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonExternalID(tvID, seasonNumber, language);
|
||||
ExternalID result = instance.getSeasonExternalID(test.getTmdb(), seasonNumber, language);
|
||||
assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbId());
|
||||
}
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,17 +214,33 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonImages() throws MovieDbException {
|
||||
System.out.println("getSeasonImages");
|
||||
int tvID = 0;
|
||||
LOG.info("getSeasonImages");
|
||||
|
||||
int seasonNumber = 0;
|
||||
String language = LANGUAGE_DEFAULT;
|
||||
String[] includeImageLanguage = null;
|
||||
|
||||
boolean foundBackdrop = false;
|
||||
boolean foundPoster = false;
|
||||
boolean foundOther = false;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonImages(tvID, seasonNumber, language, includeImageLanguage);
|
||||
TmdbResultsList<Artwork> result = instance.getSeasonImages(test.getTmdb(), seasonNumber, language, includeImageLanguage);
|
||||
assertFalse("No artwork", result.isEmpty());
|
||||
for (Artwork artwork : result.getResults()) {
|
||||
if (artwork.getArtworkType() == ArtworkType.BACKDROP) {
|
||||
foundBackdrop = true;
|
||||
continue;
|
||||
} else if (artwork.getArtworkType() == ArtworkType.POSTER) {
|
||||
foundPoster = true;
|
||||
continue;
|
||||
}
|
||||
foundOther = true;
|
||||
}
|
||||
assertTrue("No backdrops", foundBackdrop);
|
||||
assertTrue("No posters", foundPoster);
|
||||
assertFalse("Something else found!", foundOther);
|
||||
}
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,16 +250,15 @@ public class TmdbTVSeasonsTest extends AbstractTests {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSeasonVideos() throws MovieDbException {
|
||||
System.out.println("getSeasonVideos");
|
||||
int tvID = 0;
|
||||
LOG.info("getSeasonVideos");
|
||||
|
||||
int seasonNumber = 0;
|
||||
String language = LANGUAGE_DEFAULT;
|
||||
|
||||
for (TestID test : TV_IDS) {
|
||||
String result = instance.getSeasonVideos(tvID, seasonNumber, language);
|
||||
TmdbResultsList<Video> result = instance.getSeasonVideos(test.getTmdb(), seasonNumber, language);
|
||||
assertFalse("No videos", result.isEmpty());
|
||||
}
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||
import com.omertron.themoviedbapi.model.movie.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.Translation;
|
||||
import com.omertron.themoviedbapi.model.movie.Video;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.media.Translation;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.person.ContentRating;
|
||||
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||
|
||||
Reference in New Issue
Block a user