mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-23 22:21:04 +02:00
update library monitor
This commit is contained in:
parent
97ea2ff43a
commit
61ee765de9
|
@ -12,6 +12,7 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
||||||
|
using MoreLinq;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.IO
|
namespace MediaBrowser.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
|
@ -136,9 +137,10 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||||
private async Task ProcessPathChanges(List<string> paths)
|
private async Task ProcessPathChanges(List<string> paths)
|
||||||
{
|
{
|
||||||
var itemsToRefresh = paths
|
var itemsToRefresh = paths
|
||||||
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
.Select(GetAffectedBaseItem)
|
.Select(GetAffectedBaseItem)
|
||||||
.Where(item => item != null)
|
.Where(item => item != null)
|
||||||
.Distinct()
|
.DistinctBy(i => i.Id)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var p in paths)
|
foreach (var p in paths)
|
||||||
|
|
|
@ -404,7 +404,20 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
Logger.Debug("Changed detected of type " + e.ChangeType + " to " + e.FullPath);
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue