Add option for downloading cover

This commit is contained in:
Michael Bucari-Tovo 2022-05-10 15:36:31 -06:00
parent 9a5d9f3867
commit 64eaa157e5
5 changed files with 975 additions and 944 deletions

View File

@ -134,6 +134,9 @@ namespace AppScaffolding
if (!config.Exists(nameof(config.GridColumnsWidths))) if (!config.Exists(nameof(config.GridColumnsWidths)))
config.GridColumnsWidths = new Dictionary<string, int>(); config.GridColumnsWidths = new Dictionary<string, int>();
if (!config.Exists(nameof(config.DownloadCoverArt)))
config.DownloadCoverArt = true;
} }
/// <summary>Initialize logging. Run after migration</summary> /// <summary>Initialize logging. Run after migration</summary>

View File

@ -71,12 +71,13 @@ namespace FileLiberator
// moves new files from temp dir to final dest // moves new files from temp dir to final dest
var movedAudioFile = moveFilesToBooksDir(libraryBook, entries); var movedAudioFile = moveFilesToBooksDir(libraryBook, entries);
DownloadCoverArt(libraryBook);
// decrypt failed // decrypt failed
if (!movedAudioFile) if (!movedAudioFile)
return new StatusHandler { "Cannot find final audio file after decryption" }; return new StatusHandler { "Cannot find final audio file after decryption" };
if (Configuration.Instance.DownloadCoverArt)
DownloadCoverArt(libraryBook);
libraryBook.Book.UserDefinedItem.BookStatus = LiberatedStatus.Liberated; libraryBook.Book.UserDefinedItem.BookStatus = LiberatedStatus.Liberated;
return new StatusHandler(); return new StatusHandler();
@ -130,6 +131,7 @@ namespace FileLiberator
// REAL WORK DONE HERE // REAL WORK DONE HERE
var success = await Task.Run(abDownloader.Run); var success = await Task.Run(abDownloader.Run);
return success; return success;
} }
finally finally

View File

@ -201,6 +201,13 @@ namespace LibationFileManager
set => persistentDictionary.SetNonString(nameof(GridColumnsWidths), value); set => persistentDictionary.SetNonString(nameof(GridColumnsWidths), value);
} }
[Description("Save cover image alongside audiobook?")]
public bool DownloadCoverArt
{
get => persistentDictionary.GetNonString<bool>(nameof(DownloadCoverArt));
set => persistentDictionary.SetNonString(nameof(DownloadCoverArt), value);
}
public enum BadBookAction public enum BadBookAction
{ {
[Description("Ask each time what action to take.")] [Description("Ask each time what action to take.")]

View File

@ -53,6 +53,7 @@
this.tab1ImportantSettings = new System.Windows.Forms.TabPage(); this.tab1ImportantSettings = new System.Windows.Forms.TabPage();
this.booksGb = new System.Windows.Forms.GroupBox(); this.booksGb = new System.Windows.Forms.GroupBox();
this.tab2ImportLibrary = new System.Windows.Forms.TabPage(); this.tab2ImportLibrary = new System.Windows.Forms.TabPage();
this.autoScanCb = new System.Windows.Forms.CheckBox();
this.showImportedStatsCb = new System.Windows.Forms.CheckBox(); this.showImportedStatsCb = new System.Windows.Forms.CheckBox();
this.tab3DownloadDecrypt = new System.Windows.Forms.TabPage(); this.tab3DownloadDecrypt = new System.Windows.Forms.TabPage();
this.inProgressFilesGb = new System.Windows.Forms.GroupBox(); this.inProgressFilesGb = new System.Windows.Forms.GroupBox();
@ -100,7 +101,7 @@
this.stripUnabridgedCbox = new System.Windows.Forms.CheckBox(); this.stripUnabridgedCbox = new System.Windows.Forms.CheckBox();
this.retainAaxFileCbox = new System.Windows.Forms.CheckBox(); this.retainAaxFileCbox = new System.Windows.Forms.CheckBox();
this.createCueSheetCbox = new System.Windows.Forms.CheckBox(); this.createCueSheetCbox = new System.Windows.Forms.CheckBox();
this.autoScanCb = new System.Windows.Forms.CheckBox(); this.downloadCoverArtCbox = new System.Windows.Forms.CheckBox();
this.badBookGb.SuspendLayout(); this.badBookGb.SuspendLayout();
this.tabControl.SuspendLayout(); this.tabControl.SuspendLayout();
this.tab1ImportantSettings.SuspendLayout(); this.tab1ImportantSettings.SuspendLayout();
@ -243,7 +244,7 @@
// stripAudibleBrandingCbox // stripAudibleBrandingCbox
// //
this.stripAudibleBrandingCbox.AutoSize = true; this.stripAudibleBrandingCbox.AutoSize = true;
this.stripAudibleBrandingCbox.Location = new System.Drawing.Point(19, 143); this.stripAudibleBrandingCbox.Location = new System.Drawing.Point(19, 168);
this.stripAudibleBrandingCbox.Name = "stripAudibleBrandingCbox"; this.stripAudibleBrandingCbox.Name = "stripAudibleBrandingCbox";
this.stripAudibleBrandingCbox.Size = new System.Drawing.Size(143, 34); this.stripAudibleBrandingCbox.Size = new System.Drawing.Size(143, 34);
this.stripAudibleBrandingCbox.TabIndex = 13; this.stripAudibleBrandingCbox.TabIndex = 13;
@ -253,7 +254,7 @@
// splitFilesByChapterCbox // splitFilesByChapterCbox
// //
this.splitFilesByChapterCbox.AutoSize = true; this.splitFilesByChapterCbox.AutoSize = true;
this.splitFilesByChapterCbox.Location = new System.Drawing.Point(19, 93); this.splitFilesByChapterCbox.Location = new System.Drawing.Point(19, 118);
this.splitFilesByChapterCbox.Name = "splitFilesByChapterCbox"; this.splitFilesByChapterCbox.Name = "splitFilesByChapterCbox";
this.splitFilesByChapterCbox.Size = new System.Drawing.Size(162, 19); this.splitFilesByChapterCbox.Size = new System.Drawing.Size(162, 19);
this.splitFilesByChapterCbox.TabIndex = 13; this.splitFilesByChapterCbox.TabIndex = 13;
@ -276,7 +277,7 @@
// convertLossyRb // convertLossyRb
// //
this.convertLossyRb.AutoSize = true; this.convertLossyRb.AutoSize = true;
this.convertLossyRb.Location = new System.Drawing.Point(19, 207); this.convertLossyRb.Location = new System.Drawing.Point(19, 232);
this.convertLossyRb.Name = "convertLossyRb"; this.convertLossyRb.Name = "convertLossyRb";
this.convertLossyRb.Size = new System.Drawing.Size(329, 19); this.convertLossyRb.Size = new System.Drawing.Size(329, 19);
this.convertLossyRb.TabIndex = 12; this.convertLossyRb.TabIndex = 12;
@ -288,7 +289,7 @@
// //
this.convertLosslessRb.AutoSize = true; this.convertLosslessRb.AutoSize = true;
this.convertLosslessRb.Checked = true; this.convertLosslessRb.Checked = true;
this.convertLosslessRb.Location = new System.Drawing.Point(19, 182); this.convertLosslessRb.Location = new System.Drawing.Point(19, 207);
this.convertLosslessRb.Name = "convertLosslessRb"; this.convertLosslessRb.Name = "convertLosslessRb";
this.convertLosslessRb.Size = new System.Drawing.Size(335, 19); this.convertLosslessRb.Size = new System.Drawing.Size(335, 19);
this.convertLosslessRb.TabIndex = 11; this.convertLosslessRb.TabIndex = 11;
@ -401,6 +402,16 @@
this.tab2ImportLibrary.Text = "Import library"; this.tab2ImportLibrary.Text = "Import library";
this.tab2ImportLibrary.UseVisualStyleBackColor = true; this.tab2ImportLibrary.UseVisualStyleBackColor = true;
// //
// autoScanCb
//
this.autoScanCb.AutoSize = true;
this.autoScanCb.Location = new System.Drawing.Point(6, 6);
this.autoScanCb.Name = "autoScanCb";
this.autoScanCb.Size = new System.Drawing.Size(112, 19);
this.autoScanCb.TabIndex = 1;
this.autoScanCb.Text = "[auto scan desc]";
this.autoScanCb.UseVisualStyleBackColor = true;
//
// showImportedStatsCb // showImportedStatsCb
// //
this.showImportedStatsCb.AutoSize = true; this.showImportedStatsCb.AutoSize = true;
@ -556,6 +567,7 @@
this.tab4AudioFileOptions.Controls.Add(this.stripUnabridgedCbox); this.tab4AudioFileOptions.Controls.Add(this.stripUnabridgedCbox);
this.tab4AudioFileOptions.Controls.Add(this.splitFilesByChapterCbox); this.tab4AudioFileOptions.Controls.Add(this.splitFilesByChapterCbox);
this.tab4AudioFileOptions.Controls.Add(this.retainAaxFileCbox); this.tab4AudioFileOptions.Controls.Add(this.retainAaxFileCbox);
this.tab4AudioFileOptions.Controls.Add(this.downloadCoverArtCbox);
this.tab4AudioFileOptions.Controls.Add(this.createCueSheetCbox); this.tab4AudioFileOptions.Controls.Add(this.createCueSheetCbox);
this.tab4AudioFileOptions.Controls.Add(this.allowLibationFixupCbox); this.tab4AudioFileOptions.Controls.Add(this.allowLibationFixupCbox);
this.tab4AudioFileOptions.Location = new System.Drawing.Point(4, 24); this.tab4AudioFileOptions.Location = new System.Drawing.Point(4, 24);
@ -893,7 +905,7 @@
// stripUnabridgedCbox // stripUnabridgedCbox
// //
this.stripUnabridgedCbox.AutoSize = true; this.stripUnabridgedCbox.AutoSize = true;
this.stripUnabridgedCbox.Location = new System.Drawing.Point(19, 118); this.stripUnabridgedCbox.Location = new System.Drawing.Point(19, 143);
this.stripUnabridgedCbox.Name = "stripUnabridgedCbox"; this.stripUnabridgedCbox.Name = "stripUnabridgedCbox";
this.stripUnabridgedCbox.Size = new System.Drawing.Size(147, 19); this.stripUnabridgedCbox.Size = new System.Drawing.Size(147, 19);
this.stripUnabridgedCbox.TabIndex = 13; this.stripUnabridgedCbox.TabIndex = 13;
@ -903,7 +915,7 @@
// retainAaxFileCbox // retainAaxFileCbox
// //
this.retainAaxFileCbox.AutoSize = true; this.retainAaxFileCbox.AutoSize = true;
this.retainAaxFileCbox.Location = new System.Drawing.Point(19, 68); this.retainAaxFileCbox.Location = new System.Drawing.Point(19, 93);
this.retainAaxFileCbox.Name = "retainAaxFileCbox"; this.retainAaxFileCbox.Name = "retainAaxFileCbox";
this.retainAaxFileCbox.Size = new System.Drawing.Size(132, 19); this.retainAaxFileCbox.Size = new System.Drawing.Size(132, 19);
this.retainAaxFileCbox.TabIndex = 10; this.retainAaxFileCbox.TabIndex = 10;
@ -924,15 +936,18 @@
this.createCueSheetCbox.UseVisualStyleBackColor = true; this.createCueSheetCbox.UseVisualStyleBackColor = true;
this.createCueSheetCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged); this.createCueSheetCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged);
// //
// autoScanCb // downloadCoverArtCbox
// //
this.autoScanCb.AutoSize = true; this.downloadCoverArtCbox.AutoSize = true;
this.autoScanCb.Location = new System.Drawing.Point(6, 6); this.downloadCoverArtCbox.Checked = true;
this.autoScanCb.Name = "autoScanCb"; this.downloadCoverArtCbox.CheckState = System.Windows.Forms.CheckState.Checked;
this.autoScanCb.Size = new System.Drawing.Size(112, 19); this.downloadCoverArtCbox.Location = new System.Drawing.Point(19, 68);
this.autoScanCb.TabIndex = 1; this.downloadCoverArtCbox.Name = "downloadCoverArtCbox";
this.autoScanCb.Text = "[auto scan desc]"; this.downloadCoverArtCbox.Size = new System.Drawing.Size(162, 19);
this.autoScanCb.UseVisualStyleBackColor = true; this.downloadCoverArtCbox.TabIndex = 10;
this.downloadCoverArtCbox.Text = "[DownloadCoverArt desc]";
this.downloadCoverArtCbox.UseVisualStyleBackColor = true;
this.downloadCoverArtCbox.CheckedChanged += new System.EventHandler(this.allowLibationFixupCbox_CheckedChanged);
// //
// SettingsDialog // SettingsDialog
// //
@ -1056,5 +1071,6 @@
private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label16;
private System.Windows.Forms.CheckBox createCueSheetCbox; private System.Windows.Forms.CheckBox createCueSheetCbox;
private System.Windows.Forms.CheckBox autoScanCb; private System.Windows.Forms.CheckBox autoScanCb;
private System.Windows.Forms.CheckBox downloadCoverArtCbox;
} }
} }

View File

@ -44,6 +44,7 @@ namespace LibationWinForms.Dialogs
this.retainAaxFileCbox.Text = desc(nameof(config.RetainAaxFile)); this.retainAaxFileCbox.Text = desc(nameof(config.RetainAaxFile));
this.stripUnabridgedCbox.Text = desc(nameof(config.StripUnabridged)); this.stripUnabridgedCbox.Text = desc(nameof(config.StripUnabridged));
this.createCueSheetCbox.Text = desc(nameof(config.CreateCueSheet)); this.createCueSheetCbox.Text = desc(nameof(config.CreateCueSheet));
this.downloadCoverArtCbox.Text = desc(nameof(config.DownloadCoverArt));
booksSelectControl.SetSearchTitle("books location"); booksSelectControl.SetSearchTitle("books location");
booksSelectControl.SetDirectoryItems( booksSelectControl.SetDirectoryItems(
@ -73,6 +74,7 @@ namespace LibationWinForms.Dialogs
lameConstantBitrateCbox.Checked = config.LameConstantBitrate; lameConstantBitrateCbox.Checked = config.LameConstantBitrate;
LameMatchSourceBRCbox.Checked = config.LameMatchSourceBR; LameMatchSourceBRCbox.Checked = config.LameMatchSourceBR;
lameVBRQualityTb.Value = config.LameVBRQuality; lameVBRQualityTb.Value = config.LameVBRQuality;
downloadCoverArtCbox.Checked = config.DownloadCoverArt;
autoScanCb.Checked = config.AutoScan; autoScanCb.Checked = config.AutoScan;
showImportedStatsCb.Checked = config.ShowImportedStats; showImportedStatsCb.Checked = config.ShowImportedStats;
@ -196,6 +198,7 @@ namespace LibationWinForms.Dialogs
config.LameConstantBitrate = lameConstantBitrateCbox.Checked; config.LameConstantBitrate = lameConstantBitrateCbox.Checked;
config.LameMatchSourceBR = LameMatchSourceBRCbox.Checked; config.LameMatchSourceBR = LameMatchSourceBRCbox.Checked;
config.LameVBRQuality = lameVBRQualityTb.Value; config.LameVBRQuality = lameVBRQualityTb.Value;
config.DownloadCoverArt = downloadCoverArtCbox.Checked;
config.AutoScan = autoScanCb.Checked; config.AutoScan = autoScanCb.Checked;
config.ShowImportedStats = showImportedStatsCb.Checked; config.ShowImportedStats = showImportedStatsCb.Checked;