From e34c9760afefed861cce773774c3cad8c2fae70a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 29 Oct 2016 20:14:01 +0800 Subject: [PATCH] Use Language objects instead of returning language codes/names --- source/net/filebot/format/MediaBindingBean.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index e233bd1b..b8874698 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -590,14 +590,14 @@ public class MediaBindingBean { } @Define("languages") - public List getSpokenLanguages() { + public List getSpokenLanguages() { if (infoObject instanceof Movie) { List languages = (List) getMetaInfo().getProperty("spokenLanguages"); - return languages.stream().map(it -> it.getDisplayLanguage(Locale.ENGLISH)).collect(toList()); + return languages.stream().map(Language::getLanguage).filter(Objects::nonNull).collect(toList()); } if (infoObject instanceof Episode) { String language = getSeriesInfo().getLanguage(); - return singletonList(new Locale(language).getDisplayLanguage(Locale.ENGLISH)); + return Stream.of(language).map(Language::findLanguage).filter(Objects::nonNull).collect(toList()); } return null; } @@ -779,8 +779,8 @@ public class MediaBindingBean { } @Define("textLanguages") - public List getTextLanguageList() { - return getMediaInfo(StreamKind.Text, "Language/String").filter(Objects::nonNull).distinct().collect(toList()); + public List getTextLanguageList() { + return getMediaInfo(StreamKind.Text, "Language").filter(Objects::nonNull).distinct().map(Language::findLanguage).filter(Objects::nonNull).collect(toList()); } @Define("bitrate")