Skip to content

Commit

Permalink
fix: improve file system change reports for physical VFS libraries
Browse files Browse the repository at this point in the history
Leave it 100% to Jellyfin for how to handle it when new series have been added to the VFS, instead of giving it a random folder in the root of the physical VFS and say it has changed.
  • Loading branch information
revam committed Jan 11, 2025
1 parent 0dde886 commit def7e76
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Shokofin/Events/EventDispatchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ private async Task ProcessFileEvents(int fileId, List<(UpdateReason Reason, int

result.Print(Logger, mediaFolderPath);

// If all the "top-level-folders" exist, then let the core logic handle the rest.
if (topFolders.All(path => LibraryManager.FindByPath(path, true) is not null)) {
// If we're using a physical VFS or all the "top-level-folders" exist, then let the core logic handle the rest.
if (vfsPath == mainMediaFolderPath || topFolders.All(path => LibraryManager.FindByPath(path, true) is not null)) {
locationsToNotify.AddRange(vfsSymbolicLinks);
}
// Else give the core logic _any_ file or folder placed directly in the media folder, so it will schedule the media folder to be refreshed.
Expand Down Expand Up @@ -488,9 +488,8 @@ private void RemoveSymbolicLink(string filePath) {
}

private async Task ReportMediaFolderChanged(Folder mediaFolder, string pathToReport) {
// Don't block real-time file events on the media folder that uses a physical VFS root, or if real-time monitoring is disabled.
if (mediaFolder.Path.StartsWith(Plugin.Instance.VirtualRoot) ||
LibraryManager.GetLibraryOptions(mediaFolder) is not LibraryOptions libraryOptions ||
// Block real-time file events if real-time monitoring is disabled.
if (LibraryManager.GetLibraryOptions(mediaFolder) is not LibraryOptions libraryOptions ||
!libraryOptions.EnableRealtimeMonitor
) {
LibraryMonitor.ReportFileSystemChanged(pathToReport);
Expand Down

0 comments on commit def7e76

Please sign in to comment.