Merge pull request #127 from seanke/feature/multi_files

To mulitple files
This commit is contained in:
rmcrackan 2021-10-05 10:01:43 -04:00 committed by GitHub
commit 2a1f02b095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 431 additions and 331 deletions

View File

@ -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,20 +57,9 @@ 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)

View File

@ -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;
}

View File

@ -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;

View File

@ -98,7 +98,9 @@ namespace FileLiberator
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);

View File

@ -102,6 +102,13 @@ namespace FileManager
set => persistentDictionary.SetNonString(nameof(DecryptToLossy), value);
}
[Description("Split my books into multi files by cahpter")]
public bool SplitFilesByChapter
{
get => persistentDictionary.GetNonString<bool>(nameof(SplitFilesByChapter));
set => persistentDictionary.SetNonString(nameof(SplitFilesByChapter), value);
}
public enum BadBookAction
{
[Description("Ask each time what action to take.")]

View File

@ -50,6 +50,7 @@
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();
@ -59,30 +60,30 @@
// 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.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(69, 15);
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(8, 199);
this.inProgressDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
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(43, 45);
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(714, 496);
this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
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(88, 27);
this.saveBtn.Size = new System.Drawing.Size(101, 36);
this.saveBtn.TabIndex = 98;
this.saveBtn.Text = "Save";
this.saveBtn.UseVisualStyleBackColor = true;
@ -92,10 +93,10 @@
//
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.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(88, 27);
this.cancelBtn.Size = new System.Drawing.Size(101, 36);
this.cancelBtn.TabIndex = 99;
this.cancelBtn.Text = "Cancel";
this.cancelBtn.UseVisualStyleBackColor = true;
@ -112,11 +113,11 @@
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.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(4, 3, 4, 3);
this.advancedSettingsGb.Size = new System.Drawing.Size(908, 309);
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";
@ -124,9 +125,10 @@
// importEpisodesCb
//
this.importEpisodesCb.AutoSize = true;
this.importEpisodesCb.Location = new System.Drawing.Point(7, 22);
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(146, 19);
this.importEpisodesCb.Size = new System.Drawing.Size(183, 24);
this.importEpisodesCb.TabIndex = 7;
this.importEpisodesCb.Text = "[import episodes desc]";
this.importEpisodesCb.UseVisualStyleBackColor = true;
@ -134,9 +136,10 @@
// downloadEpisodesCb
//
this.downloadEpisodesCb.AutoSize = true;
this.downloadEpisodesCb.Location = new System.Drawing.Point(7, 47);
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(163, 19);
this.downloadEpisodesCb.Size = new System.Drawing.Size(205, 24);
this.downloadEpisodesCb.TabIndex = 8;
this.downloadEpisodesCb.Text = "[download episodes desc]";
this.downloadEpisodesCb.UseVisualStyleBackColor = true;
@ -147,9 +150,11 @@
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.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.Size = new System.Drawing.Size(529, 124);
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]";
@ -157,9 +162,10 @@
// badBookIgnoreRb
//
this.badBookIgnoreRb.AutoSize = true;
this.badBookIgnoreRb.Location = new System.Drawing.Point(6, 97);
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(94, 19);
this.badBookIgnoreRb.Size = new System.Drawing.Size(117, 24);
this.badBookIgnoreRb.TabIndex = 17;
this.badBookIgnoreRb.TabStop = true;
this.badBookIgnoreRb.Text = "[ignore desc]";
@ -168,9 +174,10 @@
// badBookRetryRb
//
this.badBookRetryRb.AutoSize = true;
this.badBookRetryRb.Location = new System.Drawing.Point(6, 72);
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(84, 19);
this.badBookRetryRb.Size = new System.Drawing.Size(104, 24);
this.badBookRetryRb.TabIndex = 16;
this.badBookRetryRb.TabStop = true;
this.badBookRetryRb.Text = "[retry desc]";
@ -179,9 +186,10 @@
// badBookAbortRb
//
this.badBookAbortRb.AutoSize = true;
this.badBookAbortRb.Location = new System.Drawing.Point(6, 47);
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(88, 19);
this.badBookAbortRb.Size = new System.Drawing.Size(110, 24);
this.badBookAbortRb.TabIndex = 15;
this.badBookAbortRb.TabStop = true;
this.badBookAbortRb.Text = "[abort desc]";
@ -190,9 +198,10 @@
// badBookAskRb
//
this.badBookAskRb.AutoSize = true;
this.badBookAskRb.Location = new System.Drawing.Point(6, 22);
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(77, 19);
this.badBookAskRb.Size = new System.Drawing.Size(95, 24);
this.badBookAskRb.TabIndex = 14;
this.badBookAskRb.TabStop = true;
this.badBookAskRb.Text = "[ask desc]";
@ -200,12 +209,15 @@
//
// 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(7, 72);
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.Size = new System.Drawing.Size(359, 124);
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";
@ -215,9 +227,10 @@
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.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(262, 19);
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;
@ -226,9 +239,10 @@
// convertLossyRb
//
this.convertLossyRb.AutoSize = true;
this.convertLossyRb.Location = new System.Drawing.Point(6, 81);
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(329, 19);
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;
@ -237,9 +251,10 @@
//
this.convertLosslessRb.AutoSize = true;
this.convertLosslessRb.Checked = true;
this.convertLosslessRb.Location = new System.Drawing.Point(6, 56);
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(335, 19);
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)";
@ -249,16 +264,18 @@
//
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.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(552, 52);
this.inProgressSelectControl.Size = new System.Drawing.Size(631, 69);
this.inProgressSelectControl.TabIndex = 19;
//
// logsBtn
//
this.logsBtn.Location = new System.Drawing.Point(262, 147);
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(132, 23);
this.logsBtn.Size = new System.Drawing.Size(151, 31);
this.logsBtn.TabIndex = 5;
this.logsBtn.Text = "Open log folder";
this.logsBtn.UseVisualStyleBackColor = true;
@ -268,9 +285,10 @@
//
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.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(895, 87);
this.booksSelectControl.Size = new System.Drawing.Size(1023, 116);
this.booksSelectControl.TabIndex = 2;
//
// booksGb
@ -279,9 +297,11 @@
| 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.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.Size = new System.Drawing.Size(908, 129);
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";
@ -289,9 +309,9 @@
// loggingLevelLbl
//
this.loggingLevelLbl.AutoSize = true;
this.loggingLevelLbl.Location = new System.Drawing.Point(12, 150);
this.loggingLevelLbl.Location = new System.Drawing.Point(14, 200);
this.loggingLevelLbl.Name = "loggingLevelLbl";
this.loggingLevelLbl.Size = new System.Drawing.Size(78, 15);
this.loggingLevelLbl.Size = new System.Drawing.Size(99, 20);
this.loggingLevelLbl.TabIndex = 3;
this.loggingLevelLbl.Text = "Logging level";
//
@ -299,18 +319,30 @@
//
this.loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.loggingLevelCb.FormattingEnabled = true;
this.loggingLevelCb.Location = new System.Drawing.Point(96, 147);
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(129, 23);
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(7F, 15F);
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(933, 539);
this.ClientSize = new System.Drawing.Size(1066, 719);
this.Controls.Add(this.logsBtn);
this.Controls.Add(this.loggingLevelCb);
this.Controls.Add(this.loggingLevelLbl);
@ -319,7 +351,7 @@
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.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.Name = "SettingsDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Settings";
@ -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;
}
}

View File

@ -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;