aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/IO/FileRefresher.cs4
-rw-r--r--MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs15
2 files changed, 17 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/FileRefresher.cs b/MediaBrowser.Server.Implementations/IO/FileRefresher.cs
index 8e28aa2a0..3df7a03d4 100644
--- a/MediaBrowser.Server.Implementations/IO/FileRefresher.cs
+++ b/MediaBrowser.Server.Implementations/IO/FileRefresher.cs
@@ -12,6 +12,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations.ScheduledTasks;
+using MoreLinq;
namespace MediaBrowser.Server.Implementations.IO
{
@@ -136,9 +137,10 @@ namespace MediaBrowser.Server.Implementations.IO
private async Task ProcessPathChanges(List<string> paths)
{
var itemsToRefresh = paths
+ .Distinct(StringComparer.OrdinalIgnoreCase)
.Select(GetAffectedBaseItem)
.Where(item => item != null)
- .Distinct()
+ .DistinctBy(i => i.Id)
.ToList();
foreach (var p in paths)
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
index 8bb40a00e..6e0f9a3c4 100644
--- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
+++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
@@ -404,7 +404,20 @@ namespace MediaBrowser.Server.Implementations.IO
{
Logger.Debug("Changed detected of type " + e.ChangeType + " to " + e.FullPath);
- ReportFileSystemChanged(e.FullPath);
+ var path = e.FullPath;
+
+ // For deletes, use the parent path
+ if (e.ChangeType == WatcherChangeTypes.Deleted)
+ {
+ var parentPath = Path.GetDirectoryName(path);
+
+ if (!string.IsNullOrWhiteSpace(parentPath))
+ {
+ path = parentPath;
+ }
+ }
+
+ ReportFileSystemChanged(path);
}
catch (Exception ex)
{