mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 23:30:50 +02:00
Fix slow local image validation (#990)
* Check for local image directory existence to avoid tons of exceptions
This commit is contained in:
parent
e281c79d6f
commit
2e9a3d45c2
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
@ -65,6 +66,12 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
|
|
||||||
var path = item.ContainingFolderPath;
|
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)
|
if (includeDirectories)
|
||||||
{
|
{
|
||||||
return directoryService.GetFileSystemEntries(path)
|
return directoryService.GetFileSystemEntries(path)
|
||||||
|
|
|
@ -92,10 +92,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
localImagesFailed = true;
|
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>
|
var metadataResult = new MetadataResult<TItemType>
|
||||||
|
|
Loading…
Reference in a new issue