aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Library/LibraryStructureService.cs
diff options
context:
space:
mode:
authorhatharry <hatharry@hotmail.com>2016-08-29 01:27:43 +1200
committerhatharry <hatharry@hotmail.com>2016-08-29 01:27:43 +1200
commitcabf2cdc1be4c06714ac6bcf835a19d2f652a6e2 (patch)
treed375b8a41e9fd40a2569ceea6b02e4f8237db797 /MediaBrowser.Api/Library/LibraryStructureService.cs
parente564b54686029a90595e1bb4277f87490763e183 (diff)
parentc974641a352685b2e6595dd7b291843c8e6364ac (diff)
Merge branch 'dev' of https://github.com/hatharry/Emby.git
Diffstat (limited to 'MediaBrowser.Api/Library/LibraryStructureService.cs')
-rw-r--r--MediaBrowser.Api/Library/LibraryStructureService.cs32
1 files changed, 27 insertions, 5 deletions
diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs
index 3cf0d5d93..72966a7cd 100644
--- a/MediaBrowser.Api/Library/LibraryStructureService.cs
+++ b/MediaBrowser.Api/Library/LibraryStructureService.cs
@@ -10,6 +10,9 @@ using System.Linq;
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
{
@@ -52,6 +55,8 @@ namespace MediaBrowser.Api.Library
/// </summary>
/// <value>The path.</value>
public string[] Paths { get; set; }
+
+ public LibraryOptions LibraryOptions { get; set; }
}
[Route("/Library/VirtualFolders", "DELETE")]
@@ -136,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>
@@ -184,13 +197,22 @@ 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>
/// <param name="request">The request.</param>
public void Post(AddVirtualFolder request)
{
- _libraryManager.AddVirtualFolder(request.Name, request.CollectionType, request.Paths, request.RefreshLibrary);
+ var libraryOptions = request.LibraryOptions ?? new LibraryOptions();
+
+ _libraryManager.AddVirtualFolder(request.Name, request.CollectionType, request.Paths, libraryOptions, request.RefreshLibrary);
}
/// <summary>
@@ -214,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 + ".");
}
@@ -234,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
{