mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
try to convert absolute numbers to SxE numbers when using {s00e00} binding (as best as possible, SxE numbers may not exactly match TheTVDB, but should in most common cases)
This commit is contained in:
parent
1093431c24
commit
8eff5ec498
@ -689,22 +689,25 @@ public class MediaBindingBean {
|
||||
List<Episode> episode = getEpisodes();
|
||||
|
||||
for (SearchResult series : WebServices.TheTVDB.search(seriesInfo.getName(), locale)) {
|
||||
// sanity check search result
|
||||
if (!series.getEffectiveNames().contains(seriesInfo.getName()))
|
||||
// sanity check
|
||||
if (!series.getEffectiveNames().contains(seriesInfo.getName())) {
|
||||
continue;
|
||||
|
||||
List<Episode> airdateEpisodeList = WebServices.TheTVDB.getEpisodeList(series, SortOrder.Airdate, locale);
|
||||
}
|
||||
|
||||
// match by absolute number or airdate if possible, default to absolute number otherwise
|
||||
List<Episode> airdateEpisodeList = WebServices.TheTVDB.getEpisodeList(series, SortOrder.Airdate, locale);
|
||||
List<Episode> airdateEpisode = episode.stream().flatMap(abs -> {
|
||||
return airdateEpisodeList.stream().filter(sxe -> abs.getSpecial() == null && sxe.getSpecial() == null).filter(sxe -> {
|
||||
return abs.getAbsolute() != null && abs.getAbsolute().equals(sxe.getAbsolute());
|
||||
});
|
||||
}).collect(toList());
|
||||
|
||||
if (airdateEpisode.size() == episode.size()) {
|
||||
return airdateEpisode.size() == 1 ? airdateEpisode.get(0) : new MultiEpisode(airdateEpisode);
|
||||
// sanity check
|
||||
if (airdateEpisode.size() != episode.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
return airdateEpisode.size() == 1 ? airdateEpisode.get(0) : new MultiEpisode(airdateEpisode);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user