Styling, format, minor code changes (crobibero)

This commit is contained in:
Nick
2023-05-17 23:25:52 -07:00
parent 07e6804f7a
commit 98e41d5a14
4 changed files with 26 additions and 41 deletions

View File

@@ -94,7 +94,7 @@ public class TrickplayImagesTask : IScheduledTask
}
catch (Exception ex)
{
_logger.LogError("Error creating trickplay files for {ItemName}: {Msg}", item.Name, ex);
_logger.LogError(ex, "Error creating trickplay files for {ItemName}", item.Name);
}
numComplete++;

View File

@@ -33,6 +33,7 @@ public class TrickplayManager : ITrickplayManager
private readonly IServerConfigurationManager _config;
private static readonly SemaphoreSlim _resourcePool = new(1, 1);
private static readonly string[] _trickplayImgExtensions = { ".jpg" };
/// <summary>
/// Initializes a new instance of the <see cref="TrickplayManager"/> class.
@@ -95,10 +96,10 @@ public class TrickplayManager : ITrickplayManager
var imgTempDir = string.Empty;
var outputDir = GetTrickplayDirectory(video, width);
await _resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
await _resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
if (!replace && Directory.Exists(outputDir) && GetTilesResolutions(video.Id).ContainsKey(width))
{
_logger.LogDebug("Found existing trickplay files for {ItemId}. Exiting.", video.Id);
@@ -139,8 +140,7 @@ public class TrickplayManager : ITrickplayManager
throw new InvalidOperationException("Null or invalid directory from media encoder.");
}
var images = _fileSystem.GetFiles(imgTempDir, new string[] { ".jpg" }, false, false)
.Where(img => string.Equals(img.Extension, ".jpg", StringComparison.Ordinal))
var images = _fileSystem.GetFiles(imgTempDir, _trickplayImgExtensions, false, false)
.OrderBy(i => i.FullName)
.ToList();

View File

@@ -25,7 +25,6 @@ public class TrickplayProvider : ICustomMetadataProvider<Episode>,
IHasOrder,
IForcedProvider
{
private readonly ILogger<TrickplayProvider> _logger;
private readonly IServerConfigurationManager _config;
private readonly ITrickplayManager _trickplayManager;
private readonly ILibraryManager _libraryManager;
@@ -33,17 +32,14 @@ public class TrickplayProvider : ICustomMetadataProvider<Episode>,
/// <summary>
/// Initializes a new instance of the <see cref="TrickplayProvider"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="config">The configuration manager.</param>
/// <param name="trickplayManager">The trickplay manager.</param>
/// <param name="libraryManager">The library manager.</param>
public TrickplayProvider(
ILogger<TrickplayProvider> logger,
IServerConfigurationManager config,
ITrickplayManager trickplayManager,
ILibraryManager libraryManager)
{
_logger = logger;
_config = config;
_trickplayManager = trickplayManager;
_libraryManager = libraryManager;