From 48facb797ed912e4ea6b04b17d1ff190ac2daac4 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 12 Sep 2018 19:26:21 +0200 Subject: Update to 3.5.2 and .net core 2.1 --- .../Library/LibraryStructureService.cs | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'MediaBrowser.Api/Library/LibraryStructureService.cs') diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index ae488f066..bba89acec 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -210,7 +210,7 @@ namespace MediaBrowser.Api.Library { var result = _libraryManager.GetVirtualFolders(true); - return ToOptimizedSerializedResultUsingCache(result); + return ToOptimizedResult(result); } public void Post(UpdateLibraryOptions request) @@ -224,7 +224,7 @@ namespace MediaBrowser.Api.Library /// Posts the specified request. /// /// The request. - public void Post(AddVirtualFolder request) + public Task Post(AddVirtualFolder request) { var libraryOptions = request.LibraryOptions ?? new LibraryOptions(); @@ -233,7 +233,7 @@ namespace MediaBrowser.Api.Library libraryOptions.PathInfos = request.Paths.Select(i => new MediaPathInfo { Path = i }).ToArray(); } - _libraryManager.AddVirtualFolder(request.Name, request.CollectionType, libraryOptions, request.RefreshLibrary); + return _libraryManager.AddVirtualFolder(request.Name, request.CollectionType, libraryOptions, request.RefreshLibrary); } /// @@ -264,27 +264,27 @@ namespace MediaBrowser.Api.Library if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath)) { - throw new ArgumentException("There is already a media collection with the name " + newPath + "."); + throw new ArgumentException("Media library already exists at " + newPath + "."); } _libraryMonitor.Stop(); try { - // Only make a two-phase move when changing capitalization + // Changing capitalization. Handle windows case insensitivity if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase)) { - //Create an unique name - var temporaryName = Guid.NewGuid().ToString(); - var temporaryPath = Path.Combine(rootFolderPath, temporaryName); - _fileSystem.MoveDirectory(currentPath, temporaryPath); - currentPath = temporaryPath; + var tempPath = Path.Combine(rootFolderPath, Guid.NewGuid().ToString("N")); + _fileSystem.MoveDirectory(currentPath, tempPath); + currentPath = tempPath; } _fileSystem.MoveDirectory(currentPath, newPath); } finally { + CollectionFolder.OnCollectionFolderChange(); + Task.Run(() => { // No need to start if scanning the library because it will handle it @@ -309,9 +309,9 @@ namespace MediaBrowser.Api.Library /// Deletes the specified request. /// /// The request. - public void Delete(RemoveVirtualFolder request) + public Task Delete(RemoveVirtualFolder request) { - _libraryManager.RemoveVirtualFolder(request.Name, request.RefreshLibrary); + return _libraryManager.RemoveVirtualFolder(request.Name, request.RefreshLibrary); } /// -- cgit v1.2.3