diff --git a/AaxDecrypter/AaxcDownloadConvertBase.cs b/AaxDecrypter/AaxcDownloadConvertBase.cs index 20fd0850..726d1efd 100644 --- a/AaxDecrypter/AaxcDownloadConvertBase.cs +++ b/AaxDecrypter/AaxcDownloadConvertBase.cs @@ -6,6 +6,8 @@ namespace AaxDecrypter { public abstract class AaxcDownloadConvertBase : AudiobookDownloadBase { + public event EventHandler RetrievedMetadata; + protected OutputFormat OutputFormat { get; } protected AaxFile AaxFile; @@ -24,20 +26,17 @@ namespace AaxDecrypter AaxFile.AppleTags.Cover = coverArt; } - /// Optional step to run after Metadata is retrieved - public Action UpdateMetadata { get; set; } - protected bool Step_GetMetadata() { AaxFile = new AaxFile(InputFileStream); - UpdateMetadata?.Invoke(AaxFile); - OnRetrievedTitle(AaxFile.AppleTags.TitleSansUnabridged); OnRetrievedAuthors(AaxFile.AppleTags.FirstAuthor ?? "[unknown]"); OnRetrievedNarrators(AaxFile.AppleTags.Narrator ?? "[unknown]"); OnRetrievedCoverArt(AaxFile.AppleTags.Cover); + RetrievedMetadata?.Invoke(this, AaxFile.AppleTags); + return !IsCanceled; } diff --git a/AaxDecrypter/AudiobookDownloadBase.cs b/AaxDecrypter/AudiobookDownloadBase.cs index fc8f8ef7..80ab189d 100644 --- a/AaxDecrypter/AudiobookDownloadBase.cs +++ b/AaxDecrypter/AudiobookDownloadBase.cs @@ -75,6 +75,7 @@ namespace AaxDecrypter => RetrievedAuthors?.Invoke(this, authors); protected void OnRetrievedNarrators(string narrators) => RetrievedNarrators?.Invoke(this, narrators); + protected void OnRetrievedCoverArt(byte[] coverArt) => RetrievedCoverArt?.Invoke(this, coverArt); diff --git a/AppScaffolding/AppScaffolding.csproj b/AppScaffolding/AppScaffolding.csproj index 19333d12..984d2cd4 100644 --- a/AppScaffolding/AppScaffolding.csproj +++ b/AppScaffolding/AppScaffolding.csproj @@ -3,7 +3,7 @@ net6.0-windows - 6.8.2.1 + 6.8.3.1 diff --git a/FileLiberator/AudioDecodable.cs b/FileLiberator/AudioDecodable.cs index 1b527472..3f230fb7 100644 --- a/FileLiberator/AudioDecodable.cs +++ b/FileLiberator/AudioDecodable.cs @@ -11,12 +11,6 @@ namespace FileLiberator public event EventHandler CoverImageDiscovered; public abstract void Cancel(); - protected void OnRequestCoverArt(Action setCoverArtDel) - { - Serilog.Log.Logger.Debug("Event fired {@DebugInfo}", new { Name = nameof(RequestCoverArt) }); - RequestCoverArt?.Invoke(this, setCoverArtDel); - } - protected void OnTitleDiscovered(string title) => OnTitleDiscovered(null, title); protected void OnTitleDiscovered(object _, string title) { @@ -38,6 +32,12 @@ namespace FileLiberator NarratorsDiscovered?.Invoke(this, narrators); } + protected void OnRequestCoverArt(Action setCoverArtDel) + { + Serilog.Log.Logger.Debug("Event fired {@DebugInfo}", new { Name = nameof(RequestCoverArt) }); + RequestCoverArt?.Invoke(this, setCoverArtDel); + } + protected void OnCoverImageDiscovered(byte[] coverImage) { Serilog.Log.Logger.Debug("Event fired {@DebugInfo}", new { Name = nameof(CoverImageDiscovered), CoverImageBytes = coverImage?.Length }); diff --git a/FileLiberator/DownloadDecryptBook.cs b/FileLiberator/DownloadDecryptBook.cs index efe74d6c..369c353f 100644 --- a/FileLiberator/DownloadDecryptBook.cs +++ b/FileLiberator/DownloadDecryptBook.cs @@ -128,7 +128,10 @@ namespace FileLiberator outFileName, cacheDir, audiobookDlLic, outputFormat, AudibleFileStorage.Audio.CreateMultipartRenamerFunc(libraryBook)) : new AaxcDownloadSingleConverter(outFileName, cacheDir, audiobookDlLic, outputFormat); - converter.UpdateMetadata = aaxFile => aaxFile.AppleTags.Generes = string.Join(", ", libraryBook.Book.CategoriesNames); + + if (Configuration.Instance.AllowLibationFixup) + converter.RetrievedMetadata += (_, tags) => tags.Generes = string.Join(", ", libraryBook.Book.CategoriesNames); + abDownloader = converter; }