aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
authorgnattu <gnattuoc@me.com>2024-04-17 14:41:19 +0800
committergnattu <gnattuoc@me.com>2024-04-17 14:41:19 +0800
commite4d66f35fdaece836edc26cb0d2af36fdb933d7f (patch)
treee1bd1ceafdc1db01590167d6a03d9ebf59d2fd91 /Emby.Server.Implementations/Library/LibraryManager.cs
parent7befbda1a66ed0a0c0f386081e13c0b2585b8137 (diff)
chore: use proper way to override remove root
This is an alternate approach which is more proper, but changes all parts that uses/overrides the original ValidateChildren method Signed-off-by: gnattu <gnattuoc@me.com>
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs18
1 files changed, 4 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 8f5f36688..ea8b83125 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -1042,26 +1042,16 @@ namespace Emby.Server.Implementations.Library
new Progress<double>(),
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
recursive: false,
- cancellationToken).ConfigureAwait(false);
+ cancellationToken: cancellationToken).ConfigureAwait(false);
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
- // HACK: override IsRoot here for libraries to be removed
- if (removeRoot)
- {
- GetUserRootFolder().IsRoot = false;
- }
-
await GetUserRootFolder().ValidateChildren(
new Progress<double>(),
new MetadataRefreshOptions(new DirectoryService(_fileSystem)),
recursive: false,
- cancellationToken).ConfigureAwait(false);
- // HACK: restore IsRoot here after validation
- if (removeRoot)
- {
- GetUserRootFolder().IsRoot = true;
- }
+ allowRemoveRoot: removeRoot,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
// Quickly scan CollectionFolders for changes
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>())
@@ -1079,7 +1069,7 @@ namespace Emby.Server.Implementations.Library
var innerProgress = new Progress<double>(pct => progress.Report(pct * 0.96));
// Validate the entire media library
- await RootFolder.ValidateChildren(innerProgress, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), recursive: true, cancellationToken).ConfigureAwait(false);
+ await RootFolder.ValidateChildren(innerProgress, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), recursive: true, cancellationToken: cancellationToken).ConfigureAwait(false);
progress.Report(96);