fix language settings inheritance
This commit is contained in:
parent
26fec4f990
commit
18ff8aba74
|
@ -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.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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
|
@ -421,6 +421,10 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
{
|
||||
builder.Append("<Language>" + SecurityElement.Escape(hasLanguage.PreferredMetadataLanguage) + "</Language>");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataCountryCode))
|
||||
{
|
||||
builder.Append("<CountryCode>" + SecurityElement.Escape(hasLanguage.PreferredMetadataCountryCode) + "</CountryCode>");
|
||||
}
|
||||
}
|
||||
|
||||
// Use original runtime here, actual file runtime later in MediaInfo
|
||||
|
|
|
@ -401,7 +401,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1489,6 +1489,23 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return ItemRepository.RetrieveItem(id);
|
||||
}
|
||||
|
||||
public IEnumerable<Folder> GetCollectionFolders(BaseItem item)
|
||||
{
|
||||
while (!(item.Parent is AggregateFolder) && item.Parent != null)
|
||||
{
|
||||
item = item.Parent;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return new List<Folder>();
|
||||
}
|
||||
|
||||
return GetUserRootFolder().Children
|
||||
.OfType<Folder>()
|
||||
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path));
|
||||
}
|
||||
|
||||
public string GetContentType(BaseItem item)
|
||||
{
|
||||
string configuredContentType = GetConfiguredContentType(item, false);
|
||||
|
@ -1547,7 +1564,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private string GetTopFolderContentType(BaseItem item)
|
||||
{
|
||||
while (!(item.Parent is AggregateFolder) && item.Parent != null)
|
||||
|
@ -1840,7 +1857,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
options.VideoFileExtensions.Remove(".rar");
|
||||
options.VideoFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
|
@ -350,6 +350,19 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
break;
|
||||
}
|
||||
|
||||
case "countrycode":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
var hasLanguage = item as IHasPreferredMetadataLanguage;
|
||||
if (hasLanguage != null)
|
||||
{
|
||||
hasLanguage.PreferredMetadataCountryCode = val;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "website":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
|
|
@ -589,6 +589,10 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
{
|
||||
writer.WriteElementString("language", hasLanguage.PreferredMetadataLanguage);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataCountryCode))
|
||||
{
|
||||
writer.WriteElementString("countrycode", hasLanguage.PreferredMetadataCountryCode);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.PremiereDate.HasValue && !(item is Episode))
|
||||
|
|
Loading…
Reference in New Issue
Block a user