Fix slow local image validation (#990)

* Check for local image directory existence to avoid tons of exceptions
pull/998/head
Claus Vium 5 years ago committed by Bond-009
parent e281c79d6f
commit 2e9a3d45c2

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -65,6 +66,12 @@ namespace MediaBrowser.LocalMetadata.Images
var path = item.ContainingFolderPath;
// Exit if the cache dir does not exist, alternative solution is to create it, but that's a lot of empty dirs...
if (!Directory.Exists(path))
{
return Array.Empty<FileSystemMetadata>();
}
if (includeDirectories)
{
return directoryService.GetFileSystemEntries(path)

@ -92,10 +92,7 @@ namespace MediaBrowser.Providers.Manager
catch (Exception ex)
{
localImagesFailed = true;
if (!(item is IItemByName))
{
Logger.LogError(ex, "Error validating images for {0}", item.Path ?? item.Name ?? "Unknown name");
}
Logger.LogError(ex, "Error validating images for {0}", item.Path ?? item.Name ?? "Unknown name");
}
var metadataResult = new MetadataResult<TItemType>

Loading…
Cancel
Save