diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-03-25 13:52:15 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-03-25 13:52:15 -0400 |
| commit | 72fe76ab1008f0bd38157cc37cde45797b5f6417 (patch) | |
| tree | 875b6bee7d0a634d7ef019cfb7c434823b223001 /MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs | |
| parent | 736e63241011cb9ae798bf4091cd37e097045c21 (diff) | |
| parent | f6c18200bacae6e768225a8c073418a170d349bd (diff) | |
Merge pull request #1593 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs index 5f1bf0216..bec105b0a 100644 --- a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs @@ -208,7 +208,7 @@ namespace MediaBrowser.Server.Implementations.Persistence await item.Delete(new DeleteOptions { DeleteFileLocation = false - + }).ConfigureAwait(false); } @@ -225,7 +225,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { var result = _itemRepo.GetItemIdsWithPath(new InternalItemsQuery { - LocationType = LocationType.FileSystem, + LocationTypes = new[] { LocationType.FileSystem }, //Limit = limit, // These have their own cleanup routines @@ -239,11 +239,7 @@ namespace MediaBrowser.Server.Implementations.Persistence typeof(Year).Name, typeof(Channel).Name, typeof(AggregateFolder).Name, - typeof(CollectionFolder).Name, - - // LiveTVManager handles recordings - typeof(LiveTvAudioRecording).Name, - typeof(LiveTvVideoRecording).Name + typeof(CollectionFolder).Name } }); @@ -270,6 +266,19 @@ namespace MediaBrowser.Server.Implementations.Persistence continue; } + var hasDualAccess = libraryItem as IHasDualAccess; + if (hasDualAccess != null && hasDualAccess.IsAccessedByName) + { + continue; + } + + var libraryItemPath = libraryItem.Path; + if (!string.Equals(libraryItemPath, path, StringComparison.OrdinalIgnoreCase)) + { + _logger.Error("CleanDeletedItems aborting delete for item {0}-{1} because paths don't match. {2}---{3}", libraryItem.Id, libraryItem.Name, libraryItem.Path ?? string.Empty, path ?? string.Empty); + continue; + } + if (Folder.IsPathOffline(path)) { libraryItem.IsOffline = true; @@ -277,13 +286,9 @@ namespace MediaBrowser.Server.Implementations.Persistence continue; } - _logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItem.Path ?? string.Empty); + _logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItemPath ?? string.Empty); - await libraryItem.Delete(new DeleteOptions - { - DeleteFileLocation = false - - }).ConfigureAwait(false); + await libraryItem.OnFileDeleted().ConfigureAwait(false); } catch (OperationCanceledException) { |
