Merge pull request #11911 from Bond-009/infoaudionorm

Log album name and id in normalization task
This commit is contained in:
Bond-009 2024-06-24 22:51:57 +02:00 committed by GitHub
commit c9b6ebd94f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -106,13 +106,20 @@ public partial class AudioNormalizationTask : IScheduledTask
continue;
}
var tempFile = Path.Join(_configurationManager.GetTranscodePath(), Guid.NewGuid() + ".concat");
_logger.LogInformation("Calculating LUFS for album: {Album} with id: {Id}", a.Name, a.Id);
var tempFile = Path.Join(_configurationManager.GetTranscodePath(), a.Id + ".concat");
var inputLines = albumTracks.Select(x => string.Format(CultureInfo.InvariantCulture, "file '{0}'", x.Path.Replace("'", @"'\''", StringComparison.Ordinal)));
await File.WriteAllLinesAsync(tempFile, inputLines, cancellationToken).ConfigureAwait(false);
a.LUFS = await CalculateLUFSAsync(
string.Format(CultureInfo.InvariantCulture, "-f concat -safe 0 -i \"{0}\"", tempFile),
cancellationToken).ConfigureAwait(false);
File.Delete(tempFile);
try
{
a.LUFS = await CalculateLUFSAsync(
string.Format(CultureInfo.InvariantCulture, "-f concat -safe 0 -i \"{0}\"", tempFile),
cancellationToken).ConfigureAwait(false);
}
finally
{
File.Delete(tempFile);
}
}
_itemRepository.SaveItems(albums, cancellationToken);