mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-08-27 04:08:33 +00:00
Reduce the amount of exceptions thrown
This commit is contained in:
parent
10a0d6bdba
commit
37ea50a572
13 changed files with 632 additions and 82 deletions
|
|
@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.IO;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.LocalMetadata.Images
|
||||
{
|
||||
|
|
@ -12,11 +13,16 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public InternalMetadataFolderImageProvider(IServerConfigurationManager config, IFileSystem fileSystem)
|
||||
public InternalMetadataFolderImageProvider(
|
||||
IServerConfigurationManager config,
|
||||
IFileSystem fileSystem,
|
||||
ILogger<InternalMetadataFolderImageProvider> logger)
|
||||
{
|
||||
_config = config;
|
||||
_fileSystem = fileSystem;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string Name => "Internal Images";
|
||||
|
|
@ -53,12 +59,18 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
{
|
||||
var path = item.GetInternalMetadataPath();
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
return new List<LocalImageInfo>();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return new LocalImageProvider(_fileSystem).GetImages(item, path, false, directoryService);
|
||||
}
|
||||
catch (IOException)
|
||||
catch (IOException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while getting images for {Library}", item.Name);
|
||||
return new List<LocalImageInfo>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue