From 9153c7301c70315b475f5f74d1283c071d67d26a Mon Sep 17 00:00:00 2001 From: Mikal Stordal Date: Mon, 7 Oct 2024 06:03:48 +0200 Subject: [PATCH] fix: don't try to remove VFS root for media folders - Don't try to remove VFS roots for the media folders anymore, since the roots are now attached to the library and not media folders within the libraries. --- .../Resolvers/VirtualFileSystemService.cs | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/Shokofin/Resolvers/VirtualFileSystemService.cs b/Shokofin/Resolvers/VirtualFileSystemService.cs index 2f55db7a..98b79e0c 100644 --- a/Shokofin/Resolvers/VirtualFileSystemService.cs +++ b/Shokofin/Resolvers/VirtualFileSystemService.cs @@ -83,13 +83,11 @@ NamingOptions namingOptions DataCache = new(logger, new() { ExpirationScanFrequency = TimeSpan.FromMinutes(25) }, new() { AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1), SlidingExpiration = TimeSpan.FromMinutes(15) }); NamingOptions = namingOptions; ExternalPathParser = new ExternalPathParser(namingOptions, localizationManager, MediaBrowser.Model.Dlna.DlnaProfileType.Subtitle); - LibraryManager.ItemRemoved += OnLibraryManagerItemRemoved; Plugin.Instance.Tracker.Stalled += OnTrackerStalled; } ~VirtualFileSystemService() { - LibraryManager.ItemRemoved -= OnLibraryManagerItemRemoved; Plugin.Instance.Tracker.Stalled -= OnTrackerStalled; DataCache.Dispose(); } @@ -103,25 +101,6 @@ public void Clear() DataCache.Clear(); } - #region Changes Tracking - - private void OnLibraryManagerItemRemoved(object? sender, ItemChangeEventArgs e) - { - // Remove the VFS directory for any media library folders when they're removed. - var root = LibraryManager.RootFolder; - if (e.Item != null && root != null && e.Item != root && e.Item is CollectionFolder folder) { - var vfsPath = folder.GetVirtualRoot(); - DataCache.Remove($"should-skip-vfs-path:{vfsPath}"); - if (Directory.Exists(vfsPath)) { - Logger.LogInformation("Removing VFS directory for folder at {Path}", folder.Path); - Directory.Delete(vfsPath, true); - Logger.LogInformation("Removed VFS directory for folder at {Path}", folder.Path); - } - } - } - - #endregion - #region Generate Structure ///