diff --git a/AaxDecrypter/AudiobookDownloadBase.cs b/AaxDecrypter/AudiobookDownloadBase.cs index 0de90a27..e9bb0a0e 100644 --- a/AaxDecrypter/AudiobookDownloadBase.cs +++ b/AaxDecrypter/AudiobookDownloadBase.cs @@ -98,6 +98,8 @@ namespace AaxDecrypter protected bool Step_CreateCue() { + if (!DownloadOptions.CreateCueSheet) return true; + // not a critical step. its failure should not prevent future steps from running try { diff --git a/AaxDecrypter/DownloadOptions.cs b/AaxDecrypter/DownloadOptions.cs index b5af20f9..efeb2664 100644 --- a/AaxDecrypter/DownloadOptions.cs +++ b/AaxDecrypter/DownloadOptions.cs @@ -13,10 +13,11 @@ namespace AaxDecrypter public bool TrimOutputToChapterLength { get; init; } public bool RetainEncryptedFile { get; init; } public bool StripUnabridged { get; init; } + public bool CreateCueSheet { get; init; } public ChapterInfo ChapterInfo { get; set; } public NAudio.Lame.LameConfig LameConfig { get; set; } public bool Downsample { get; set; } - public bool MatchSourceBitrate { get; set; } + public bool MatchSourceBitrate { get; set; } public DownloadOptions(string downloadUrl, string userAgent) { diff --git a/AppScaffolding/LibationScaffolding.cs b/AppScaffolding/LibationScaffolding.cs index c6be3bc3..21d3126c 100644 --- a/AppScaffolding/LibationScaffolding.cs +++ b/AppScaffolding/LibationScaffolding.cs @@ -66,30 +66,23 @@ namespace AppScaffolding if (!config.Exists(nameof(config.AllowLibationFixup))) config.AllowLibationFixup = true; - if (!config.Exists(nameof(config.DecryptToLossy))) - config.DecryptToLossy = false; + if (!config.Exists(nameof(config.CreateCueSheet))) + config.CreateCueSheet = true; - if (!config.Exists(nameof(config.BadBook))) - config.BadBook = Configuration.BadBookAction.Ask; - - if (!config.Exists(nameof(config.DownloadEpisodes))) - config.DownloadEpisodes = true; - - if (!config.Exists(nameof(config.ImportEpisodes))) - config.ImportEpisodes = true; - - if (!config.Exists(nameof(config.SplitFilesByChapter))) - config.SplitFilesByChapter = false; - - if (!config.Exists(nameof(config.StripUnabridged))) - config.StripUnabridged = false; - - if (!config.Exists(nameof(config.StripAudibleBrandAudio))) - config.StripAudibleBrandAudio = false; - if (!config.Exists(nameof(config.RetainAaxFile))) config.RetainAaxFile = false; + if (!config.Exists(nameof(config.SplitFilesByChapter))) + config.SplitFilesByChapter = false; + + if (!config.Exists(nameof(config.StripUnabridged))) + config.StripUnabridged = false; + + if (!config.Exists(nameof(config.StripAudibleBrandAudio))) + config.StripAudibleBrandAudio = false; + + if (!config.Exists(nameof(config.DecryptToLossy))) + config.DecryptToLossy = false; if (!config.Exists(nameof(config.LameTargetBitrate))) config.LameTargetBitrate = false; @@ -109,6 +102,17 @@ namespace AppScaffolding if (!config.Exists(nameof(config.LameVBRQuality))) config.LameVBRQuality = 2; + if (!config.Exists(nameof(config.BadBook))) + config.BadBook = Configuration.BadBookAction.Ask; + + if (!config.Exists(nameof(config.ShowImportedStats))) + config.ShowImportedStats = true; + + if (!config.Exists(nameof(config.ImportEpisodes))) + config.ImportEpisodes = true; + + if (!config.Exists(nameof(config.DownloadEpisodes))) + config.DownloadEpisodes = true; if (!config.Exists(nameof(config.FolderTemplate))) config.FolderTemplate = Templates.Folder.DefaultTemplate; @@ -118,9 +122,6 @@ namespace AppScaffolding if (!config.Exists(nameof(config.ChapterFileTemplate))) config.ChapterFileTemplate = Templates.ChapterFile.DefaultTemplate; - - if (!config.Exists(nameof(config.ShowImportedStats))) - config.ShowImportedStats = true; } /// Initialize logging. Run after migration diff --git a/FileLiberator/DownloadDecryptBook.cs b/FileLiberator/DownloadDecryptBook.cs index 4db73c1e..7bca70e2 100644 --- a/FileLiberator/DownloadDecryptBook.cs +++ b/FileLiberator/DownloadDecryptBook.cs @@ -161,6 +161,7 @@ namespace FileLiberator StripUnabridged = config.AllowLibationFixup && config.StripUnabridged, Downsample = config.AllowLibationFixup && config.LameDownsampleMono, MatchSourceBitrate = config.AllowLibationFixup && config.LameMatchSourceBR && config.LameTargetBitrate, + CreateCueSheet = config.CreateCueSheet }; if (config.AllowLibationFixup || outputFormat == OutputFormat.Mp3) diff --git a/LibationFileManager/Configuration.cs b/LibationFileManager/Configuration.cs index de24635f..ff508e95 100644 --- a/LibationFileManager/Configuration.cs +++ b/LibationFileManager/Configuration.cs @@ -96,6 +96,27 @@ namespace LibationFileManager set => persistentDictionary.SetNonString(nameof(AllowLibationFixup), value); } + [Description("Create a cue sheet (.cue)")] + public bool CreateCueSheet + { + get => persistentDictionary.GetNonString(nameof(CreateCueSheet)); + set => persistentDictionary.SetNonString(nameof(CreateCueSheet), value); + } + + [Description("Retain the Aax file after successfully decrypting")] + public bool RetainAaxFile + { + get => persistentDictionary.GetNonString(nameof(RetainAaxFile)); + set => persistentDictionary.SetNonString(nameof(RetainAaxFile), value); + } + + [Description("Split my books into multiple files by chapter")] + public bool SplitFilesByChapter + { + get => persistentDictionary.GetNonString(nameof(SplitFilesByChapter)); + set => persistentDictionary.SetNonString(nameof(SplitFilesByChapter), value); + } + [Description("Strip \"(Unabridged)\" from audiobook metadata tags")] public bool StripUnabridged { @@ -116,20 +137,6 @@ namespace LibationFileManager get => persistentDictionary.GetNonString(nameof(DecryptToLossy)); set => persistentDictionary.SetNonString(nameof(DecryptToLossy), value); } - - [Description("Split my books into multiple files by chapter")] - public bool SplitFilesByChapter - { - get => persistentDictionary.GetNonString(nameof(SplitFilesByChapter)); - set => persistentDictionary.SetNonString(nameof(SplitFilesByChapter), value); - } - - [Description("Retain the Aax file after successfully decrypting")] - public bool RetainAaxFile - { - get => persistentDictionary.GetNonString(nameof(RetainAaxFile)); - set => persistentDictionary.SetNonString(nameof(RetainAaxFile), value); - } [Description("Lame encoder target. true = Bitrate, false = Quality")] public bool LameTargetBitrate diff --git a/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs b/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs index 712ed7a3..6b45db4e 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs @@ -31,7 +31,7 @@ namespace LibationWinForms.Dialogs convertLosslessRb.Enabled = allowLibationFixupCbox.Checked; convertLossyRb.Enabled = allowLibationFixupCbox.Checked; splitFilesByChapterCbox.Enabled = allowLibationFixupCbox.Checked; - stripUnabridgedCbox.Enabled = allowLibationFixupCbox.Enabled; + stripUnabridgedCbox.Enabled = allowLibationFixupCbox.Checked; stripAudibleBrandingCbox.Enabled = allowLibationFixupCbox.Checked; if (!allowLibationFixupCbox.Checked) @@ -42,6 +42,5 @@ namespace LibationWinForms.Dialogs stripAudibleBrandingCbox.Checked = false; } } - } } diff --git a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index 42ec8bd7..94aa5cdc 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -99,6 +99,7 @@ this.lameTargetBitrateRb = new System.Windows.Forms.RadioButton(); this.stripUnabridgedCbox = new System.Windows.Forms.CheckBox(); this.retainAaxFileCbox = new System.Windows.Forms.CheckBox(); + this.createCueSheetCbox = new System.Windows.Forms.CheckBox(); this.badBookGb.SuspendLayout(); this.tabControl.SuspendLayout(); this.tab1ImportantSettings.SuspendLayout(); @@ -241,7 +242,7 @@ // stripAudibleBrandingCbox // this.stripAudibleBrandingCbox.AutoSize = true; - this.stripAudibleBrandingCbox.Location = new System.Drawing.Point(19, 118); + this.stripAudibleBrandingCbox.Location = new System.Drawing.Point(19, 143); this.stripAudibleBrandingCbox.Name = "stripAudibleBrandingCbox"; this.stripAudibleBrandingCbox.Size = new System.Drawing.Size(143, 34); this.stripAudibleBrandingCbox.TabIndex = 13; @@ -251,7 +252,7 @@ // splitFilesByChapterCbox // this.splitFilesByChapterCbox.AutoSize = true; - this.splitFilesByChapterCbox.Location = new System.Drawing.Point(19, 68); + this.splitFilesByChapterCbox.Location = new System.Drawing.Point(19, 93); this.splitFilesByChapterCbox.Name = "splitFilesByChapterCbox"; this.splitFilesByChapterCbox.Size = new System.Drawing.Size(162, 19); this.splitFilesByChapterCbox.TabIndex = 13; @@ -274,7 +275,7 @@ // convertLossyRb // this.convertLossyRb.AutoSize = true; - this.convertLossyRb.Location = new System.Drawing.Point(19, 182); + this.convertLossyRb.Location = new System.Drawing.Point(19, 207); this.convertLossyRb.Name = "convertLossyRb"; this.convertLossyRb.Size = new System.Drawing.Size(329, 19); this.convertLossyRb.TabIndex = 12; @@ -286,7 +287,7 @@ // this.convertLosslessRb.AutoSize = true; this.convertLosslessRb.Checked = true; - this.convertLosslessRb.Location = new System.Drawing.Point(19, 157); + this.convertLosslessRb.Location = new System.Drawing.Point(19, 182); this.convertLosslessRb.Name = "convertLosslessRb"; this.convertLosslessRb.Size = new System.Drawing.Size(335, 19); this.convertLosslessRb.TabIndex = 11; @@ -553,6 +554,7 @@ this.tab4AudioFileOptions.Controls.Add(this.stripUnabridgedCbox); this.tab4AudioFileOptions.Controls.Add(this.splitFilesByChapterCbox); this.tab4AudioFileOptions.Controls.Add(this.retainAaxFileCbox); + this.tab4AudioFileOptions.Controls.Add(this.createCueSheetCbox); this.tab4AudioFileOptions.Controls.Add(this.allowLibationFixupCbox); this.tab4AudioFileOptions.Location = new System.Drawing.Point(4, 24); this.tab4AudioFileOptions.Name = "tab4AudioFileOptions"; @@ -688,12 +690,13 @@ // lameBitrateTb // this.lameBitrateTb.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.lameBitrateTb.LargeChange = 2; + this.lameBitrateTb.LargeChange = 32; this.lameBitrateTb.Location = new System.Drawing.Point(6, 22); this.lameBitrateTb.Maximum = 320; this.lameBitrateTb.Minimum = 16; this.lameBitrateTb.Name = "lameBitrateTb"; this.lameBitrateTb.Size = new System.Drawing.Size(409, 45); + this.lameBitrateTb.SmallChange = 8; this.lameBitrateTb.TabIndex = 0; this.lameBitrateTb.TickFrequency = 16; this.lameBitrateTb.Value = 64; @@ -842,6 +845,7 @@ // lameVBRQualityTb // this.lameVBRQualityTb.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.lameVBRQualityTb.LargeChange = 1; this.lameVBRQualityTb.Location = new System.Drawing.Point(10, 22); this.lameVBRQualityTb.Maximum = 9; this.lameVBRQualityTb.Name = "lameVBRQualityTb"; @@ -887,7 +891,7 @@ // stripUnabridgedCbox // this.stripUnabridgedCbox.AutoSize = true; - this.stripUnabridgedCbox.Location = new System.Drawing.Point(19, 93); + this.stripUnabridgedCbox.Location = new System.Drawing.Point(19, 118); this.stripUnabridgedCbox.Name = "stripUnabridgedCbox"; this.stripUnabridgedCbox.Size = new System.Drawing.Size(147, 19); this.stripUnabridgedCbox.TabIndex = 13; @@ -897,7 +901,7 @@ // retainAaxFileCbox // this.retainAaxFileCbox.AutoSize = true; - this.retainAaxFileCbox.Location = new System.Drawing.Point(19, 43); + this.retainAaxFileCbox.Location = new System.Drawing.Point(19, 68); this.retainAaxFileCbox.Name = "retainAaxFileCbox"; this.retainAaxFileCbox.Size = new System.Drawing.Size(132, 19); this.retainAaxFileCbox.TabIndex = 10; @@ -905,6 +909,19 @@ this.retainAaxFileCbox.UseVisualStyleBackColor = true; this.retainAaxFileCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); // + // createCueSheetCbox + // + this.createCueSheetCbox.AutoSize = true; + this.createCueSheetCbox.Checked = true; + this.createCueSheetCbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.createCueSheetCbox.Location = new System.Drawing.Point(19, 43); + this.createCueSheetCbox.Name = "createCueSheetCbox"; + this.createCueSheetCbox.Size = new System.Drawing.Size(145, 19); + this.createCueSheetCbox.TabIndex = 10; + this.createCueSheetCbox.Text = "[CreateCueSheet desc]"; + this.createCueSheetCbox.UseVisualStyleBackColor = true; + this.createCueSheetCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); + // // SettingsDialog // this.AcceptButton = this.saveBtn; @@ -1023,5 +1040,6 @@ private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label16; + private System.Windows.Forms.CheckBox createCueSheetCbox; } } \ No newline at end of file diff --git a/LibationWinForms/Dialogs/SettingsDialog.cs b/LibationWinForms/Dialogs/SettingsDialog.cs index 6ee4ca74..0bc85858 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.cs @@ -37,6 +37,7 @@ namespace LibationWinForms.Dialogs this.stripAudibleBrandingCbox.Text = desc(nameof(config.StripAudibleBrandAudio)); this.retainAaxFileCbox.Text = desc(nameof(config.RetainAaxFile)); this.stripUnabridgedCbox.Text = desc(nameof(config.StripUnabridged)); + this.createCueSheetCbox.Text = desc(nameof(config.CreateCueSheet)); booksSelectControl.SetSearchTitle("books location"); booksSelectControl.SetDirectoryItems( @@ -50,16 +51,14 @@ namespace LibationWinForms.Dialogs "Books"); booksSelectControl.SelectDirectory(config.Books); - showImportedStatsCb.Checked = config.ShowImportedStats; - importEpisodesCb.Checked = config.ImportEpisodes; - downloadEpisodesCb.Checked = config.DownloadEpisodes; allowLibationFixupCbox.Checked = config.AllowLibationFixup; + createCueSheetCbox.Checked = config.CreateCueSheet; retainAaxFileCbox.Checked = config.RetainAaxFile; - convertLosslessRb.Checked = !config.DecryptToLossy; - convertLossyRb.Checked = config.DecryptToLossy; + splitFilesByChapterCbox.Checked = config.SplitFilesByChapter; stripUnabridgedCbox.Checked = config.StripUnabridged; stripAudibleBrandingCbox.Checked = config.StripAudibleBrandAudio; - splitFilesByChapterCbox.Checked = config.SplitFilesByChapter; + convertLosslessRb.Checked = !config.DecryptToLossy; + convertLossyRb.Checked = config.DecryptToLossy; lameTargetBitrateRb.Checked = config.LameTargetBitrate; lameTargetQualityRb.Checked = !config.LameTargetBitrate; @@ -69,6 +68,10 @@ namespace LibationWinForms.Dialogs LameMatchSourceBRCbox.Checked = config.LameMatchSourceBR; lameVBRQualityTb.Value = config.LameVBRQuality; + showImportedStatsCb.Checked = config.ShowImportedStats; + importEpisodesCb.Checked = config.ImportEpisodes; + downloadEpisodesCb.Checked = config.DownloadEpisodes; + lameTargetRb_CheckedChanged(this, e); LameMatchSourceBRCbox_CheckedChanged(this, e); convertFormatRb_CheckedChanged(this, e); @@ -172,15 +175,13 @@ namespace LibationWinForms.Dialogs MessageBoxVerboseLoggingWarning.ShowIfTrue(); } - config.ShowImportedStats = showImportedStatsCb.Checked; - config.ImportEpisodes = importEpisodesCb.Checked; - config.DownloadEpisodes = downloadEpisodesCb.Checked; config.AllowLibationFixup = allowLibationFixupCbox.Checked; + config.CreateCueSheet = createCueSheetCbox.Checked; config.RetainAaxFile = retainAaxFileCbox.Checked; - config.DecryptToLossy = convertLossyRb.Checked; + config.SplitFilesByChapter = splitFilesByChapterCbox.Checked; config.StripUnabridged = stripUnabridgedCbox.Checked; config.StripAudibleBrandAudio = stripAudibleBrandingCbox.Checked; - config.SplitFilesByChapter = splitFilesByChapterCbox.Checked; + config.DecryptToLossy = convertLossyRb.Checked; config.LameTargetBitrate = lameTargetBitrateRb.Checked; config.LameDownsampleMono = lameDownsampleMonoCbox.Checked; @@ -189,6 +190,10 @@ namespace LibationWinForms.Dialogs config.LameMatchSourceBR = LameMatchSourceBRCbox.Checked; config.LameVBRQuality = lameVBRQualityTb.Value; + config.ShowImportedStats = showImportedStatsCb.Checked; + config.ImportEpisodes = importEpisodesCb.Checked; + config.DownloadEpisodes = downloadEpisodesCb.Checked; + config.InProgress = inProgressSelectControl.SelectedDirectory; config.BadBook