|
|
|
@ -149,12 +149,17 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
|
return GetCollectionsFolder(string.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task AddToCollection(Guid collectionId, string[] ids)
|
|
|
|
|
public Task AddToCollection(Guid collectionId, IEnumerable<string> ids)
|
|
|
|
|
{
|
|
|
|
|
return AddToCollection(collectionId, ids, true, new MetadataRefreshOptions(_fileSystem));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task AddToCollection(Guid collectionId, string[] ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
|
|
|
|
|
public Task AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
|
|
|
|
|
{
|
|
|
|
|
return AddToCollection(collectionId, ids.Select(i => i.ToString("N")), true, new MetadataRefreshOptions(_fileSystem));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task AddToCollection(Guid collectionId, IEnumerable<string> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
|
|
|
|
|
{
|
|
|
|
|
var collection = _libraryManager.GetItemById(collectionId) as BoxSet;
|
|
|
|
|
|
|
|
|
@ -167,9 +172,9 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
|
var itemList = new List<BaseItem>();
|
|
|
|
|
var currentLinkedChildrenIds = collection.GetLinkedChildren().Select(i => i.Id).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var itemId in ids)
|
|
|
|
|
foreach (var id in ids)
|
|
|
|
|
{
|
|
|
|
|
var guidId = new Guid(itemId);
|
|
|
|
|
var guidId = new Guid(id);
|
|
|
|
|
var item = _libraryManager.GetItemById(guidId);
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(item.Path))
|
|
|
|
@ -214,7 +219,12 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task RemoveFromCollection(Guid collectionId, string[] itemIds)
|
|
|
|
|
public Task RemoveFromCollection(Guid collectionId, IEnumerable<string> itemIds)
|
|
|
|
|
{
|
|
|
|
|
return RemoveFromCollection(collectionId, itemIds.Select(i => new Guid(i)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task RemoveFromCollection(Guid collectionId, IEnumerable<Guid> itemIds)
|
|
|
|
|
{
|
|
|
|
|
var collection = _libraryManager.GetItemById(collectionId) as BoxSet;
|
|
|
|
|
|
|
|
|
@ -226,9 +236,8 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
|
var list = new List<LinkedChild>();
|
|
|
|
|
var itemList = new List<BaseItem>();
|
|
|
|
|
|
|
|
|
|
foreach (var itemId in itemIds)
|
|
|
|
|
foreach (var guidId in itemIds)
|
|
|
|
|
{
|
|
|
|
|
var guidId = new Guid(itemId);
|
|
|
|
|
var childItem = _libraryManager.GetItemById(guidId);
|
|
|
|
|
|
|
|
|
|
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == guidId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
|
|
|
|