mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-22 07:48: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 class SeriesInfo implements Serializable {
|
||||||
|
|
||||||
|
public static final String TYPE_SERIES = "TV Series";
|
||||||
|
public static final String TYPE_ANIME = "Anime";
|
||||||
|
|
||||||
// request parameters
|
// request parameters
|
||||||
protected String database;
|
protected String database;
|
||||||
protected String order;
|
protected String order;
|
||||||
protected String language;
|
protected String language;
|
||||||
|
|
||||||
|
// series classification
|
||||||
|
protected String type;
|
||||||
|
|
||||||
// series parameters
|
// series parameters
|
||||||
protected Integer id;
|
protected Integer id;
|
||||||
protected String name;
|
protected String name;
|
||||||
@ -36,6 +42,7 @@ public class SeriesInfo implements Serializable {
|
|||||||
this.database = other.database;
|
this.database = other.database;
|
||||||
this.order = other.order;
|
this.order = other.order;
|
||||||
this.language = other.language;
|
this.language = other.language;
|
||||||
|
this.type = other.type;
|
||||||
this.id = other.id;
|
this.id = other.id;
|
||||||
this.name = other.name;
|
this.name = other.name;
|
||||||
this.aliasNames = other.aliasNames == null ? null : other.aliasNames.clone();
|
this.aliasNames = other.aliasNames == null ? null : other.aliasNames.clone();
|
||||||
@ -49,17 +56,13 @@ public class SeriesInfo implements Serializable {
|
|||||||
this.status = other.status;
|
this.status = other.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SeriesInfo(Datasource database, Locale language, Integer id) {
|
public SeriesInfo(Datasource database, SortOrder order, Locale language, Integer id, String type) {
|
||||||
this.database = database.getIdentifier();
|
this.database = database == null ? null : database.getIdentifier();
|
||||||
this.language = language.getLanguage();
|
this.order = order == null ? null : order.name();
|
||||||
this.id = id;
|
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.id = id;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDatabase(String database) {
|
public void setDatabase(String database) {
|
||||||
@ -78,14 +81,6 @@ public class SeriesInfo implements Serializable {
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
@ -94,6 +89,22 @@ public class SeriesInfo implements Serializable {
|
|||||||
this.language = language;
|
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() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -131,7 +142,7 @@ public class SeriesInfo implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setGenres(List<String> genres) {
|
public void setGenres(List<String> genres) {
|
||||||
this.genres = genres.toArray(new String[genres.size()]);
|
this.genres = genres.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNetwork() {
|
public String getNetwork() {
|
||||||
|
@ -102,7 +102,7 @@ public class TMDbTVClient extends AbstractEpisodeListProvider {
|
|||||||
String name = getString(tv, "name");
|
String name = getString(tv, "name");
|
||||||
String originalName = getString(tv, "original_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.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.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"));
|
info.setStatus(getString(tv, "status"));
|
||||||
|
@ -69,7 +69,7 @@ public class TVMazeClient extends AbstractEpisodeListProvider {
|
|||||||
Object[] genres = getArray(response, "genres");
|
Object[] genres = getArray(response, "genres");
|
||||||
Double rating = getStringValue(getMap(response, "rating"), "average", Double::parseDouble);
|
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.setName(show.getName());
|
||||||
seriesInfo.setAliasNames(show.getAliasNames());
|
seriesInfo.setAliasNames(show.getAliasNames());
|
||||||
seriesInfo.setStatus(status);
|
seriesInfo.setStatus(status);
|
||||||
|
@ -30,7 +30,7 @@ public class TheTVDBSeriesInfo extends SeriesInfo implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TheTVDBSeriesInfo(Datasource database, Locale language, Integer id) {
|
public TheTVDBSeriesInfo(Datasource database, Locale language, Integer id) {
|
||||||
super(database, language, id);
|
super(database, null, language, id, TYPE_SERIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSlug() {
|
public String getSlug() {
|
||||||
|
Loading…
Reference in New Issue
Block a user