Support for Trailer.getKey()

This commit is contained in:
Reinhard Pointner 2017-07-19 15:16:12 +08:00
parent 548f59decc
commit 5eaeeeced6
2 changed files with 10 additions and 3 deletions

View File

@ -272,9 +272,10 @@ public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
String type = getString(it, "type");
String name = getString(it, "name");
String site = getString(it, "site");
String key = getString(it, "key");
Integer size = getInteger(it, "size");
String lang = Stream.of("iso_639_1", "iso_3166_1").map(k -> getString(it, k)).filter(Objects::nonNull).collect(joining("_"));
return new Trailer(type, name, site, size, lang);
return new Trailer(type, name, site, key, size, lang);
}).forEach(trailers::add);
} catch (Exception e) {
debug.warning(format("Bad data: trailers => %s", response));

View File

@ -7,6 +7,7 @@ public class Trailer implements Serializable {
protected String type;
protected String name;
protected String site;
protected String key;
protected Integer size;
protected String language;
@ -14,10 +15,11 @@ public class Trailer implements Serializable {
// used by serializer
}
public Trailer(String type, String name, String site, Integer size, String language) {
public Trailer(String type, String name, String site, String key, Integer size, String language) {
this.type = type;
this.name = name;
this.site = site;
this.key = key;
this.size = size;
this.language = language;
}
@ -34,13 +36,17 @@ public class Trailer implements Serializable {
return size;
}
public String getKey() {
return key;
}
public String getLanguage() {
return language;
}
@Override
public String toString() {
return String.format("%s [%s] [%s] [%s]", name, type, size, language);
return String.format("%s [%s] [%s] [%s] [%s::%s]", name, type, size, language, site, key);
}
}