From d9f3fa825ce1f8b2ad0ad3c6ca6dc470aa4be411 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Thu, 23 Sep 2021 18:13:43 -0600 Subject: [PATCH] Renaming and comments. --- ...ownloader.cs => UnencryptedAudiobookDownloader.cs} | 4 ++-- FileLiberator/DownloadDecryptBook.cs | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) rename AaxDecrypter/{Mp3AudiobookDownloader.cs => UnencryptedAudiobookDownloader.cs} (92%) diff --git a/AaxDecrypter/Mp3AudiobookDownloader.cs b/AaxDecrypter/UnencryptedAudiobookDownloader.cs similarity index 92% rename from AaxDecrypter/Mp3AudiobookDownloader.cs rename to AaxDecrypter/UnencryptedAudiobookDownloader.cs index d0dfe48e..b12ade35 100644 --- a/AaxDecrypter/Mp3AudiobookDownloader.cs +++ b/AaxDecrypter/UnencryptedAudiobookDownloader.cs @@ -8,11 +8,11 @@ using System.Threading; namespace AaxDecrypter { - public class Mp3AudiobookDownloader : AudiobookDownloadBase + public class UnencryptedAudiobookDownloader : AudiobookDownloadBase { protected override StepSequence steps { get; } - public Mp3AudiobookDownloader(string outFileName, string cacheDirectory, DownloadLicense dlLic) + public UnencryptedAudiobookDownloader(string outFileName, string cacheDirectory, DownloadLicense dlLic) : base(outFileName, cacheDirectory, dlLic) { diff --git a/FileLiberator/DownloadDecryptBook.cs b/FileLiberator/DownloadDecryptBook.cs index 9cf43a88..16288d1b 100644 --- a/FileLiberator/DownloadDecryptBook.cs +++ b/FileLiberator/DownloadDecryptBook.cs @@ -87,7 +87,7 @@ namespace FileLiberator var api = await libraryBook.GetApiAsync(); var contentLic = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId); - var aaxcDecryptDlLic = new DownloadLicense + var audiobookDlLic = new DownloadLicense ( contentLic?.ContentMetadata?.ContentUrl?.OfflineUrl, contentLic?.Voucher?.Key, @@ -96,7 +96,8 @@ namespace FileLiberator ); //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. + //I also assume that if DrmType == Adrm, the file will be an mp3. + //These assumptions may be wrong, and only time and bug reports will tell. var outputFormat = contentLic.ContentMetadata.ContentReference.ContentFormat == "MPEG" || (Configuration.Instance.AllowLibationFixup && Configuration.Instance.DecryptToLossy) ? @@ -104,15 +105,15 @@ namespace FileLiberator if (Configuration.Instance.AllowLibationFixup || outputFormat == OutputFormat.Mp3) { - aaxcDecryptDlLic.ChapterInfo = new AAXClean.ChapterInfo(); + audiobookDlLic.ChapterInfo = new AAXClean.ChapterInfo(); foreach (var chap in contentLic.ContentMetadata?.ChapterInfo?.Chapters) - aaxcDecryptDlLic.ChapterInfo.AddChapter(chap.Title, TimeSpan.FromMilliseconds(chap.LengthMs)); + audiobookDlLic.ChapterInfo.AddChapter(chap.Title, TimeSpan.FromMilliseconds(chap.LengthMs)); } 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 Mp3AudiobookDownloader(outFileName, cacheDir, aaxcDecryptDlLic); + aaxcDownloader = contentLic.DrmType == AudibleApi.Common.DrmType.Adrm ? new AaxcDownloadConverter(outFileName, cacheDir, audiobookDlLic, outputFormat) { AppName = "Libation" } : new UnencryptedAudiobookDownloader(outFileName, cacheDir, audiobookDlLic); aaxcDownloader.DecryptProgressUpdate += (s, progress) => StreamingProgressChanged?.Invoke(this, progress); aaxcDownloader.DecryptTimeRemaining += (s, remaining) => StreamingTimeRemaining?.Invoke(this, remaining); aaxcDownloader.RetrievedTitle += (s, title) => TitleDiscovered?.Invoke(this, title);