diff --git a/source/net/filebot/web/SeriesInfo.java b/source/net/filebot/web/SeriesInfo.java index ae2a9d1c..bbe3f847 100644 --- a/source/net/filebot/web/SeriesInfo.java +++ b/source/net/filebot/web/SeriesInfo.java @@ -10,11 +10,17 @@ import java.util.Objects; public class SeriesInfo implements Serializable { + public static final String TYPE_SERIES = "TV Series"; + public static final String TYPE_ANIME = "Anime"; + // request parameters protected String database; protected String order; protected String language; + // series classification + protected String type; + // series parameters protected Integer id; protected String name; @@ -36,6 +42,7 @@ public class SeriesInfo implements Serializable { this.database = other.database; this.order = other.order; this.language = other.language; + this.type = other.type; this.id = other.id; this.name = other.name; this.aliasNames = other.aliasNames == null ? null : other.aliasNames.clone(); @@ -49,17 +56,13 @@ public class SeriesInfo implements Serializable { this.status = other.status; } - public SeriesInfo(Datasource database, Locale language, Integer id) { - this.database = database.getIdentifier(); - this.language = language.getLanguage(); - this.id = id; - } + public SeriesInfo(Datasource database, SortOrder order, Locale language, Integer id, String type) { + this.database = database == null ? null : database.getIdentifier(); + this.order = order == null ? null : order.name(); + this.language = language == null ? null : language.getLanguage(); - public SeriesInfo(Datasource database, SortOrder order, Locale language, Integer id) { - this.database = database.getIdentifier(); - this.order = order.name(); - this.language = language.getLanguage(); this.id = id; + this.type = type; } public void setDatabase(String database) { @@ -78,14 +81,6 @@ public class SeriesInfo implements Serializable { return order; } - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - public String getLanguage() { return language; } @@ -94,6 +89,22 @@ public class SeriesInfo implements Serializable { this.language = language; } + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public String getName() { return name; } @@ -131,7 +142,7 @@ public class SeriesInfo implements Serializable { } public void setGenres(List genres) { - this.genres = genres.toArray(new String[genres.size()]); + this.genres = genres.toArray(new String[0]); } public String getNetwork() { diff --git a/source/net/filebot/web/TMDbTVClient.java b/source/net/filebot/web/TMDbTVClient.java index eaec6f81..47de1677 100644 --- a/source/net/filebot/web/TMDbTVClient.java +++ b/source/net/filebot/web/TMDbTVClient.java @@ -102,7 +102,7 @@ public class TMDbTVClient extends AbstractEpisodeListProvider { String name = getString(tv, "name"); String originalName = getString(tv, "original_name"); - SeriesInfo info = new SeriesInfo(this, sortOrder, locale, series.getId()); + SeriesInfo info = new SeriesInfo(this, sortOrder, locale, series.getId(), SeriesInfo.TYPE_SERIES); info.setName(name); info.setAliasNames(Stream.concat(Stream.of(series.getName(), originalName), Stream.of(series.getAliasNames())).filter(Objects::nonNull).filter(s -> !s.equals(name)).distinct().toArray(String[]::new)); info.setStatus(getString(tv, "status")); diff --git a/source/net/filebot/web/TVMazeClient.java b/source/net/filebot/web/TVMazeClient.java index 4cf4bcd7..84d8d9f5 100644 --- a/source/net/filebot/web/TVMazeClient.java +++ b/source/net/filebot/web/TVMazeClient.java @@ -69,7 +69,7 @@ public class TVMazeClient extends AbstractEpisodeListProvider { Object[] genres = getArray(response, "genres"); Double rating = getStringValue(getMap(response, "rating"), "average", Double::parseDouble); - SeriesInfo seriesInfo = new SeriesInfo(this, sortOrder, locale, show.getId()); + SeriesInfo seriesInfo = new SeriesInfo(this, sortOrder, locale, show.getId(), SeriesInfo.TYPE_SERIES); seriesInfo.setName(show.getName()); seriesInfo.setAliasNames(show.getAliasNames()); seriesInfo.setStatus(status); diff --git a/source/net/filebot/web/TheTVDBSeriesInfo.java b/source/net/filebot/web/TheTVDBSeriesInfo.java index 07ae6ddd..d2309849 100644 --- a/source/net/filebot/web/TheTVDBSeriesInfo.java +++ b/source/net/filebot/web/TheTVDBSeriesInfo.java @@ -30,7 +30,7 @@ public class TheTVDBSeriesInfo extends SeriesInfo implements Serializable { } public TheTVDBSeriesInfo(Datasource database, Locale language, Integer id) { - super(database, language, id); + super(database, null, language, id, TYPE_SERIES); } public String getSlug() {