diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-08-13 23:12:26 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-08-13 23:12:26 -0400 |
| commit | 89dd4f0be1721ef8f8357051cafea2703ab38b2e (patch) | |
| tree | 50d29ea915b6cc3ea2c326eeeff1d96b5eb44a77 /MediaBrowser.Api/Library/LibraryStructureService.cs | |
| parent | 7dbeeadea6edff204276bf87c03c85886d0ff321 (diff) | |
save library options on dialog close
Diffstat (limited to 'MediaBrowser.Api/Library/LibraryStructureService.cs')
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryStructureService.cs | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index dd3c7211a..72966a7cd 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -11,6 +11,7 @@ using System.Threading; using System.Threading.Tasks; using CommonIO; using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Configuration; namespace MediaBrowser.Api.Library @@ -140,6 +141,14 @@ namespace MediaBrowser.Api.Library public bool RefreshLibrary { get; set; } } + [Route("/Library/VirtualFolders/LibraryOptions", "POST")] + public class UpdateLibraryOptions : IReturnVoid + { + public string Id { get; set; } + + public LibraryOptions LibraryOptions { get; set; } + } + /// <summary> /// Class LibraryStructureService /// </summary> @@ -188,6 +197,13 @@ namespace MediaBrowser.Api.Library return ToOptimizedSerializedResultUsingCache(result); } + public void Post(UpdateLibraryOptions request) + { + var collectionFolder = (CollectionFolder)_libraryManager.GetItemById(request.Id); + + collectionFolder.UpdateLibraryOptions(request.LibraryOptions); + } + /// <summary> /// Posts the specified request. /// </summary> @@ -220,12 +236,12 @@ namespace MediaBrowser.Api.Library var currentPath = Path.Combine(rootFolderPath, request.Name); var newPath = Path.Combine(rootFolderPath, request.NewName); - if (!_fileSystem.DirectoryExists(currentPath)) + if (!_fileSystem.DirectoryExists(currentPath)) { throw new DirectoryNotFoundException("The media collection does not exist"); } - if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath)) + if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath)) { throw new ArgumentException("There is already a media collection with the name " + newPath + "."); } @@ -240,11 +256,11 @@ namespace MediaBrowser.Api.Library //Create an unique name var temporaryName = Guid.NewGuid().ToString(); var temporaryPath = Path.Combine(rootFolderPath, temporaryName); - _fileSystem.MoveDirectory(currentPath, temporaryPath); + _fileSystem.MoveDirectory(currentPath, temporaryPath); currentPath = temporaryPath; } - _fileSystem.MoveDirectory(currentPath, newPath); + _fileSystem.MoveDirectory(currentPath, newPath); } finally { |
