diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-25 13:52:36 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-25 13:52:36 -0400 |
| commit | d9108f69f35080acb5ebefaefcd469595529afa2 (patch) | |
| tree | 3f04e719877b9cdec9529ca34406b753f6492abc /MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs | |
| parent | d6832e7a41c2a24f7dd998284e8e4f6eacf1d188 (diff) | |
| parent | 72fe76ab1008f0bd38157cc37cde45797b5f6417 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
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) { |
