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.
///
/// The name.
+ /// Type of the collection.
/// The user.
/// The app paths.
/// There is already a media collection with the name + name + .
- 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);
+ }
}
///
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
///
/// The name.
public string Name { get; set; }
+
+ ///
+ /// Gets or sets the type of the collection.
+ ///
+ /// The type of the collection.
+ 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(), CancellationToken.None);
diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs
index 7a027a0527..f65de2e69c 100644
--- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs
@@ -125,15 +125,35 @@ namespace MediaBrowser.Api.UserLibrary
{
var name = DeSlugArtistName(request.Name, LibraryManager);
- var items = GetItems(request.UserId).OfType