From 3443fc0de702352151539c3bb24e4c07ef73ebfe Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 10 May 2016 18:17:16 +0800 Subject: [PATCH] Refactor {languages} binding --- source/net/filebot/format/MediaBindingBean.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index f2509c1e..284896b0 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -576,9 +576,16 @@ public class MediaBindingBean { } @Define("languages") - public Object getSpokenLanguages() { - List languages = infoObject instanceof Movie ? (List) getMetaInfo().getProperty("spokenLanguages") : singletonList(getMetaInfo().getProperty("language")); - return languages.stream().map(it -> new Locale(it.toString()).getDisplayLanguage(Locale.ENGLISH)).collect(toList()); + public List getSpokenLanguages() { + if (infoObject instanceof Movie) { + List languages = (List) getMetaInfo().getProperty("spokenLanguages"); + return languages.stream().map(it -> it.getDisplayLanguage(Locale.ENGLISH)).collect(toList()); + } + if (infoObject instanceof Episode) { + String language = getSeriesInfo().getLanguage(); + return singletonList(new Locale(language).getDisplayLanguage(Locale.ENGLISH)); + } + return null; } @Define("actors")