mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 00:38:52 -05:00
Added boolean bindings {anime} and {regular} to check if an episode object is an Anime/Regular (non-special) episode
This commit is contained in:
parent
c36548cb63
commit
d6bb7f1096
@ -148,11 +148,9 @@ public class MediaBindingBean {
|
|||||||
|
|
||||||
@Define("es")
|
@Define("es")
|
||||||
public List<Integer> getEpisodeNumbers() {
|
public List<Integer> getEpisodeNumbers() {
|
||||||
List<Integer> n = new ArrayList<Integer>();
|
return getEpisodes().stream().map(it -> {
|
||||||
for (Episode it : getEpisodes()) {
|
return it.getEpisode() == null ? it.getSpecial() == null ? -1 : it.getSpecial() : it.getEpisode();
|
||||||
n.add(it.getEpisode() == null ? it.getSpecial() == null ? -1 : it.getSpecial() : it.getEpisode());
|
}).collect(toList());
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Define("sxe")
|
@Define("sxe")
|
||||||
@ -679,13 +677,24 @@ public class MediaBindingBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Define("anime")
|
||||||
|
public boolean isAnimeEpisode() {
|
||||||
|
return WebServices.AniDB.getIdentifier().equals(getEpisode().getSeriesInfo().getDatabase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Define("regular")
|
||||||
|
public boolean isRegularEpisode() {
|
||||||
|
return getEpisodes().stream().allMatch(it -> it.getEpisode() != null && it.getSpecial() == null);
|
||||||
|
}
|
||||||
|
|
||||||
@Define("abs2sxe")
|
@Define("abs2sxe")
|
||||||
public Episode getSeasonEpisode() throws Exception {
|
public Episode getSeasonEpisode() throws Exception {
|
||||||
SeriesInfo seriesInfo = getEpisode().getSeriesInfo();
|
|
||||||
|
|
||||||
// match AniDB episode to TheTVDB episode
|
// match AniDB episode to TheTVDB episode
|
||||||
if (WebServices.AniDB.getIdentifier().equals(seriesInfo.getDatabase())) {
|
if (isAnimeEpisode()) {
|
||||||
|
SeriesInfo seriesInfo = getEpisode().getSeriesInfo();
|
||||||
Locale locale = new Locale(seriesInfo.getLanguage());
|
Locale locale = new Locale(seriesInfo.getLanguage());
|
||||||
|
|
||||||
|
// episode may be a multi-episode
|
||||||
List<Episode> episode = getEpisodes();
|
List<Episode> episode = getEpisodes();
|
||||||
|
|
||||||
for (SearchResult series : WebServices.TheTVDB.search(seriesInfo.getName(), locale)) {
|
for (SearchResult series : WebServices.TheTVDB.search(seriesInfo.getName(), locale)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user