From 04b6f23473c4091ce7caf9fbe79d424ac002c0e0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 29 Mar 2017 02:26:48 -0400 Subject: 3.2.9.1 --- .../Library/LibraryManager.cs | 58 +++++++++++++--------- 1 file changed, 34 insertions(+), 24 deletions(-) (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs') diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 026486efc..17e678615 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -448,7 +448,7 @@ namespace Emby.Server.Implementations.Library if (parent != null) { - await parent.ValidateChildren(new Progress(), CancellationToken.None, new MetadataRefreshOptions(_fileSystem), false) .ConfigureAwait(false); + await parent.ValidateChildren(new Progress(), CancellationToken.None, new MetadataRefreshOptions(_fileSystem), false).ConfigureAwait(false); } } else if (parent != null) @@ -941,7 +941,7 @@ namespace Emby.Server.Implementations.Library return CreateItemByName(MusicArtist.GetPath, name); } - private T CreateItemByName(Func getPathFn, string name) + private T CreateItemByName(Func getPathFn, string name) where T : BaseItem, new() { if (typeof(T) == typeof(MusicArtist)) @@ -1255,8 +1255,7 @@ namespace Emby.Server.Implementations.Library private string GetCollectionType(string path) { - return _fileSystem.GetFiles(path, false) - .Where(i => string.Equals(i.Extension, ".collection", StringComparison.OrdinalIgnoreCase)) + return _fileSystem.GetFiles(path, new[] { ".collection" }, true, false) .Select(i => _fileSystem.GetFileNameWithoutExtension(i)) .FirstOrDefault(); } @@ -2474,29 +2473,36 @@ namespace Emby.Server.Implementations.Library return GetNamingOptions(new LibraryOptions()); } + private NamingOptions _namingOptions; + private string[] _videoFileExtensions; public NamingOptions GetNamingOptions(LibraryOptions libraryOptions) { - var options = new ExtendedNamingOptions(); + if (_namingOptions == null) + { + var options = new ExtendedNamingOptions(); - // These cause apps to have problems - options.AudioFileExtensions.Remove(".m3u"); - options.AudioFileExtensions.Remove(".wpl"); + // These cause apps to have problems + options.AudioFileExtensions.Remove(".m3u"); + options.AudioFileExtensions.Remove(".wpl"); - if (!libraryOptions.EnableArchiveMediaFiles) - { - options.AudioFileExtensions.Remove(".rar"); - options.AudioFileExtensions.Remove(".zip"); - } + //if (!libraryOptions.EnableArchiveMediaFiles) + { + options.AudioFileExtensions.Remove(".rar"); + options.AudioFileExtensions.Remove(".zip"); + } - if (!libraryOptions.EnableArchiveMediaFiles) - { - options.VideoFileExtensions.Remove(".rar"); - options.VideoFileExtensions.Remove(".zip"); - } + //if (!libraryOptions.EnableArchiveMediaFiles) + { + options.VideoFileExtensions.Remove(".rar"); + options.VideoFileExtensions.Remove(".zip"); + } - options.VideoFileExtensions.Add(".tp"); + options.VideoFileExtensions.Add(".tp"); + _namingOptions = options; + _videoFileExtensions = _namingOptions.VideoFileExtensions.ToArray(); + } - return options; + return _namingOptions; } public ItemLookupInfo ParseName(string name) @@ -2515,12 +2521,14 @@ namespace Emby.Server.Implementations.Library public IEnumerable