Added user option to download chapter titles from Audible.

This commit is contained in:
Michael Bucari-Tovo 2021-06-28 12:55:56 -06:00
parent b5389c67ea
commit b65f9567e0
6 changed files with 346 additions and 274 deletions

View file

@ -70,16 +70,26 @@ namespace FileLiberator.AaxcDownloadDecrypt
var dlLic = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId);
var contentMetadata = await api.GetLibraryBookMetadataAsync(libraryBook.Book.AudibleProductId);
var aaxcDecryptDlLic = new DownloadLicense(dlLic.DownloadUrl, dlLic.AudibleKey, dlLic.AudibleIV, Resources.UserAgent);
var aaxcDecryptDlLic = new AaxDecrypter.DownloadLicense(dlLic.DownloadUrl, dlLic.AudibleKey, dlLic.AudibleIV, Resources.UserAgent);
var destinationDirectory = Path.GetDirectoryName(destinationDir);
var aaxcDecryptChapters = new AaxDecrypter.ChapterInfo();
AaxcDownloadConverter newDownloader;
if (Configuration.Instance.DownloadChapters)
{
var contentMetadata = await api.GetLibraryBookMetadataAsync(libraryBook.Book.AudibleProductId);
foreach (var chap in contentMetadata?.ChapterInfo?.Chapters)
aaxcDecryptChapters.AddChapter(new Chapter(chap.Title, chap.StartOffsetMs, chap.LengthMs));
var aaxcDecryptChapters = new ChapterInfo();
var newDownloader = await AaxcDownloadConverter.CreateAsync(Path.GetDirectoryName(destinationDir), aaxcDecryptDlLic, aaxcDecryptChapters);
foreach (var chap in contentMetadata?.ChapterInfo?.Chapters)
aaxcDecryptChapters.AddChapter(new Chapter(chap.Title, chap.StartOffsetMs, chap.LengthMs));
newDownloader = await AaxcDownloadConverter.CreateAsync(destinationDirectory, aaxcDecryptDlLic, aaxcDecryptChapters);
}
else
{
newDownloader = await AaxcDownloadConverter.CreateAsync(destinationDirectory, aaxcDecryptDlLic);
}
newDownloader.AppName = "Libation";