|
|
|
@ -1036,13 +1036,31 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
public async Task CreateItem(BaseItem item, CancellationToken cancellationToken)
|
|
|
|
|
public Task CreateItem(BaseItem item, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
await SaveItem(item, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
return CreateItems(new[] { item }, cancellationToken);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates the items.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">The items.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
public async Task CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
var list = items.ToList();
|
|
|
|
|
|
|
|
|
|
await ItemRepository.SaveItems(list, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
UpdateItemInLibraryCache(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ItemAdded != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -1054,6 +1072,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the item.
|
|
|
|
@ -1063,7 +1082,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
public async Task UpdateItem(BaseItem item, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
await SaveItem(item, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
await ItemRepository.SaveItem(item, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
UpdateItemInLibraryCache(item);
|
|
|
|
|
|
|
|
|
@ -1099,17 +1118,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Saves the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
private Task SaveItem(BaseItem item, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
return ItemRepository.SaveItem(item, cancellationToken);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|