Partial Find (not working)
This commit is contained in:
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.enumeration.ExternalSource;
|
||||
import com.omertron.themoviedbapi.model2.FindResults;
|
||||
import com.omertron.themoviedbapi.model2.MediaBasic;
|
||||
import com.omertron.themoviedbapi.model2.MediaTypeMixIn;
|
||||
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
@@ -46,6 +48,8 @@ public class TmdbFind extends AbstractMethod {
|
||||
*/
|
||||
public TmdbFind(String apiKey, HttpTools httpTools) {
|
||||
super(apiKey, httpTools);
|
||||
|
||||
MAPPER.addMixIn(MediaBasic.class, MediaTypeMixIn.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +85,6 @@ public class TmdbFind extends AbstractMethod {
|
||||
try {
|
||||
return MAPPER.readValue(webpage, FindResults.class);
|
||||
} catch (IOException ex) {
|
||||
LOG.info("{}",ex.getMessage(),ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get find results", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,27 +20,12 @@
|
||||
package com.omertron.themoviedbapi.model2;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.omertron.themoviedbapi.model2.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model2.tv.TVBasic;
|
||||
|
||||
/**
|
||||
* Basic media information
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonTypeInfo(
|
||||
use = JsonTypeInfo.Id.NAME,
|
||||
include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
|
||||
property = "media_type",
|
||||
defaultImpl = MovieBasic.class
|
||||
)
|
||||
@JsonSubTypes({
|
||||
@Type(value = MovieBasic.class, name = "movie"),
|
||||
@Type(value = TVBasic.class, name = "tv")
|
||||
})
|
||||
public class MediaBasic extends AbstractJsonMapping {
|
||||
|
||||
@JsonProperty("id")
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package com.omertron.themoviedbapi.model2;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.omertron.themoviedbapi.model2.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model2.tv.TVBasic;
|
||||
|
||||
@JsonTypeInfo(
|
||||
use = JsonTypeInfo.Id.NAME,
|
||||
include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
|
||||
property = "media_type",
|
||||
defaultImpl = MovieBasic.class
|
||||
)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = MovieBasic.class, name = "movie"),
|
||||
@JsonSubTypes.Type(value = TVBasic.class, name = "tv")
|
||||
})
|
||||
public class MediaTypeMixIn {
|
||||
|
||||
}
|
||||
|
||||
@@ -119,6 +119,9 @@ public class TmdbFindTest extends AbstractTests {
|
||||
assertFalse("No person for ID: " + test.getName(), result.getPersonResults().isEmpty());
|
||||
boolean found = false;
|
||||
for (PersonFind p : result.getPersonResults()) {
|
||||
for (Object x : p.getKnownFor()) {
|
||||
LOG.info(" {}", x.toString());
|
||||
}
|
||||
if (p.getId() == test.getTmdb()) {
|
||||
found = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user