From eaa146bd0a8f2aa7ee7082fb289696736595ac07 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 1 Oct 2017 20:40:35 +0200 Subject: [PATCH] Preserve alias names as best as possible from all fields --- source/net/filebot/web/TMDbTVClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/web/TMDbTVClient.java b/source/net/filebot/web/TMDbTVClient.java index bcceca66..cb4bf0df 100644 --- a/source/net/filebot/web/TMDbTVClient.java +++ b/source/net/filebot/web/TMDbTVClient.java @@ -13,6 +13,7 @@ import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.regex.Matcher; +import java.util.stream.Stream; import javax.swing.Icon; @@ -103,7 +104,7 @@ public class TMDbTVClient extends AbstractEpisodeListProvider { SeriesInfo info = new SeriesInfo(this, sortOrder, locale, series.getId()); info.setName(originalName != null ? originalName : name); - info.setAliasNames(series.getAliasNames()); + 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.setLanguage(getString(tv, "original_language")); info.setStartDate(getStringValue(tv, "first_air_date", SimpleDate::parse));