Skip to content

Commit def7e76

Browse files
committed
fix: improve file system change reports for physical VFS libraries
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.
1 parent 0dde886 commit def7e76

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Shokofin/Events/EventDispatchService.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ private async Task ProcessFileEvents(int fileId, List<(UpdateReason Reason, int
359359

360360
result.Print(Logger, mediaFolderPath);
361361

362-
// If all the "top-level-folders" exist, then let the core logic handle the rest.
363-
if (topFolders.All(path => LibraryManager.FindByPath(path, true) is not null)) {
362+
// If we're using a physical VFS or all the "top-level-folders" exist, then let the core logic handle the rest.
363+
if (vfsPath == mainMediaFolderPath || topFolders.All(path => LibraryManager.FindByPath(path, true) is not null)) {
364364
locationsToNotify.AddRange(vfsSymbolicLinks);
365365
}
366366
// 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.
@@ -488,9 +488,8 @@ private void RemoveSymbolicLink(string filePath) {
488488
}
489489

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

0 commit comments

Comments
 (0)