Skip to content

Commit

Permalink
fix: don't try to remove VFS root for media folders
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
revam committed Oct 7, 2024
1 parent 55fc933 commit 9153c73
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions Shokofin/Resolvers/VirtualFileSystemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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

/// <summary>
Expand Down

0 comments on commit 9153c73

Please sign in to comment.