Refactor {languages} binding

This commit is contained in:
Reinhard Pointner 2016-05-10 18:17:16 +08:00
parent 96ecc4db9a
commit 3443fc0de7
1 changed files with 10 additions and 3 deletions

View File

@ -576,9 +576,16 @@ public class MediaBindingBean {
} }
@Define("languages") @Define("languages")
public Object getSpokenLanguages() { public List<String> getSpokenLanguages() {
List<?> languages = infoObject instanceof Movie ? (List<?>) getMetaInfo().getProperty("spokenLanguages") : singletonList(getMetaInfo().getProperty("language")); if (infoObject instanceof Movie) {
return languages.stream().map(it -> new Locale(it.toString()).getDisplayLanguage(Locale.ENGLISH)).collect(toList()); List<Locale> languages = (List<Locale>) 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") @Define("actors")