From 18ff8aba74593f4ad47aba5f001c812b2c9393fe Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 14 Feb 2015 22:36:07 -0500 Subject: [PATCH] fix language settings inheritance --- MediaBrowser.Controller/Entities/BaseItem.cs | 26 ++++++++++++++----- MediaBrowser.Controller/Entities/TV/Series.cs | 7 +++-- .../Library/ILibraryManager.cs | 7 +++++ .../Providers/BaseItemXmlParser.cs | 13 ++++++++++ .../Savers/XmlSaverHelpers.cs | 4 +++ .../Library/LibraryManager.cs | 23 +++++++++++++--- .../Parsers/BaseNfoParser.cs | 13 ++++++++++ .../Savers/BaseNfoSaver.cs | 4 +++ 8 files changed, 84 insertions(+), 13 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3ab02ea21..50a6dda30 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -976,14 +976,21 @@ namespace MediaBrowser.Controller.Entities lang = hasLang.PreferredMetadataLanguage; } - if (string.IsNullOrEmpty(lang)) + if (string.IsNullOrWhiteSpace(lang)) { lang = Parents.OfType() .Select(i => i.PreferredMetadataLanguage) - .FirstOrDefault(i => !string.IsNullOrEmpty(i)); + .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); } - if (string.IsNullOrEmpty(lang)) + if (string.IsNullOrWhiteSpace(lang)) + { + lang = LibraryManager.GetCollectionFolders(this) + .Select(i => i.PreferredMetadataLanguage) + .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); + } + + if (string.IsNullOrWhiteSpace(lang)) { lang = ConfigurationManager.Configuration.PreferredMetadataLanguage; } @@ -1006,14 +1013,21 @@ namespace MediaBrowser.Controller.Entities lang = hasLang.PreferredMetadataCountryCode; } - if (string.IsNullOrEmpty(lang)) + if (string.IsNullOrWhiteSpace(lang)) { lang = Parents.OfType() .Select(i => i.PreferredMetadataCountryCode) - .FirstOrDefault(i => !string.IsNullOrEmpty(i)); + .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); } - if (string.IsNullOrEmpty(lang)) + if (string.IsNullOrWhiteSpace(lang)) + { + lang = LibraryManager.GetCollectionFolders(this) + .Select(i => i.PreferredMetadataCountryCode) + .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); + } + + if (string.IsNullOrWhiteSpace(lang)) { lang = ConfigurationManager.Configuration.MetadataCountryCode; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 619617e9f..4c34460d7 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -1,7 +1,4 @@ -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Localization; -using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; @@ -10,6 +7,8 @@ using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; namespace MediaBrowser.Controller.Entities.TV { diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 9871ef3c5..9c8ed45a5 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -393,5 +393,12 @@ namespace MediaBrowser.Controller.Library /// IEnumerable<Video>. IEnumerable