Collect more data from TheTVDB search queries (to maybe present better options to the user, including years and banners)
This commit is contained in:
parent
3f2a8ee5a6
commit
086bd41552
|
@ -142,14 +142,21 @@ public class TheTVDBClient extends AbstractEpisodeListProvider implements Artwor
|
|||
// e.g. aliases, banner, firstAired, id, network, overview, seriesName, status
|
||||
int id = getInteger(it, "id");
|
||||
String seriesName = getString(it, "seriesName");
|
||||
String[] aliasNames = stream(getArray(it, "aliases")).toArray(String[]::new);
|
||||
|
||||
if (seriesName == null || seriesName.startsWith("**") || seriesName.endsWith("**")) {
|
||||
debug.warning(format("Ignore invalid series: %s [%d]", seriesName, id));
|
||||
return null;
|
||||
}
|
||||
|
||||
return new SearchResult(id, seriesName, aliasNames);
|
||||
String[] aliasNames = stream(getArray(it, "aliases")).toArray(String[]::new);
|
||||
String slug = getString(it, "slug");
|
||||
String network = getString(it, "network");
|
||||
String status = getString(it, "status");
|
||||
SimpleDate firstAired = getStringValue(it, "firstAired", SimpleDate::parse);
|
||||
String overview = getString(it, "overview");
|
||||
URL banner = getStringValue(it, "banner", this::resolveImage);
|
||||
|
||||
return new TheTVDBSearchResult(id, seriesName, aliasNames, slug, firstAired, overview, network, status, banner);
|
||||
}).filter(Objects::nonNull).collect(toList());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package net.filebot.web;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public class TheTVDBSearchResult extends SearchResult {
|
||||
|
||||
protected String slug;
|
||||
protected SimpleDate firstAired;
|
||||
protected String overview;
|
||||
protected String network;
|
||||
protected String status;
|
||||
protected URL banner;
|
||||
|
||||
public TheTVDBSearchResult(int id, String name, String[] aliasNames, String slug, SimpleDate firstAired, String overview, String network, String status, URL banner) {
|
||||
super(id, name, aliasNames);
|
||||
this.slug = slug;
|
||||
this.firstAired = firstAired;
|
||||
this.overview = overview;
|
||||
this.network = network;
|
||||
this.status = status;
|
||||
this.banner = banner;
|
||||
}
|
||||
|
||||
public String getSlug() {
|
||||
return slug;
|
||||
}
|
||||
|
||||
public SimpleDate getFirstAired() {
|
||||
return firstAired;
|
||||
}
|
||||
|
||||
public String getOverview() {
|
||||
return overview;
|
||||
}
|
||||
|
||||
public String getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public URL getBanner() {
|
||||
return banner;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue