mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-21 15:28:52 -05:00
Add type property to SeriesInfo model which can be either "Anime" or "TV Series" to greatly simplify processing later on based on a standardized model and fields
This commit is contained in:
parent
d6b562c77f
commit
e2b23708df
@ -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<String> genres) {
|
||||
this.genres = genres.toArray(new String[genres.size()]);
|
||||
this.genres = genres.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public String getNetwork() {
|
||||
|
@ -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"));
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user