Fixing genre metatag is conditional upon AllowLibationFixup setting
This commit is contained in:
parent
e1d549cead
commit
5e577843f7
@ -6,6 +6,8 @@ namespace AaxDecrypter
|
|||||||
{
|
{
|
||||||
public abstract class AaxcDownloadConvertBase : AudiobookDownloadBase
|
public abstract class AaxcDownloadConvertBase : AudiobookDownloadBase
|
||||||
{
|
{
|
||||||
|
public event EventHandler<AppleTags> RetrievedMetadata;
|
||||||
|
|
||||||
protected OutputFormat OutputFormat { get; }
|
protected OutputFormat OutputFormat { get; }
|
||||||
|
|
||||||
protected AaxFile AaxFile;
|
protected AaxFile AaxFile;
|
||||||
@ -24,20 +26,17 @@ namespace AaxDecrypter
|
|||||||
AaxFile.AppleTags.Cover = coverArt;
|
AaxFile.AppleTags.Cover = coverArt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Optional step to run after Metadata is retrieved</summary>
|
|
||||||
public Action<AaxFile> UpdateMetadata { get; set; }
|
|
||||||
|
|
||||||
protected bool Step_GetMetadata()
|
protected bool Step_GetMetadata()
|
||||||
{
|
{
|
||||||
AaxFile = new AaxFile(InputFileStream);
|
AaxFile = new AaxFile(InputFileStream);
|
||||||
|
|
||||||
UpdateMetadata?.Invoke(AaxFile);
|
|
||||||
|
|
||||||
OnRetrievedTitle(AaxFile.AppleTags.TitleSansUnabridged);
|
OnRetrievedTitle(AaxFile.AppleTags.TitleSansUnabridged);
|
||||||
OnRetrievedAuthors(AaxFile.AppleTags.FirstAuthor ?? "[unknown]");
|
OnRetrievedAuthors(AaxFile.AppleTags.FirstAuthor ?? "[unknown]");
|
||||||
OnRetrievedNarrators(AaxFile.AppleTags.Narrator ?? "[unknown]");
|
OnRetrievedNarrators(AaxFile.AppleTags.Narrator ?? "[unknown]");
|
||||||
OnRetrievedCoverArt(AaxFile.AppleTags.Cover);
|
OnRetrievedCoverArt(AaxFile.AppleTags.Cover);
|
||||||
|
|
||||||
|
RetrievedMetadata?.Invoke(this, AaxFile.AppleTags);
|
||||||
|
|
||||||
return !IsCanceled;
|
return !IsCanceled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -75,6 +75,7 @@ namespace AaxDecrypter
|
|||||||
=> RetrievedAuthors?.Invoke(this, authors);
|
=> RetrievedAuthors?.Invoke(this, authors);
|
||||||
protected void OnRetrievedNarrators(string narrators)
|
protected void OnRetrievedNarrators(string narrators)
|
||||||
=> RetrievedNarrators?.Invoke(this, narrators);
|
=> RetrievedNarrators?.Invoke(this, narrators);
|
||||||
|
|
||||||
protected void OnRetrievedCoverArt(byte[] coverArt)
|
protected void OnRetrievedCoverArt(byte[] coverArt)
|
||||||
=> RetrievedCoverArt?.Invoke(this, coverArt);
|
=> RetrievedCoverArt?.Invoke(this, coverArt);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
<Version>6.8.2.1</Version>
|
<Version>6.8.3.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -11,12 +11,6 @@ namespace FileLiberator
|
|||||||
public event EventHandler<byte[]> CoverImageDiscovered;
|
public event EventHandler<byte[]> CoverImageDiscovered;
|
||||||
public abstract void Cancel();
|
public abstract void Cancel();
|
||||||
|
|
||||||
protected void OnRequestCoverArt(Action<byte[]> 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(string title) => OnTitleDiscovered(null, title);
|
||||||
protected void OnTitleDiscovered(object _, string title)
|
protected void OnTitleDiscovered(object _, string title)
|
||||||
{
|
{
|
||||||
@ -38,6 +32,12 @@ namespace FileLiberator
|
|||||||
NarratorsDiscovered?.Invoke(this, narrators);
|
NarratorsDiscovered?.Invoke(this, narrators);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnRequestCoverArt(Action<byte[]> setCoverArtDel)
|
||||||
|
{
|
||||||
|
Serilog.Log.Logger.Debug("Event fired {@DebugInfo}", new { Name = nameof(RequestCoverArt) });
|
||||||
|
RequestCoverArt?.Invoke(this, setCoverArtDel);
|
||||||
|
}
|
||||||
|
|
||||||
protected void OnCoverImageDiscovered(byte[] coverImage)
|
protected void OnCoverImageDiscovered(byte[] coverImage)
|
||||||
{
|
{
|
||||||
Serilog.Log.Logger.Debug("Event fired {@DebugInfo}", new { Name = nameof(CoverImageDiscovered), CoverImageBytes = coverImage?.Length });
|
Serilog.Log.Logger.Debug("Event fired {@DebugInfo}", new { Name = nameof(CoverImageDiscovered), CoverImageBytes = coverImage?.Length });
|
||||||
|
|||||||
@ -128,7 +128,10 @@ namespace FileLiberator
|
|||||||
outFileName, cacheDir, audiobookDlLic, outputFormat,
|
outFileName, cacheDir, audiobookDlLic, outputFormat,
|
||||||
AudibleFileStorage.Audio.CreateMultipartRenamerFunc(libraryBook))
|
AudibleFileStorage.Audio.CreateMultipartRenamerFunc(libraryBook))
|
||||||
: new AaxcDownloadSingleConverter(outFileName, cacheDir, audiobookDlLic, outputFormat);
|
: 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;
|
abDownloader = converter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user