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 type = getString(it, "type");
String name = getString(it, "name"); String name = getString(it, "name");
String site = getString(it, "site"); String site = getString(it, "site");
String key = getString(it, "key");
Integer size = getInteger(it, "size"); 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("_")); 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); }).forEach(trailers::add);
} catch (Exception e) { } catch (Exception e) {
debug.warning(format("Bad data: trailers => %s", response)); debug.warning(format("Bad data: trailers => %s", response));

View File

@ -7,6 +7,7 @@ public class Trailer implements Serializable {
protected String type; protected String type;
protected String name; protected String name;
protected String site; protected String site;
protected String key;
protected Integer size; protected Integer size;
protected String language; protected String language;
@ -14,10 +15,11 @@ public class Trailer implements Serializable {
// used by serializer // 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.type = type;
this.name = name; this.name = name;
this.site = site; this.site = site;
this.key = key;
this.size = size; this.size = size;
this.language = language; this.language = language;
} }
@ -34,13 +36,17 @@ public class Trailer implements Serializable {
return size; return size;
} }
public String getKey() {
return key;
}
public String getLanguage() { public String getLanguage() {
return language; return language;
} }
@Override @Override
public String toString() { 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);
} }
} }