diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-07-12 15:56:40 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-07-12 15:56:40 -0400 |
| commit | dab5003d6bba57c27f4111653b36d39862b5b6fd (patch) | |
| tree | bdf7462c3718eb729f71b1245c3f651b016e8412 /MediaBrowser.Api/Library | |
| parent | 3370fb072e71ad93c540d50d859d6cbe85552735 (diff) | |
added collection type
Diffstat (limited to 'MediaBrowser.Api/Library')
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryHelpers.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryStructureService.cs | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index ab7449273d..72cff4560a 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -16,10 +16,11 @@ namespace MediaBrowser.Api.Library /// Adds the virtual folder. /// </summary> /// <param name="name">The name.</param> + /// <param name="collectionType">Type of the collection.</param> /// <param name="user">The user.</param> /// <param name="appPaths">The app paths.</param> /// <exception cref="System.ArgumentException">There is already a media collection with the name + name + .</exception> - public static void AddVirtualFolder(string name, User user, IServerApplicationPaths appPaths) + public static void AddVirtualFolder(string name, string collectionType, User user, IServerApplicationPaths appPaths) { name = FileSystem.GetValidFilename(name); @@ -32,6 +33,13 @@ namespace MediaBrowser.Api.Library } Directory.CreateDirectory(virtualFolderPath); + + if (!string.IsNullOrEmpty(collectionType)) + { + var path = Path.Combine(virtualFolderPath, collectionType + ".collection"); + + File.Create(path); + } } /// <summary> diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index 88fc8b0af1..91018168b2 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -38,6 +38,12 @@ namespace MediaBrowser.Api.Library /// </summary> /// <value>The name.</value> public string Name { get; set; } + + /// <summary> + /// Gets or sets the type of the collection. + /// </summary> + /// <value>The type of the collection.</value> + public string CollectionType { get; set; } } [Route("/Library/VirtualFolders/{Name}", "DELETE")] @@ -196,13 +202,13 @@ namespace MediaBrowser.Api.Library { if (string.IsNullOrEmpty(request.UserId)) { - LibraryHelpers.AddVirtualFolder(request.Name, null, _appPaths); + LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, null, _appPaths); } else { var user = _userManager.GetUserById(new Guid(request.UserId)); - LibraryHelpers.AddVirtualFolder(request.Name, user, _appPaths); + LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, user, _appPaths); } _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None); |
