mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-31 04:05:50 -04:00
Update Emby.Server.Implementations/ScheduledTasks/Tasks/CleanupCollectionAndPlaylistPathsTask.cs
Co-authored-by: Bond-009 <bond.009@outlook.com>
This commit is contained in:
parent
783bb8a8cb
commit
fccea4625d
@ -112,17 +112,17 @@ public class CleanupCollectionAndPlaylistPathsTask : IScheduledTask
|
|||||||
private void CleanupLinkedChildren<T>(T folder, CancellationToken cancellationToken)
|
private void CleanupLinkedChildren<T>(T folder, CancellationToken cancellationToken)
|
||||||
where T : Folder
|
where T : Folder
|
||||||
{
|
{
|
||||||
var itemsToRemove = new List<LinkedChild>();
|
List<LinkedChild> itemsToRemove = null;
|
||||||
foreach (var linkedChild in folder.LinkedChildren)
|
foreach (var linkedChild in folder.LinkedChildren)
|
||||||
{
|
{
|
||||||
if (!File.Exists(folder.Path))
|
if (!File.Exists(folder.Path))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Item in {FolderName} cannot be found at {ItemPath}", folder.Name, linkedChild.Path);
|
_logger.LogInformation("Item in {FolderName} cannot be found at {ItemPath}", folder.Name, linkedChild.Path);
|
||||||
itemsToRemove.Add(linkedChild);
|
(itemsToRemove ??= new List<LinkedChild>()).Add(linkedChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemsToRemove.Count != 0)
|
if (itemsToRemove is not null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Updating {FolderName}", folder.Name);
|
_logger.LogDebug("Updating {FolderName}", folder.Name);
|
||||||
folder.LinkedChildren = folder.LinkedChildren.Except(itemsToRemove).ToArray();
|
folder.LinkedChildren = folder.LinkedChildren.Except(itemsToRemove).ToArray();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user