diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-02-14 22:36:07 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-02-14 22:36:07 -0500 |
| commit | 18ff8aba74593f4ad47aba5f001c812b2c9393fe (patch) | |
| tree | 7cb25d32e92e3c5aee8af4cff4cb25d44ccfa4f6 /MediaBrowser.Controller | |
| parent | 26fec4f990fab24a5aeec7c9ae938ec55856cf54 (diff) | |
fix language settings inheritance
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Series.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Providers/BaseItemXmlParser.cs | 13 |
4 files changed, 43 insertions, 10 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<IHasPreferredMetadataLanguage>() .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<IHasPreferredMetadataLanguage>() .Select(i => i.PreferredMetadataCountryCode) - .FirstOrDefault(i => !string.IsNullOrEmpty(i)); + .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); + } + + if (string.IsNullOrWhiteSpace(lang)) + { + lang = LibraryManager.GetCollectionFolders(this) + .Select(i => i.PreferredMetadataCountryCode) + .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i)); } - if (string.IsNullOrEmpty(lang)) + 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 /// <returns>IEnumerable<Video>.</returns> IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService); + + /// <summary> + /// Gets the collection folders. + /// </summary> + /// <param name="item">The item.</param> + /// <returns>IEnumerable<Folder>.</returns> + IEnumerable<Folder> GetCollectionFolders(BaseItem item); } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index a37f7eb8a..a22e492f4 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -294,6 +294,19 @@ namespace MediaBrowser.Controller.Providers break; } + case "CountryCode": + { + var val = reader.ReadElementContentAsString(); + + var hasLanguage = item as IHasPreferredMetadataLanguage; + if (hasLanguage != null) + { + hasLanguage.PreferredMetadataCountryCode = val; + } + + break; + } + case "PlaceOfBirth": { var val = reader.ReadElementContentAsString(); |
