diff --git a/AaxDecrypter/AaxcDownloadConverter.cs b/AaxDecrypter/AaxcDownloadConverter.cs index 0fa7606b..c7df6961 100644 --- a/AaxDecrypter/AaxcDownloadConverter.cs +++ b/AaxDecrypter/AaxcDownloadConverter.cs @@ -15,7 +15,7 @@ namespace AaxDecrypter private OutputFormat OutputFormat { get; } - public AaxcDownloadConverter(string outFileName, string cacheDirectory, DownloadLicense dlLic, OutputFormat outputFormat) + public AaxcDownloadConverter(string outFileName, string cacheDirectory, DownloadLicense dlLic, OutputFormat outputFormat, bool splitFileByChapters) :base(outFileName, cacheDirectory, dlLic) { OutputFormat = outputFormat; @@ -25,8 +25,12 @@ namespace AaxDecrypter Name = "Download and Convert Aaxc To " + OutputFormat, ["Step 1: Get Aaxc Metadata"] = Step1_GetMetadata, - ["Step 2: Download Decrypted Audiobook"] = Step2_DownloadAudiobook, - ["Step 3: Create Cue"] = Step3_CreateCue, + ["Step 2: Download Decrypted Audiobook"] = splitFileByChapters + ? Step2_DownloadAudiobookAsMultipleFilesPerChapter + : Step2_DownloadAudiobookAsSingleFile, + ["Step 3: Create Cue"] = splitFileByChapters + ? () => true + : Step3_CreateCue, ["Step 4: Cleanup"] = Step4_Cleanup, }; } @@ -53,21 +57,10 @@ namespace AaxDecrypter return !isCanceled; } - protected override bool Step2_DownloadAudiobook() + protected override bool Step2_DownloadAudiobookAsSingleFile() { - var zeroProgress = new DownloadProgress - { - BytesReceived = 0, - ProgressPercentage = 0, - TotalBytesToReceive = InputFileStream.Length - }; - - OnDecryptProgressUpdate(zeroProgress); - - - aaxFile.SetDecryptionKey(downloadLicense.AudibleKey, downloadLicense.AudibleIV); - - + var zeroProgress = Step2_Start(); + if (File.Exists(outputFileName)) FileExt.SafeDelete(outputFileName); @@ -77,15 +70,78 @@ namespace AaxDecrypter var decryptionResult = OutputFormat == OutputFormat.M4b ? aaxFile.ConvertToMp4a(outputFile, downloadLicense.ChapterInfo) : aaxFile.ConvertToMp3(outputFile); aaxFile.ConversionProgressUpdate -= AaxFile_ConversionProgressUpdate; - aaxFile.Close(); - downloadLicense.ChapterInfo = aaxFile.Chapters; + + Step2_End(zeroProgress); + + return decryptionResult == ConversionResult.NoErrorsDetected && !isCanceled; + } + + private bool Step2_DownloadAudiobookAsMultipleFilesPerChapter() + { + var zeroProgress = Step2_Start(); + + aaxFile.ConversionProgressUpdate += AaxFile_ConversionProgressUpdate; + if(OutputFormat == OutputFormat.M4b) + ConvertToMultiMp4b(); + else + ConvertToMultiMp3(); + aaxFile.ConversionProgressUpdate -= AaxFile_ConversionProgressUpdate; + + Step2_End(zeroProgress); + + return true; + } + + private DownloadProgress Step2_Start() + { + var zeroProgress = new DownloadProgress + { + BytesReceived = 0, + ProgressPercentage = 0, + TotalBytesToReceive = InputFileStream.Length + }; + + OnDecryptProgressUpdate(zeroProgress); + + aaxFile.SetDecryptionKey(downloadLicense.AudibleKey, downloadLicense.AudibleIV); + return zeroProgress; + } + + private void Step2_End(DownloadProgress zeroProgress) + { + aaxFile.Close(); CloseInputFileStream(); OnDecryptProgressUpdate(zeroProgress); + } - return decryptionResult == ConversionResult.NoErrorsDetected && !isCanceled; + private void ConvertToMultiMp4b() + { + var chapterCount = 0; + aaxFile.ConvertToMultiMp4a(downloadLicense.ChapterInfo, newSplitCallback => + { + chapterCount++; + var fileName = Path.ChangeExtension(outputFileName, $"{chapterCount}.m4b"); + if (File.Exists(fileName)) + FileExt.SafeDelete(fileName); + newSplitCallback.OutputFile = File.Open(fileName, FileMode.OpenOrCreate); + }); + } + + private void ConvertToMultiMp3() + { + var chapterCount = 0; + aaxFile.ConvertToMultiMp3(downloadLicense.ChapterInfo, newSplitCallback => + { + chapterCount++; + var fileName = Path.ChangeExtension(outputFileName, $"{chapterCount}.mp3"); + if (File.Exists(fileName)) + FileExt.SafeDelete(fileName); + newSplitCallback.OutputFile = File.Open(fileName, FileMode.OpenOrCreate); + newSplitCallback.LameConfig.ID3.Track = chapterCount.ToString(); + }); } private void AaxFile_ConversionProgressUpdate(object sender, ConversionProgressEventArgs e) diff --git a/AaxDecrypter/AudiobookDownloadBase.cs b/AaxDecrypter/AudiobookDownloadBase.cs index 7a2425d4..a5436aab 100644 --- a/AaxDecrypter/AudiobookDownloadBase.cs +++ b/AaxDecrypter/AudiobookDownloadBase.cs @@ -59,7 +59,7 @@ namespace AaxDecrypter public abstract void Cancel(); protected abstract int GetSpeedup(TimeSpan elapsed); - protected abstract bool Step2_DownloadAudiobook(); + protected abstract bool Step2_DownloadAudiobookAsSingleFile(); protected abstract bool Step1_GetMetadata(); public virtual void SetCoverArt(byte[] coverArt) @@ -80,7 +80,7 @@ namespace AaxDecrypter return false; } - Serilog.Log.Logger.Information($"Speedup is {GetSpeedup(Elapsed)}x realtime."); + //Serilog.Log.Logger.Information($"Speedup is {GetSpeedup(Elapsed)}x realtime."); return true; } diff --git a/AaxDecrypter/UnencryptedAudiobookDownloader.cs b/AaxDecrypter/UnencryptedAudiobookDownloader.cs index b12ade35..31623e1d 100644 --- a/AaxDecrypter/UnencryptedAudiobookDownloader.cs +++ b/AaxDecrypter/UnencryptedAudiobookDownloader.cs @@ -21,7 +21,7 @@ namespace AaxDecrypter Name = "Download Mp3 Audiobook", ["Step 1: Get Mp3 Metadata"] = Step1_GetMetadata, - ["Step 2: Download Audiobook"] = Step2_DownloadAudiobook, + ["Step 2: Download Audiobook"] = Step2_DownloadAudiobookAsSingleFile, ["Step 3: Create Cue"] = Step3_CreateCue, ["Step 4: Cleanup"] = Step4_Cleanup, }; @@ -46,7 +46,7 @@ namespace AaxDecrypter return !isCanceled; } - protected override bool Step2_DownloadAudiobook() + protected override bool Step2_DownloadAudiobookAsSingleFile() { DateTime startTime = DateTime.Now; diff --git a/FileLiberator/DownloadDecryptBook.cs b/FileLiberator/DownloadDecryptBook.cs index f8e290de..3ed348b7 100644 --- a/FileLiberator/DownloadDecryptBook.cs +++ b/FileLiberator/DownloadDecryptBook.cs @@ -95,10 +95,12 @@ namespace FileLiberator foreach (var chap in contentLic.ContentMetadata?.ChapterInfo?.Chapters) 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, audiobookDlLic, outputFormat) { AppName = "Libation" } : new UnencryptedAudiobookDownloader(outFileName, cacheDir, audiobookDlLic); + aaxcDownloader = contentLic.DrmType == AudibleApi.Common.DrmType.Adrm + ? new AaxcDownloadConverter(outFileName, cacheDir, audiobookDlLic, outputFormat, Configuration.Instance.SplitFilesByChapter) { 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); @@ -138,7 +140,7 @@ namespace FileLiberator { // create final directory. move each file into it. MOVE AUDIO FILE LAST // new dir: safetitle_limit50char + " [" + productId + "]" - + // TODO make this method handle multiple audio files or a single audio file. var destinationDir = AudibleFileStorage.Audio.GetDestDir(product.Title, product.AudibleProductId); Directory.CreateDirectory(destinationDir); @@ -153,8 +155,8 @@ namespace FileLiberator foreach (var f in sortedFiles) { var dest - = AudibleFileStorage.Audio.IsFileTypeMatch(f) - ? audioFileName + = AudibleFileStorage.Audio.IsFileTypeMatch(f)//f.Extension.Equals($".{musicFileExt}", StringComparison.OrdinalIgnoreCase) + ? Path.Join(destinationDir, f.Name) // non-audio filename: safetitle_limit50char + " [" + productId + "][" + audio_ext + "]." + non_audio_ext : FileUtility.GetValidFilename(destinationDir, product.Title, f.Extension, product.AudibleProductId, musicFileExt); diff --git a/FileManager/Configuration.cs b/FileManager/Configuration.cs index 0c1ec471..68fbed5b 100644 --- a/FileManager/Configuration.cs +++ b/FileManager/Configuration.cs @@ -101,6 +101,13 @@ namespace FileManager get => persistentDictionary.GetNonString(nameof(DecryptToLossy)); set => persistentDictionary.SetNonString(nameof(DecryptToLossy), value); } + + [Description("Split my books into multi files by cahpter")] + public bool SplitFilesByChapter + { + get => persistentDictionary.GetNonString(nameof(SplitFilesByChapter)); + set => persistentDictionary.SetNonString(nameof(SplitFilesByChapter), value); + } public enum BadBookAction { diff --git a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs index d10cef34..251c7e68 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.Designer.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.Designer.cs @@ -28,312 +28,344 @@ /// private void InitializeComponent() { - this.booksLocationDescLbl = new System.Windows.Forms.Label(); - this.inProgressDescLbl = new System.Windows.Forms.Label(); - this.saveBtn = new System.Windows.Forms.Button(); - this.cancelBtn = new System.Windows.Forms.Button(); - this.advancedSettingsGb = new System.Windows.Forms.GroupBox(); - this.importEpisodesCb = new System.Windows.Forms.CheckBox(); - this.downloadEpisodesCb = new System.Windows.Forms.CheckBox(); - this.badBookGb = new System.Windows.Forms.GroupBox(); - this.badBookIgnoreRb = new System.Windows.Forms.RadioButton(); - this.badBookRetryRb = new System.Windows.Forms.RadioButton(); - this.badBookAbortRb = new System.Windows.Forms.RadioButton(); - this.badBookAskRb = new System.Windows.Forms.RadioButton(); - this.decryptAndConvertGb = new System.Windows.Forms.GroupBox(); - this.allowLibationFixupCbox = new System.Windows.Forms.CheckBox(); - this.convertLossyRb = new System.Windows.Forms.RadioButton(); - this.convertLosslessRb = new System.Windows.Forms.RadioButton(); - this.inProgressSelectControl = new LibationWinForms.Dialogs.DirectorySelectControl(); - this.logsBtn = new System.Windows.Forms.Button(); - this.booksSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); - this.booksGb = new System.Windows.Forms.GroupBox(); - this.loggingLevelLbl = new System.Windows.Forms.Label(); - this.loggingLevelCb = new System.Windows.Forms.ComboBox(); - this.advancedSettingsGb.SuspendLayout(); - this.badBookGb.SuspendLayout(); - this.decryptAndConvertGb.SuspendLayout(); - this.booksGb.SuspendLayout(); - this.SuspendLayout(); - // - // booksLocationDescLbl - // - this.booksLocationDescLbl.AutoSize = true; - this.booksLocationDescLbl.Location = new System.Drawing.Point(7, 19); - this.booksLocationDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.booksLocationDescLbl.Name = "booksLocationDescLbl"; - this.booksLocationDescLbl.Size = new System.Drawing.Size(69, 15); - this.booksLocationDescLbl.TabIndex = 1; - this.booksLocationDescLbl.Text = "[book desc]"; - // - // inProgressDescLbl - // - this.inProgressDescLbl.AutoSize = true; - this.inProgressDescLbl.Location = new System.Drawing.Point(8, 199); - this.inProgressDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.inProgressDescLbl.Name = "inProgressDescLbl"; - this.inProgressDescLbl.Size = new System.Drawing.Size(43, 45); - this.inProgressDescLbl.TabIndex = 18; - this.inProgressDescLbl.Text = "[desc]\r\n[line 2]\r\n[line 3]"; - // - // saveBtn - // - this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.saveBtn.Location = new System.Drawing.Point(714, 496); - this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.saveBtn.Name = "saveBtn"; - this.saveBtn.Size = new System.Drawing.Size(88, 27); - this.saveBtn.TabIndex = 98; - this.saveBtn.Text = "Save"; - this.saveBtn.UseVisualStyleBackColor = true; - this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); - // - // cancelBtn - // - this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelBtn.Location = new System.Drawing.Point(832, 496); - this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cancelBtn.Name = "cancelBtn"; - this.cancelBtn.Size = new System.Drawing.Size(88, 27); - this.cancelBtn.TabIndex = 99; - this.cancelBtn.Text = "Cancel"; - this.cancelBtn.UseVisualStyleBackColor = true; - this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); - // - // advancedSettingsGb - // - this.advancedSettingsGb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.booksLocationDescLbl = new System.Windows.Forms.Label(); + this.inProgressDescLbl = new System.Windows.Forms.Label(); + this.saveBtn = new System.Windows.Forms.Button(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.advancedSettingsGb = new System.Windows.Forms.GroupBox(); + this.importEpisodesCb = new System.Windows.Forms.CheckBox(); + this.downloadEpisodesCb = new System.Windows.Forms.CheckBox(); + this.badBookGb = new System.Windows.Forms.GroupBox(); + this.badBookIgnoreRb = new System.Windows.Forms.RadioButton(); + this.badBookRetryRb = new System.Windows.Forms.RadioButton(); + this.badBookAbortRb = new System.Windows.Forms.RadioButton(); + this.badBookAskRb = new System.Windows.Forms.RadioButton(); + this.decryptAndConvertGb = new System.Windows.Forms.GroupBox(); + this.allowLibationFixupCbox = new System.Windows.Forms.CheckBox(); + this.convertLossyRb = new System.Windows.Forms.RadioButton(); + this.convertLosslessRb = new System.Windows.Forms.RadioButton(); + this.inProgressSelectControl = new LibationWinForms.Dialogs.DirectorySelectControl(); + this.logsBtn = new System.Windows.Forms.Button(); + this.booksSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl(); + this.booksGb = new System.Windows.Forms.GroupBox(); + this.loggingLevelLbl = new System.Windows.Forms.Label(); + this.loggingLevelCb = new System.Windows.Forms.ComboBox(); + this.splitFilesByChapterCbox = new System.Windows.Forms.CheckBox(); + this.advancedSettingsGb.SuspendLayout(); + this.badBookGb.SuspendLayout(); + this.decryptAndConvertGb.SuspendLayout(); + this.booksGb.SuspendLayout(); + this.SuspendLayout(); + // + // booksLocationDescLbl + // + this.booksLocationDescLbl.AutoSize = true; + this.booksLocationDescLbl.Location = new System.Drawing.Point(8, 25); + this.booksLocationDescLbl.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.booksLocationDescLbl.Name = "booksLocationDescLbl"; + this.booksLocationDescLbl.Size = new System.Drawing.Size(87, 20); + this.booksLocationDescLbl.TabIndex = 1; + this.booksLocationDescLbl.Text = "[book desc]"; + // + // inProgressDescLbl + // + this.inProgressDescLbl.AutoSize = true; + this.inProgressDescLbl.Location = new System.Drawing.Point(9, 265); + this.inProgressDescLbl.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.inProgressDescLbl.Name = "inProgressDescLbl"; + this.inProgressDescLbl.Size = new System.Drawing.Size(55, 60); + this.inProgressDescLbl.TabIndex = 18; + this.inProgressDescLbl.Text = "[desc]\r\n[line 2]\r\n[line 3]"; + // + // saveBtn + // + this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.saveBtn.Location = new System.Drawing.Point(816, 661); + this.saveBtn.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.saveBtn.Name = "saveBtn"; + this.saveBtn.Size = new System.Drawing.Size(101, 36); + this.saveBtn.TabIndex = 98; + this.saveBtn.Text = "Save"; + this.saveBtn.UseVisualStyleBackColor = true; + this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); + // + // cancelBtn + // + this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelBtn.Location = new System.Drawing.Point(951, 661); + this.cancelBtn.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(101, 36); + this.cancelBtn.TabIndex = 99; + this.cancelBtn.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click); + // + // advancedSettingsGb + // + this.advancedSettingsGb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.advancedSettingsGb.Controls.Add(this.importEpisodesCb); - this.advancedSettingsGb.Controls.Add(this.downloadEpisodesCb); - this.advancedSettingsGb.Controls.Add(this.badBookGb); - this.advancedSettingsGb.Controls.Add(this.decryptAndConvertGb); - this.advancedSettingsGb.Controls.Add(this.inProgressSelectControl); - this.advancedSettingsGb.Controls.Add(this.inProgressDescLbl); - this.advancedSettingsGb.Location = new System.Drawing.Point(12, 176); - this.advancedSettingsGb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.advancedSettingsGb.Name = "advancedSettingsGb"; - this.advancedSettingsGb.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.advancedSettingsGb.Size = new System.Drawing.Size(908, 309); - this.advancedSettingsGb.TabIndex = 6; - this.advancedSettingsGb.TabStop = false; - this.advancedSettingsGb.Text = "Advanced settings for control freaks"; - // - // importEpisodesCb - // - this.importEpisodesCb.AutoSize = true; - this.importEpisodesCb.Location = new System.Drawing.Point(7, 22); - this.importEpisodesCb.Name = "importEpisodesCb"; - this.importEpisodesCb.Size = new System.Drawing.Size(146, 19); - this.importEpisodesCb.TabIndex = 7; - this.importEpisodesCb.Text = "[import episodes desc]"; - this.importEpisodesCb.UseVisualStyleBackColor = true; - // - // downloadEpisodesCb - // - this.downloadEpisodesCb.AutoSize = true; - this.downloadEpisodesCb.Location = new System.Drawing.Point(7, 47); - this.downloadEpisodesCb.Name = "downloadEpisodesCb"; - this.downloadEpisodesCb.Size = new System.Drawing.Size(163, 19); - this.downloadEpisodesCb.TabIndex = 8; - this.downloadEpisodesCb.Text = "[download episodes desc]"; - this.downloadEpisodesCb.UseVisualStyleBackColor = true; - // - // badBookGb - // - this.badBookGb.Controls.Add(this.badBookIgnoreRb); - this.badBookGb.Controls.Add(this.badBookRetryRb); - this.badBookGb.Controls.Add(this.badBookAbortRb); - this.badBookGb.Controls.Add(this.badBookAskRb); - this.badBookGb.Location = new System.Drawing.Point(372, 72); - this.badBookGb.Name = "badBookGb"; - this.badBookGb.Size = new System.Drawing.Size(529, 124); - this.badBookGb.TabIndex = 13; - this.badBookGb.TabStop = false; - this.badBookGb.Text = "[bad book desc]"; - // - // badBookIgnoreRb - // - this.badBookIgnoreRb.AutoSize = true; - this.badBookIgnoreRb.Location = new System.Drawing.Point(6, 97); - this.badBookIgnoreRb.Name = "badBookIgnoreRb"; - this.badBookIgnoreRb.Size = new System.Drawing.Size(94, 19); - this.badBookIgnoreRb.TabIndex = 17; - this.badBookIgnoreRb.TabStop = true; - this.badBookIgnoreRb.Text = "[ignore desc]"; - this.badBookIgnoreRb.UseVisualStyleBackColor = true; - // - // badBookRetryRb - // - this.badBookRetryRb.AutoSize = true; - this.badBookRetryRb.Location = new System.Drawing.Point(6, 72); - this.badBookRetryRb.Name = "badBookRetryRb"; - this.badBookRetryRb.Size = new System.Drawing.Size(84, 19); - this.badBookRetryRb.TabIndex = 16; - this.badBookRetryRb.TabStop = true; - this.badBookRetryRb.Text = "[retry desc]"; - this.badBookRetryRb.UseVisualStyleBackColor = true; - // - // badBookAbortRb - // - this.badBookAbortRb.AutoSize = true; - this.badBookAbortRb.Location = new System.Drawing.Point(6, 47); - this.badBookAbortRb.Name = "badBookAbortRb"; - this.badBookAbortRb.Size = new System.Drawing.Size(88, 19); - this.badBookAbortRb.TabIndex = 15; - this.badBookAbortRb.TabStop = true; - this.badBookAbortRb.Text = "[abort desc]"; - this.badBookAbortRb.UseVisualStyleBackColor = true; - // - // badBookAskRb - // - this.badBookAskRb.AutoSize = true; - this.badBookAskRb.Location = new System.Drawing.Point(6, 22); - this.badBookAskRb.Name = "badBookAskRb"; - this.badBookAskRb.Size = new System.Drawing.Size(77, 19); - this.badBookAskRb.TabIndex = 14; - this.badBookAskRb.TabStop = true; - this.badBookAskRb.Text = "[ask desc]"; - this.badBookAskRb.UseVisualStyleBackColor = true; - // - // decryptAndConvertGb - // - this.decryptAndConvertGb.Controls.Add(this.allowLibationFixupCbox); - this.decryptAndConvertGb.Controls.Add(this.convertLossyRb); - this.decryptAndConvertGb.Controls.Add(this.convertLosslessRb); - this.decryptAndConvertGb.Location = new System.Drawing.Point(7, 72); - this.decryptAndConvertGb.Name = "decryptAndConvertGb"; - this.decryptAndConvertGb.Size = new System.Drawing.Size(359, 124); - this.decryptAndConvertGb.TabIndex = 9; - this.decryptAndConvertGb.TabStop = false; - this.decryptAndConvertGb.Text = "Decrypt and convert"; - // - // allowLibationFixupCbox - // - this.allowLibationFixupCbox.AutoSize = true; - this.allowLibationFixupCbox.Checked = true; - this.allowLibationFixupCbox.CheckState = System.Windows.Forms.CheckState.Checked; - this.allowLibationFixupCbox.Location = new System.Drawing.Point(6, 22); - this.allowLibationFixupCbox.Name = "allowLibationFixupCbox"; - this.allowLibationFixupCbox.Size = new System.Drawing.Size(262, 19); - this.allowLibationFixupCbox.TabIndex = 10; - this.allowLibationFixupCbox.Text = "Allow Libation to fix up audiobook metadata"; - this.allowLibationFixupCbox.UseVisualStyleBackColor = true; - this.allowLibationFixupCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); - // - // convertLossyRb - // - this.convertLossyRb.AutoSize = true; - this.convertLossyRb.Location = new System.Drawing.Point(6, 81); - this.convertLossyRb.Name = "convertLossyRb"; - this.convertLossyRb.Size = new System.Drawing.Size(329, 19); - this.convertLossyRb.TabIndex = 12; - this.convertLossyRb.Text = "Download my books as .MP3 files (transcode if necessary)"; - this.convertLossyRb.UseVisualStyleBackColor = true; - // - // convertLosslessRb - // - this.convertLosslessRb.AutoSize = true; - this.convertLosslessRb.Checked = true; - this.convertLosslessRb.Location = new System.Drawing.Point(6, 56); - this.convertLosslessRb.Name = "convertLosslessRb"; - this.convertLosslessRb.Size = new System.Drawing.Size(335, 19); - this.convertLosslessRb.TabIndex = 11; - this.convertLosslessRb.TabStop = true; - this.convertLosslessRb.Text = "Download my books in the original audio format (Lossless)"; - this.convertLosslessRb.UseVisualStyleBackColor = true; - // - // inProgressSelectControl - // - this.inProgressSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.advancedSettingsGb.Controls.Add(this.importEpisodesCb); + this.advancedSettingsGb.Controls.Add(this.downloadEpisodesCb); + this.advancedSettingsGb.Controls.Add(this.badBookGb); + this.advancedSettingsGb.Controls.Add(this.decryptAndConvertGb); + this.advancedSettingsGb.Controls.Add(this.inProgressSelectControl); + this.advancedSettingsGb.Controls.Add(this.inProgressDescLbl); + this.advancedSettingsGb.Location = new System.Drawing.Point(14, 235); + this.advancedSettingsGb.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.advancedSettingsGb.Name = "advancedSettingsGb"; + this.advancedSettingsGb.Padding = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.advancedSettingsGb.Size = new System.Drawing.Size(1038, 412); + this.advancedSettingsGb.TabIndex = 6; + this.advancedSettingsGb.TabStop = false; + this.advancedSettingsGb.Text = "Advanced settings for control freaks"; + // + // importEpisodesCb + // + this.importEpisodesCb.AutoSize = true; + this.importEpisodesCb.Location = new System.Drawing.Point(8, 29); + this.importEpisodesCb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.importEpisodesCb.Name = "importEpisodesCb"; + this.importEpisodesCb.Size = new System.Drawing.Size(183, 24); + this.importEpisodesCb.TabIndex = 7; + this.importEpisodesCb.Text = "[import episodes desc]"; + this.importEpisodesCb.UseVisualStyleBackColor = true; + // + // downloadEpisodesCb + // + this.downloadEpisodesCb.AutoSize = true; + this.downloadEpisodesCb.Location = new System.Drawing.Point(8, 63); + this.downloadEpisodesCb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.downloadEpisodesCb.Name = "downloadEpisodesCb"; + this.downloadEpisodesCb.Size = new System.Drawing.Size(205, 24); + this.downloadEpisodesCb.TabIndex = 8; + this.downloadEpisodesCb.Text = "[download episodes desc]"; + this.downloadEpisodesCb.UseVisualStyleBackColor = true; + // + // badBookGb + // + this.badBookGb.Controls.Add(this.badBookIgnoreRb); + this.badBookGb.Controls.Add(this.badBookRetryRb); + this.badBookGb.Controls.Add(this.badBookAbortRb); + this.badBookGb.Controls.Add(this.badBookAskRb); + this.badBookGb.Location = new System.Drawing.Point(425, 96); + this.badBookGb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.badBookGb.Name = "badBookGb"; + this.badBookGb.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.badBookGb.Size = new System.Drawing.Size(605, 165); + this.badBookGb.TabIndex = 13; + this.badBookGb.TabStop = false; + this.badBookGb.Text = "[bad book desc]"; + // + // badBookIgnoreRb + // + this.badBookIgnoreRb.AutoSize = true; + this.badBookIgnoreRb.Location = new System.Drawing.Point(7, 129); + this.badBookIgnoreRb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.badBookIgnoreRb.Name = "badBookIgnoreRb"; + this.badBookIgnoreRb.Size = new System.Drawing.Size(117, 24); + this.badBookIgnoreRb.TabIndex = 17; + this.badBookIgnoreRb.TabStop = true; + this.badBookIgnoreRb.Text = "[ignore desc]"; + this.badBookIgnoreRb.UseVisualStyleBackColor = true; + // + // badBookRetryRb + // + this.badBookRetryRb.AutoSize = true; + this.badBookRetryRb.Location = new System.Drawing.Point(7, 96); + this.badBookRetryRb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.badBookRetryRb.Name = "badBookRetryRb"; + this.badBookRetryRb.Size = new System.Drawing.Size(104, 24); + this.badBookRetryRb.TabIndex = 16; + this.badBookRetryRb.TabStop = true; + this.badBookRetryRb.Text = "[retry desc]"; + this.badBookRetryRb.UseVisualStyleBackColor = true; + // + // badBookAbortRb + // + this.badBookAbortRb.AutoSize = true; + this.badBookAbortRb.Location = new System.Drawing.Point(7, 63); + this.badBookAbortRb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.badBookAbortRb.Name = "badBookAbortRb"; + this.badBookAbortRb.Size = new System.Drawing.Size(110, 24); + this.badBookAbortRb.TabIndex = 15; + this.badBookAbortRb.TabStop = true; + this.badBookAbortRb.Text = "[abort desc]"; + this.badBookAbortRb.UseVisualStyleBackColor = true; + // + // badBookAskRb + // + this.badBookAskRb.AutoSize = true; + this.badBookAskRb.Location = new System.Drawing.Point(7, 29); + this.badBookAskRb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.badBookAskRb.Name = "badBookAskRb"; + this.badBookAskRb.Size = new System.Drawing.Size(95, 24); + this.badBookAskRb.TabIndex = 14; + this.badBookAskRb.TabStop = true; + this.badBookAskRb.Text = "[ask desc]"; + this.badBookAskRb.UseVisualStyleBackColor = true; + // + // decryptAndConvertGb + // + this.decryptAndConvertGb.Controls.Add(this.splitFilesByChapterCbox); + this.decryptAndConvertGb.Controls.Add(this.allowLibationFixupCbox); + this.decryptAndConvertGb.Controls.Add(this.convertLossyRb); + this.decryptAndConvertGb.Controls.Add(this.convertLosslessRb); + this.decryptAndConvertGb.Location = new System.Drawing.Point(8, 96); + this.decryptAndConvertGb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.decryptAndConvertGb.Name = "decryptAndConvertGb"; + this.decryptAndConvertGb.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.decryptAndConvertGb.Size = new System.Drawing.Size(410, 165); + this.decryptAndConvertGb.TabIndex = 9; + this.decryptAndConvertGb.TabStop = false; + this.decryptAndConvertGb.Text = "Decrypt and convert"; + // + // allowLibationFixupCbox + // + this.allowLibationFixupCbox.AutoSize = true; + this.allowLibationFixupCbox.Checked = true; + this.allowLibationFixupCbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.allowLibationFixupCbox.Location = new System.Drawing.Point(7, 29); + this.allowLibationFixupCbox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.allowLibationFixupCbox.Name = "allowLibationFixupCbox"; + this.allowLibationFixupCbox.Size = new System.Drawing.Size(330, 24); + this.allowLibationFixupCbox.TabIndex = 10; + this.allowLibationFixupCbox.Text = "Allow Libation to fix up audiobook metadata"; + this.allowLibationFixupCbox.UseVisualStyleBackColor = true; + this.allowLibationFixupCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); + // + // convertLossyRb + // + this.convertLossyRb.AutoSize = true; + this.convertLossyRb.Location = new System.Drawing.Point(7, 135); + this.convertLossyRb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.convertLossyRb.Name = "convertLossyRb"; + this.convertLossyRb.Size = new System.Drawing.Size(411, 24); + this.convertLossyRb.TabIndex = 12; + this.convertLossyRb.Text = "Download my books as .MP3 files (transcode if necessary)"; + this.convertLossyRb.UseVisualStyleBackColor = true; + // + // convertLosslessRb + // + this.convertLosslessRb.AutoSize = true; + this.convertLosslessRb.Checked = true; + this.convertLosslessRb.Location = new System.Drawing.Point(7, 102); + this.convertLosslessRb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.convertLosslessRb.Name = "convertLosslessRb"; + this.convertLosslessRb.Size = new System.Drawing.Size(420, 24); + this.convertLosslessRb.TabIndex = 11; + this.convertLosslessRb.TabStop = true; + this.convertLosslessRb.Text = "Download my books in the original audio format (Lossless)"; + this.convertLosslessRb.UseVisualStyleBackColor = true; + // + // inProgressSelectControl + // + this.inProgressSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.inProgressSelectControl.Location = new System.Drawing.Point(7, 247); - this.inProgressSelectControl.Name = "inProgressSelectControl"; - this.inProgressSelectControl.Size = new System.Drawing.Size(552, 52); - this.inProgressSelectControl.TabIndex = 19; - // - // logsBtn - // - this.logsBtn.Location = new System.Drawing.Point(262, 147); - this.logsBtn.Name = "logsBtn"; - this.logsBtn.Size = new System.Drawing.Size(132, 23); - this.logsBtn.TabIndex = 5; - this.logsBtn.Text = "Open log folder"; - this.logsBtn.UseVisualStyleBackColor = true; - this.logsBtn.Click += new System.EventHandler(this.logsBtn_Click); - // - // booksSelectControl - // - this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.inProgressSelectControl.Location = new System.Drawing.Point(8, 329); + this.inProgressSelectControl.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5); + this.inProgressSelectControl.Name = "inProgressSelectControl"; + this.inProgressSelectControl.Size = new System.Drawing.Size(631, 69); + this.inProgressSelectControl.TabIndex = 19; + // + // logsBtn + // + this.logsBtn.Location = new System.Drawing.Point(299, 196); + this.logsBtn.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.logsBtn.Name = "logsBtn"; + this.logsBtn.Size = new System.Drawing.Size(151, 31); + this.logsBtn.TabIndex = 5; + this.logsBtn.Text = "Open log folder"; + this.logsBtn.UseVisualStyleBackColor = true; + this.logsBtn.Click += new System.EventHandler(this.logsBtn_Click); + // + // booksSelectControl + // + this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.booksSelectControl.Location = new System.Drawing.Point(7, 37); - this.booksSelectControl.Name = "booksSelectControl"; - this.booksSelectControl.Size = new System.Drawing.Size(895, 87); - this.booksSelectControl.TabIndex = 2; - // - // booksGb - // - this.booksGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.booksSelectControl.Location = new System.Drawing.Point(8, 49); + this.booksSelectControl.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5); + this.booksSelectControl.Name = "booksSelectControl"; + this.booksSelectControl.Size = new System.Drawing.Size(1023, 116); + this.booksSelectControl.TabIndex = 2; + // + // booksGb + // + this.booksGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.booksGb.Controls.Add(this.booksSelectControl); - this.booksGb.Controls.Add(this.booksLocationDescLbl); - this.booksGb.Location = new System.Drawing.Point(12, 12); - this.booksGb.Name = "booksGb"; - this.booksGb.Size = new System.Drawing.Size(908, 129); - this.booksGb.TabIndex = 0; - this.booksGb.TabStop = false; - this.booksGb.Text = "Books location"; - // - // loggingLevelLbl - // - this.loggingLevelLbl.AutoSize = true; - this.loggingLevelLbl.Location = new System.Drawing.Point(12, 150); - this.loggingLevelLbl.Name = "loggingLevelLbl"; - this.loggingLevelLbl.Size = new System.Drawing.Size(78, 15); - this.loggingLevelLbl.TabIndex = 3; - this.loggingLevelLbl.Text = "Logging level"; - // - // loggingLevelCb - // - this.loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.loggingLevelCb.FormattingEnabled = true; - this.loggingLevelCb.Location = new System.Drawing.Point(96, 147); - this.loggingLevelCb.Name = "loggingLevelCb"; - this.loggingLevelCb.Size = new System.Drawing.Size(129, 23); - this.loggingLevelCb.TabIndex = 4; - // - // SettingsDialog - // - this.AcceptButton = this.saveBtn; - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.cancelBtn; - this.ClientSize = new System.Drawing.Size(933, 539); - this.Controls.Add(this.logsBtn); - this.Controls.Add(this.loggingLevelCb); - this.Controls.Add(this.loggingLevelLbl); - this.Controls.Add(this.booksGb); - this.Controls.Add(this.advancedSettingsGb); - this.Controls.Add(this.cancelBtn); - this.Controls.Add(this.saveBtn); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.Name = "SettingsDialog"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Edit Settings"; - this.Load += new System.EventHandler(this.SettingsDialog_Load); - this.advancedSettingsGb.ResumeLayout(false); - this.advancedSettingsGb.PerformLayout(); - this.badBookGb.ResumeLayout(false); - this.badBookGb.PerformLayout(); - this.decryptAndConvertGb.ResumeLayout(false); - this.decryptAndConvertGb.PerformLayout(); - this.booksGb.ResumeLayout(false); - this.booksGb.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + this.booksGb.Controls.Add(this.booksSelectControl); + this.booksGb.Controls.Add(this.booksLocationDescLbl); + this.booksGb.Location = new System.Drawing.Point(14, 16); + this.booksGb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.booksGb.Name = "booksGb"; + this.booksGb.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.booksGb.Size = new System.Drawing.Size(1038, 172); + this.booksGb.TabIndex = 0; + this.booksGb.TabStop = false; + this.booksGb.Text = "Books location"; + // + // loggingLevelLbl + // + this.loggingLevelLbl.AutoSize = true; + this.loggingLevelLbl.Location = new System.Drawing.Point(14, 200); + this.loggingLevelLbl.Name = "loggingLevelLbl"; + this.loggingLevelLbl.Size = new System.Drawing.Size(99, 20); + this.loggingLevelLbl.TabIndex = 3; + this.loggingLevelLbl.Text = "Logging level"; + // + // loggingLevelCb + // + this.loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.loggingLevelCb.FormattingEnabled = true; + this.loggingLevelCb.Location = new System.Drawing.Point(110, 196); + this.loggingLevelCb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.loggingLevelCb.Name = "loggingLevelCb"; + this.loggingLevelCb.Size = new System.Drawing.Size(147, 28); + this.loggingLevelCb.TabIndex = 4; + // + // splitFilesByChapterCbox + // + this.splitFilesByChapterCbox.AutoSize = true; + this.splitFilesByChapterCbox.Location = new System.Drawing.Point(7, 61); + this.splitFilesByChapterCbox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.splitFilesByChapterCbox.Name = "splitFilesByChapterCbox"; + this.splitFilesByChapterCbox.Size = new System.Drawing.Size(323, 24); + this.splitFilesByChapterCbox.TabIndex = 13; + this.splitFilesByChapterCbox.Text = "Split my books into multiple files by chapter"; + this.splitFilesByChapterCbox.UseVisualStyleBackColor = true; + // + // SettingsDialog + // + this.AcceptButton = this.saveBtn; + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelBtn; + this.ClientSize = new System.Drawing.Size(1066, 719); + this.Controls.Add(this.logsBtn); + this.Controls.Add(this.loggingLevelCb); + this.Controls.Add(this.loggingLevelLbl); + this.Controls.Add(this.booksGb); + this.Controls.Add(this.advancedSettingsGb); + this.Controls.Add(this.cancelBtn); + this.Controls.Add(this.saveBtn); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.Name = "SettingsDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Edit Settings"; + this.Load += new System.EventHandler(this.SettingsDialog_Load); + this.advancedSettingsGb.ResumeLayout(false); + this.advancedSettingsGb.PerformLayout(); + this.badBookGb.ResumeLayout(false); + this.badBookGb.PerformLayout(); + this.decryptAndConvertGb.ResumeLayout(false); + this.decryptAndConvertGb.PerformLayout(); + this.booksGb.ResumeLayout(false); + this.booksGb.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -360,5 +392,6 @@ private System.Windows.Forms.RadioButton badBookIgnoreRb; private System.Windows.Forms.CheckBox downloadEpisodesCb; private System.Windows.Forms.CheckBox importEpisodesCb; - } + private System.Windows.Forms.CheckBox splitFilesByChapterCbox; + } } \ No newline at end of file diff --git a/LibationWinForms/Dialogs/SettingsDialog.cs b/LibationWinForms/Dialogs/SettingsDialog.cs index 3e2434e7..67fc8238 100644 --- a/LibationWinForms/Dialogs/SettingsDialog.cs +++ b/LibationWinForms/Dialogs/SettingsDialog.cs @@ -48,6 +48,7 @@ namespace LibationWinForms.Dialogs allowLibationFixupCbox.Checked = config.AllowLibationFixup; convertLosslessRb.Checked = !config.DecryptToLossy; convertLossyRb.Checked = config.DecryptToLossy; + splitFilesByChapterCbox.Checked = config.SplitFilesByChapter; allowLibationFixupCbox_CheckedChanged(this, e); @@ -129,6 +130,7 @@ namespace LibationWinForms.Dialogs config.DownloadEpisodes = downloadEpisodesCb.Checked; config.AllowLibationFixup = allowLibationFixupCbox.Checked; config.DecryptToLossy = convertLossyRb.Checked; + config.SplitFilesByChapter = splitFilesByChapterCbox.Checked; config.InProgress = inProgressSelectControl.SelectedDirectory;