Ensure chapter info is downloaded for unencrypted MP3s

This commit is contained in:
Michael Bucari-Tovo 2021-09-23 18:04:12 -06:00
parent e714179c30
commit 9f09a62a1e

View File

@ -95,7 +95,14 @@ namespace FileLiberator
Resources.USER_AGENT
);
if (Configuration.Instance.AllowLibationFixup)
//I assume if ContentFormat == "MPEG" that the delivered file is an unencrypted mp3.
//This may be wrong, and only time and bug reports will tell.
var outputFormat =
contentLic.ContentMetadata.ContentReference.ContentFormat == "MPEG" ||
(Configuration.Instance.AllowLibationFixup && Configuration.Instance.DecryptToLossy) ?
OutputFormat.Mp3 : OutputFormat.M4b;
if (Configuration.Instance.AllowLibationFixup || outputFormat == OutputFormat.Mp3)
{
aaxcDecryptDlLic.ChapterInfo = new AAXClean.ChapterInfo();
@ -103,13 +110,6 @@ namespace FileLiberator
aaxcDecryptDlLic.ChapterInfo.AddChapter(chap.Title, TimeSpan.FromMilliseconds(chap.LengthMs));
}
//I assume if ContentFormat == "MPEG" that the delivered file is an unencrypted mp3.
//This may be wrong, and only time and bug reports will tell.
var outputFormat =
contentLic.ContentMetadata.ContentReference.ContentFormat == "MPEG" ||
Configuration.Instance.DecryptToLossy ?
OutputFormat.Mp3 : OutputFormat.M4b;
var outFileName = Path.Combine(destinationDir, $"{PathLib.ToPathSafeString(libraryBook.Book.Title)} [{libraryBook.Book.AudibleProductId}].{outputFormat.ToString().ToLower()}");
aaxcDownloader = contentLic.DrmType == AudibleApi.Common.DrmType.Adrm ? new AaxcDownloadConverter(outFileName, cacheDir, aaxcDecryptDlLic, outputFormat) { AppName = "Libation" } : new Mp3Downloader(outFileName, cacheDir, aaxcDecryptDlLic);