From db84c9a7d91953be77a9624b8ac7d5a23e7d607a Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Thu, 23 Sep 2021 16:50:59 -0400 Subject: [PATCH] unencrypted podcast downloads (incomplete) --- AaxDecrypter/AaxcDownloadConverter.cs | 19 +------- AaxDecrypter/DownloadLicense.cs | 9 ++-- AaxDecrypter/NFO.cs | 54 ---------------------- AppScaffolding/AppScaffolding.csproj | 2 +- InternalUtilities/InternalUtilities.csproj | 2 +- 5 files changed, 7 insertions(+), 79 deletions(-) delete mode 100644 AaxDecrypter/NFO.cs diff --git a/AaxDecrypter/AaxcDownloadConverter.cs b/AaxDecrypter/AaxcDownloadConverter.cs index 60f14003..c91429ba 100644 --- a/AaxDecrypter/AaxcDownloadConverter.cs +++ b/AaxDecrypter/AaxcDownloadConverter.cs @@ -55,8 +55,7 @@ namespace AaxDecrypter ["Step 1: Get Aaxc Metadata"] = Step1_GetMetadata, ["Step 2: Download Decrypted Audiobook"] = Step2_DownloadAndCombine, ["Step 3: Create Cue"] = Step3_CreateCue, - ["Step 4: Create Nfo"] = Step4_CreateNfo, - ["Step 5: Cleanup"] = Step5_Cleanup, + ["Step 4: Cleanup"] = Step4_Cleanup, }; } @@ -197,21 +196,7 @@ namespace AaxDecrypter return !isCanceled; } - public bool Step4_CreateNfo() - { - // not a critical step. its failure should not prevent future steps from running - try - { - File.WriteAllText(PathLib.ReplaceExtension(outputFileName, ".nfo"), NFO.CreateContents(AppName, aaxFile, downloadLicense.ChapterInfo)); - } - catch (Exception ex) - { - Serilog.Log.Logger.Error(ex, $"{nameof(Step4_CreateNfo)}. FAILED"); - } - return !isCanceled; - } - - public bool Step5_Cleanup() + public bool Step4_Cleanup() { FileExt.SafeDelete(jsonDownloadState); FileExt.SafeDelete(tempFile); diff --git a/AaxDecrypter/DownloadLicense.cs b/AaxDecrypter/DownloadLicense.cs index 30e6cb3d..6b2eb8b1 100644 --- a/AaxDecrypter/DownloadLicense.cs +++ b/AaxDecrypter/DownloadLicense.cs @@ -13,15 +13,12 @@ namespace AaxDecrypter public DownloadLicense(string downloadUrl, string audibleKey, string audibleIV, string userAgent) { - ArgumentValidator.EnsureNotNullOrEmpty(downloadUrl, nameof(downloadUrl)); - ArgumentValidator.EnsureNotNullOrEmpty(audibleKey, nameof(audibleKey)); - ArgumentValidator.EnsureNotNullOrEmpty(audibleIV, nameof(audibleIV)); - ArgumentValidator.EnsureNotNullOrEmpty(userAgent, nameof(userAgent)); + DownloadUrl = ArgumentValidator.EnsureNotNullOrEmpty(downloadUrl, nameof(downloadUrl)); + UserAgent = ArgumentValidator.EnsureNotNullOrEmpty(userAgent, nameof(userAgent)); - DownloadUrl = downloadUrl; + // no null/empty check. unencrypted files do not have these AudibleKey = audibleKey; AudibleIV = audibleIV; - UserAgent = userAgent; } } } diff --git a/AaxDecrypter/NFO.cs b/AaxDecrypter/NFO.cs deleted file mode 100644 index 5eb0620b..00000000 --- a/AaxDecrypter/NFO.cs +++ /dev/null @@ -1,54 +0,0 @@ -using AAXClean; -using Dinah.Core; - -namespace AaxDecrypter -{ - public static class NFO - { - public static string CreateContents(string ripper, Mp4File aaxcTagLib, ChapterInfo chapters) - { - var _hours = (int)aaxcTagLib.Duration.TotalHours; - var myDuration - = (_hours > 0 ? _hours + " hours, " : string.Empty) - + aaxcTagLib.Duration.Minutes + " minutes, " - + aaxcTagLib.Duration.Seconds + " seconds"; - - var nfoString - = "General Information\r\n" - + "======================\r\n" - + $" Title: {aaxcTagLib.AppleTags.TitleSansUnabridged?.UnicodeToAscii() ?? "[unknown]"}\r\n" - + $" Author: {aaxcTagLib.AppleTags.FirstAuthor?.UnicodeToAscii() ?? "[unknown]"}\r\n" - + $" Read By: {aaxcTagLib.AppleTags.Narrator?.UnicodeToAscii() ?? "[unknown]"}\r\n" - + $" Release Date: {aaxcTagLib.AppleTags.ReleaseDate ?? "[unknown]"}\r\n" - + $" Book Copyright: {aaxcTagLib.AppleTags.BookCopyright ?? "[unknown]"}\r\n" - + $" Recording Copyright: {aaxcTagLib.AppleTags.RecordingCopyright ?? "[unknown]"}\r\n" - + $" Genre: {aaxcTagLib.AppleTags.Generes ?? "[unknown]"}\r\n" - + $" Publisher: {aaxcTagLib.AppleTags.Publisher ?? "[unknown]"}\r\n" - + $" Duration: {myDuration}\r\n" - + $" Chapters: {chapters.Count}\r\n" - + "\r\n" - + "\r\n" - + "Media Information\r\n" - + "======================\r\n" - + " Source Format: Audible AAXC\r\n" - + $" Source Sample Rate: {aaxcTagLib.TimeScale} Hz\r\n" - + $" Source Channels: {aaxcTagLib.AudioChannels}\r\n" - + $" Source Bitrate: {aaxcTagLib.AverageBitrate} Kbps\r\n" - + "\r\n" - + " Lossless Encode: Yes\r\n" - + " Encoded Codec: AAC / M4B\r\n" - + $" Encoded Sample Rate: {aaxcTagLib.TimeScale} Hz\r\n" - + $" Encoded Channels: {aaxcTagLib.AudioChannels}\r\n" - + $" Encoded Bitrate: {aaxcTagLib.AverageBitrate} Kbps\r\n" - + "\r\n" - + $" Ripper: {ripper}\r\n" - + "\r\n" - + "\r\n" - + "Book Description\r\n" - + "================\r\n" - + (!string.IsNullOrWhiteSpace(aaxcTagLib.AppleTags.LongDescription) ? aaxcTagLib.AppleTags.LongDescription.UnicodeToAscii() : aaxcTagLib.AppleTags.Comment?.UnicodeToAscii()); - - return nfoString; - } - } -} diff --git a/AppScaffolding/AppScaffolding.csproj b/AppScaffolding/AppScaffolding.csproj index 606e86a4..02aa2409 100644 --- a/AppScaffolding/AppScaffolding.csproj +++ b/AppScaffolding/AppScaffolding.csproj @@ -3,7 +3,7 @@ net5.0 - 6.0.6.2 + 6.0.7.1 diff --git a/InternalUtilities/InternalUtilities.csproj b/InternalUtilities/InternalUtilities.csproj index dcfaa588..93a70a4f 100644 --- a/InternalUtilities/InternalUtilities.csproj +++ b/InternalUtilities/InternalUtilities.csproj @@ -5,7 +5,7 @@ - +