Add new params to collection creation

This commit is contained in:
Luke Pulverenti 2014-03-15 11:17:46 -04:00
parent d55af4f529
commit 9a6afa9288
3 changed files with 14 additions and 3 deletions

View File

@ -14,9 +14,12 @@ namespace MediaBrowser.Controller.Collections
public Dictionary<string, string> ProviderIds { get; set; } public Dictionary<string, string> ProviderIds { get; set; }
public List<Guid> ItemIdList { get; set; }
public CollectionCreationOptions() public CollectionCreationOptions()
{ {
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
ItemIdList = new List<Guid>();
} }
} }
} }

View File

@ -1,4 +1,5 @@
using System; using MediaBrowser.Controller.Entities.Movies;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -11,7 +12,7 @@ namespace MediaBrowser.Controller.Collections
/// </summary> /// </summary>
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
Task CreateCollection(CollectionCreationOptions options); Task<BoxSet> CreateCollection(CollectionCreationOptions options);
/// <summary> /// <summary>
/// Adds to collection. /// Adds to collection.

View File

@ -26,7 +26,7 @@ namespace MediaBrowser.Server.Implementations.Collections
_iLibraryMonitor = iLibraryMonitor; _iLibraryMonitor = iLibraryMonitor;
} }
public async Task CreateCollection(CollectionCreationOptions options) public async Task<BoxSet> CreateCollection(CollectionCreationOptions options)
{ {
var name = options.Name; var name = options.Name;
@ -64,6 +64,13 @@ namespace MediaBrowser.Server.Implementations.Collections
await collection.RefreshMetadata(new MetadataRefreshOptions(), CancellationToken.None) await collection.RefreshMetadata(new MetadataRefreshOptions(), CancellationToken.None)
.ConfigureAwait(false); .ConfigureAwait(false);
if (options.ItemIdList.Count > 0)
{
await AddToCollection(collection.Id, options.ItemIdList);
}
return collection;
} }
finally finally
{ {