From a020c3ff1f5c2fd7996bf0f05a84f2a7ad72e83e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 11 Jun 2019 06:38:16 +0700 Subject: [PATCH] Fix XEM mapping selection issues --- source/net/filebot/web/XEM.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/net/filebot/web/XEM.java b/source/net/filebot/web/XEM.java index c27aaab8..2d7ee62e 100644 --- a/source/net/filebot/web/XEM.java +++ b/source/net/filebot/web/XEM.java @@ -40,6 +40,10 @@ public enum XEM { return this == AniDB ? 1 : s; } + public String getSeriesName(Map> n, Integer s) { + return this == AniDB ? n.get(Integer.toString(s)).get(0) : n.get("all").get(0); + } + protected final Resource> haveMap = Resource.lazy(this::getHaveMap); public Optional map(Episode episode, XEM destination) throws Exception { @@ -49,19 +53,19 @@ public enum XEM { return Optional.empty(); } - Set seriesNames = episode.getSeriesNames(); + String seriesName = episode.getSeriesName(); Integer season = getSeason(episode.getSeason()); Map> names = getNames(seriesId); debug.finest(format("[XEM] %s", names)); Integer mappedSeason = names.entrySet().stream().filter(it -> { - return it.getValue().stream().anyMatch(seriesNames::contains); + return it.getValue().stream().anyMatch(seriesName::equals); }).map(it -> { return matchInteger(it.getKey()); }).filter(Objects::nonNull).findFirst().orElse(season); - String mappedSeriesName = names.get("all").get(0); + String mappedSeriesName = destination.getSeriesName(names, mappedSeason); Map> mapping = episode.getEpisode() != null ? getSingle(seriesId, mappedSeason, episode.getEpisode()) : getSingle(seriesId, 0, episode.getSpecial());