From 13e4b2a6a76df957a85e444822c816b42f2bb60c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 19 Feb 2014 23:53:15 -0500 Subject: add search methods to remote metadata providers --- .../Library/LibraryManager.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs') diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 656e0993f..c2044476a 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -408,8 +408,14 @@ namespace MediaBrowser.Server.Implementations.Library LibraryItemsCache.AddOrUpdate(item.Id, item, delegate { return item; }); } - public async Task DeleteItem(BaseItem item) + public async Task DeleteItem(BaseItem item, DeleteOptions options) { + _logger.Debug("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}", + item.GetType().Name, + item.Name, + item.Path ?? string.Empty, + item.Id); + var parent = item.Parent; var locationType = item.LocationType; @@ -436,7 +442,7 @@ namespace MediaBrowser.Server.Implementations.Library } } - if (locationType == LocationType.FileSystem || locationType == LocationType.Offline) + if (options.DeleteFileLocation && (locationType == LocationType.FileSystem || locationType == LocationType.Offline)) { foreach (var path in item.GetDeletePaths().ToList()) { @@ -462,15 +468,14 @@ namespace MediaBrowser.Server.Implementations.Library { await parent.RemoveChild(item, CancellationToken.None).ConfigureAwait(false); } - else - { - throw new InvalidOperationException("Don't know how to delete " + item.Name); - } + await ItemRepository.DeleteItem(item.Id, CancellationToken.None).ConfigureAwait(false); foreach (var child in children) { await ItemRepository.DeleteItem(child.Id, CancellationToken.None).ConfigureAwait(false); } + + ReportItemRemoved(item); } private IEnumerable GetMetadataPaths(BaseItem item, IEnumerable children) -- cgit v1.2.3