aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorgnattu <gnattuoc@me.com>2024-05-11 03:54:41 +0800
committergnattu <gnattuoc@me.com>2024-05-11 03:57:22 +0800
commit588fb9e82bbf58fae5d8d5643c57abfc49639e83 (patch)
tree2e154b3ea01636dca7c5d01c761b39551983c708 /MediaBrowser.Controller/Entities
parent145dc31ccb3634290fee151afb8557feaf2c3220 (diff)
Don't assume library change only on item count
The library will also be updated when the number of children remains the same before and after scanning. For example, if one video file is removed and replaced with another version, we still need to remove the old one in this case. Signed-off-by: gnattu <gnattuoc@me.com>
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs7
1 files changed, 3 insertions, 4 deletions
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index f39fa79eb..f49e5f769 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -421,13 +421,12 @@ namespace MediaBrowser.Controller.Entities
validChildren.Add(child);
}
+ // That's all the new and changed ones - now see if there are any that are missing
+ var itemsRemoved = currentChildren.Values.Except(validChildren).ToList();
var shouldRemove = !IsRoot || allowRemoveRoot;
// If it's an AggregateFolder, don't remove
- if (shouldRemove && currentChildren.Count != validChildren.Count)
+ if (shouldRemove && itemsRemoved.Count > 0)
{
- // That's all the new and changed ones - now see if there are any that are missing
- var itemsRemoved = currentChildren.Values.Except(validChildren).ToList();
-
foreach (var item in itemsRemoved)
{
if (item.IsFileProtocol)