diff --git a/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java b/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java index 61d22ba52..711e22e7d 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java @@ -28,6 +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.movie.MovieBasic; import com.omertron.themoviedbapi.model.movie.MovieDb; import com.omertron.themoviedbapi.model.person.ContentRating; @@ -89,6 +90,8 @@ public class AbstractMethod { }); TYPE_REFS.put(TVInfo.class, new TypeReference>() { }); + TYPE_REFS.put(AlternativeTitle.class, new TypeReference>() { + }); } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java index 8e815764d..ee85eb28e 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java @@ -42,7 +42,6 @@ import com.omertron.themoviedbapi.tools.Param; import com.omertron.themoviedbapi.tools.PostBody; import com.omertron.themoviedbapi.tools.PostTools; import com.omertron.themoviedbapi.tools.TmdbParameters; -import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles; import com.omertron.themoviedbapi.wrapper.WrapperChanges; import com.omertron.themoviedbapi.wrapper.WrapperGenericList; import com.omertron.themoviedbapi.wrapper.WrapperImages; @@ -134,15 +133,8 @@ public class TmdbTV extends AbstractMethod { parameters.add(Param.ID, tvID); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters); - String webpage = httpTools.getRequest(url); - try { - WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class); - TmdbResultsList results = new TmdbResultsList(wrapper.getTitles()); - results.copyWrapper(wrapper); - return results; - } catch (IOException ex) { - throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get alternative titles", url, ex); - } + WrapperGenericList wrapper = processWrapper(getTypeReference(AlternativeTitle.class), url, "alternative titles"); + return wrapper.getTmdbResultsList(); } /** diff --git a/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt b/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt index f4099269a..33b025846 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt +++ b/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt @@ -118,7 +118,7 @@ Search (Done) Timezones (Done - part of configuration) /timezones/list Get the list of supported timezones for the API methods that support them. -TV +TV (Done) /tv/{id} Get the primary information about a TV series by id. /tv/{id}/account_states 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. /tv/{id}/alternative_titles Get the alternative titles for a specific show ID.