Add new settings and settings dialog help tips

Add CombineNestedChapterTitles setting (#663)
Add SaveMetadataToFile setting
Add extended setting descriptions for select options
This commit is contained in:
Mbucari 2023-07-09 16:07:13 -06:00
parent 296c2b43eb
commit 4899ef3007
12 changed files with 195 additions and 49 deletions

View File

@ -127,6 +127,8 @@ namespace AaxDecrypter
{
ArgumentValidator.EnsureNotNullOrWhiteSpace(uriToSameFile?.AbsoluteUri, nameof(uriToSameFile));
if (Path.GetFileName(uriToSameFile.LocalPath) != Path.GetFileName(Uri.LocalPath))
throw new ArgumentException($"New uri to the same file must have the same file name.");
if (uriToSameFile.Host != Uri.Host)
throw new ArgumentException($"New uri to the same file must have the same host.\r\n Old Host :{Uri.Host}\r\nNew Host: {uriToSameFile.Host}");
if (DownloadTask is not null)

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks;
using AaxDecrypter;
using ApplicationServices;
using AudibleApi.Common;
using DataLayer;
using Dinah.Core;
using Dinah.Core.ErrorHandling;
@ -124,12 +125,12 @@ namespace FileLiberator
var quality = (AudibleApi.DownloadQuality)config.FileDownloadQuality;
var api = await libraryBook.GetApiAsync();
var contentLic = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId, quality);
using var dlOptions = BuildDownloadOptions(libraryBook, config, contentLic);
using var dlOptions = BuildDownloadOptions(libraryBook, config, contentLic);
var outFileName = AudibleFileStorage.Audio.GetInProgressFilename(libraryBook, dlOptions.OutputFormat.ToString().ToLower());
var cacheDir = AudibleFileStorage.DownloadsInProgressDirectory;
if (contentLic.DrmType != AudibleApi.Common.DrmType.Adrm)
if (contentLic.DrmType != DrmType.Adrm)
abDownloader = new UnencryptedAudiobookDownloader(outFileName, cacheDir, dlOptions);
else
{
@ -152,16 +153,34 @@ namespace FileLiberator
abDownloader.RetrievedCoverArt += AaxcDownloader_RetrievedCoverArt;
abDownloader.FileCreated += (_, path) => OnFileCreated(libraryBook, path);
// REAL WORK DONE HERE
return await abDownloader.RunAsync();
// REAL WORK DONE HERE
var success = await abDownloader.RunAsync();
if (success && config.SaveMetadataToFile)
{
var metadataFile = Templates.File.GetFilename(dlOptions.LibraryBookDto, Path.GetDirectoryName(outFileName), ".metadata.json");
saveMetadata(libraryBook, contentLic.ContentMetadata, metadataFile);
}
return success;
}
private DownloadOptions BuildDownloadOptions(LibraryBook libraryBook, Configuration config, AudibleApi.Common.ContentLicense contentLic)
private void saveMetadata(LibraryBook libraryBook, ContentMetadata contentMetadata, string fileName)
{
var export = Newtonsoft.Json.Linq.JObject.FromObject(LibToDtos.ToDtos(new[] { libraryBook })[0]);
export.Add(nameof(contentMetadata.ChapterInfo), Newtonsoft.Json.Linq.JObject.FromObject(contentMetadata.ChapterInfo));
export.Add(nameof(contentMetadata.ContentReference), Newtonsoft.Json.Linq.JObject.FromObject(contentMetadata.ContentReference));
File.WriteAllText(fileName, export.ToString());
OnFileCreated(libraryBook, fileName);
}
private DownloadOptions BuildDownloadOptions(LibraryBook libraryBook, Configuration config, ContentLicense contentLic)
{
//If DrmType != Adrm the delivered file is an unencrypted mp3.
var outputFormat
= contentLic.DrmType != AudibleApi.Common.DrmType.Adrm || (config.AllowLibationFixup && config.DecryptToLossy)
= contentLic.DrmType != DrmType.Adrm || (config.AllowLibationFixup && config.DecryptToLossy)
? OutputFormat.Mp3
: OutputFormat.M4b;
@ -183,7 +202,11 @@ namespace FileLiberator
RuntimeLength = TimeSpan.FromMilliseconds(contentLic?.ContentMetadata?.ChapterInfo?.RuntimeLengthMs ?? 0),
};
var chapters = flattenChapters(contentLic.ContentMetadata.ChapterInfo.Chapters).OrderBy(c => c.StartOffsetMs).ToList();
var titleConcat = config.CombineNestedChapterTitles ? ": " : null;
var chapters
= flattenChapters(contentLic.ContentMetadata.ChapterInfo.Chapters, titleConcat)
.OrderBy(c => c.StartOffsetMs)
.ToList();
if (config.MergeOpeningAndEndCredits)
combineCredits(chapters);
@ -280,14 +303,19 @@ namespace FileLiberator
*/
public static List<AudibleApi.Common.Chapter> flattenChapters(IList<AudibleApi.Common.Chapter> chapters, string titleConcat = ": ")
public static List<Chapter> flattenChapters(IList<Chapter> chapters, string titleConcat = ": ")
{
List<AudibleApi.Common.Chapter> chaps = new();
List<Chapter> chaps = new();
foreach (var c in chapters)
{
if (c.Chapters is null)
chaps.Add(c);
else if (titleConcat is null)
{
chaps.Add(c);
chaps.AddRange(flattenChapters(c.Chapters));
}
else
{
if (c.LengthMs < 10000)
@ -305,13 +333,12 @@ namespace FileLiberator
child.Title = $"{c.Title}{titleConcat}{child.Title}";
chaps.AddRange(children);
c.Chapters = null;
}
}
return chaps;
}
public static void combineCredits(IList<AudibleApi.Common.Chapter> chapters)
public static void combineCredits(IList<Chapter> chapters)
{
if (chapters.Count > 1 && chapters[0].Title == "Opening Credits")
{

View File

@ -73,7 +73,15 @@
<TextBlock Text="{CompiledBinding MergeOpeningEndCreditsText}" />
</CheckBox>
<CheckBox IsChecked="{CompiledBinding AllowLibationFixup, Mode=TwoWay}">
<CheckBox
ToolTip.Tip="{CompiledBinding CombineNestedChapterTitlesTip}"
IsChecked="{CompiledBinding CombineNestedChapterTitles, Mode=TwoWay}">
<TextBlock Text="{CompiledBinding CombineNestedChapterTitlesText}" />
</CheckBox>
<CheckBox
ToolTip.Tip="{CompiledBinding AllowLibationFixupTip}"
IsChecked="{CompiledBinding AllowLibationFixup, Mode=TwoWay}">
<TextBlock Text="{CompiledBinding AllowLibationFixupText}" />
</CheckBox>
</StackPanel>

View File

@ -165,18 +165,32 @@
</StackPanel>
</controls:GroupBox>
<CheckBox
<StackPanel
Grid.Row="3"
Margin="5"
VerticalAlignment="Top"
IsVisible="{CompiledBinding !Config.IsLinux}"
IsChecked="{CompiledBinding UseCoverAsFolderIcon, Mode=TwoWay}">
Orientation="Horizontal">
<TextBlock
TextWrapping="Wrap"
Text="{CompiledBinding UseCoverAsFolderIconText}" />
<CheckBox
Margin="5"
VerticalAlignment="Top"
IsVisible="{CompiledBinding !Config.IsLinux}"
IsChecked="{CompiledBinding UseCoverAsFolderIcon, Mode=TwoWay}">
</CheckBox>
<TextBlock
TextWrapping="Wrap"
Text="{CompiledBinding UseCoverAsFolderIconText}" />
</CheckBox>
<CheckBox
Margin="5"
VerticalAlignment="Top"
IsChecked="{CompiledBinding SaveMetadataToFile, Mode=TwoWay}">
<TextBlock
TextWrapping="Wrap"
Text="{CompiledBinding SaveMetadataToFileText}" />
</CheckBox>
</StackPanel>
</Grid>
</UserControl>

View File

@ -44,6 +44,7 @@ namespace LibationAvalonia.ViewModels.Settings
public void LoadSettings(Configuration config)
{
CreateCueSheet = config.CreateCueSheet;
CombineNestedChapterTitles = config.CombineNestedChapterTitles;
AllowLibationFixup = config.AllowLibationFixup;
DownloadCoverArt = config.DownloadCoverArt;
RetainAaxFile = config.RetainAaxFile;
@ -71,6 +72,7 @@ namespace LibationAvalonia.ViewModels.Settings
public void SaveSettings(Configuration config)
{
config.CreateCueSheet = CreateCueSheet;
config.CombineNestedChapterTitles = CombineNestedChapterTitles;
config.AllowLibationFixup = AllowLibationFixup;
config.DownloadCoverArt = DownloadCoverArt;
config.RetainAaxFile = RetainAaxFile;
@ -99,7 +101,10 @@ namespace LibationAvalonia.ViewModels.Settings
public AvaloniaList<Configuration.ClipBookmarkFormat> ClipBookmarkFormats { get; } = new(Enum<Configuration.ClipBookmarkFormat>.GetValues());
public string FileDownloadQualityText { get; } = Configuration.GetDescription(nameof(Configuration.FileDownloadQuality));
public string CreateCueSheetText { get; } = Configuration.GetDescription(nameof(Configuration.CreateCueSheet));
public string CombineNestedChapterTitlesText { get; } = Configuration.GetDescription(nameof(Configuration.CombineNestedChapterTitles));
public string CombineNestedChapterTitlesTip => Configuration.GetHelpText(nameof(CombineNestedChapterTitles));
public string AllowLibationFixupText { get; } = Configuration.GetDescription(nameof(Configuration.AllowLibationFixup));
public string AllowLibationFixupTip => Configuration.GetHelpText(nameof(AllowLibationFixup));
public string DownloadCoverArtText { get; } = Configuration.GetDescription(nameof(Configuration.DownloadCoverArt));
public string RetainAaxFileText { get; } = Configuration.GetDescription(nameof(Configuration.RetainAaxFile));
public string SplitFilesByChapterText { get; } = Configuration.GetDescription(nameof(Configuration.SplitFilesByChapter));
@ -110,6 +115,7 @@ namespace LibationAvalonia.ViewModels.Settings
public string MoveMoovToBeginningText { get; } = Configuration.GetDescription(nameof(Configuration.MoveMoovToBeginning));
public bool CreateCueSheet { get; set; }
public bool CombineNestedChapterTitles { get; set; }
public bool DownloadCoverArt { get; set; }
public bool RetainAaxFile { get; set; }
public bool DownloadClipsBookmarks { get => _downloadClipsBookmarks; set => this.RaiseAndSetIfChanged(ref _downloadClipsBookmarks, value); }

View File

@ -38,6 +38,7 @@ namespace LibationAvalonia.ViewModels.Settings
ChapterFileTemplate = config.ChapterFileTemplate;
InProgressDirectory = config.InProgress;
UseCoverAsFolderIcon = config.UseCoverAsFolderIcon;
SaveMetadataToFile = config.SaveMetadataToFile;
}
public void SaveSettings(Configuration config)
@ -54,9 +55,11 @@ namespace LibationAvalonia.ViewModels.Settings
config.InProgress = InProgressDirectory;
config.UseCoverAsFolderIcon = UseCoverAsFolderIcon;
config.SaveMetadataToFile = SaveMetadataToFile;
}
public string UseCoverAsFolderIconText { get; } = Configuration.GetDescription(nameof(Configuration.UseCoverAsFolderIcon));
public string SaveMetadataToFileText { get; } = Configuration.GetDescription(nameof(Configuration.SaveMetadataToFile));
public string BadBookGroupboxText { get; } = Configuration.GetDescription(nameof(Configuration.BadBook));
public string BadBookAskText { get; } = Configuration.BadBookAction.Ask.GetDescription();
public string BadBookAbortText { get; } = Configuration.BadBookAction.Abort.GetDescription();
@ -72,6 +75,7 @@ namespace LibationAvalonia.ViewModels.Settings
public string FileTemplate { get => _fileTemplate; set { this.RaiseAndSetIfChanged(ref _fileTemplate, value); } }
public string ChapterFileTemplate { get => _chapterFileTemplate; set { this.RaiseAndSetIfChanged(ref _chapterFileTemplate, value); } }
public bool UseCoverAsFolderIcon { get; set; }
public bool SaveMetadataToFile { get; set; }
public bool BadBookAsk { get; set; }
public bool BadBookAbort { get; set; }

View File

@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace LibationFileManager
{
public partial class Configuration
{
public static ReadOnlyDictionary<string, string> HelpText { get; } = new Dictionary<string, string>
{
{ nameof(CombineNestedChapterTitles),"""
If the book has nested chapters, e.g. a chapter named "Part 1"
that contains chapters "Chapter 1" and "Chapter 2", then combine
the chapter titles like the following example:
Part 1: Chapter 1
Part 1: Chapter 2
"""},
{nameof(AllowLibationFixup), """
In addition to the options that are enabled if you allow
"fixing up" the audiobook, it does the following:
* Sets the ©gen metadata tag for the genres.
* Adds the TCOM (@wrt in M4B files) metadata tag for the narrators.
* Unescapes the copyright symbol (replace &#169; with ©)
* Replaces the recording copyright (P) string with
* Adds various other metadata tags recognized by AudiobookShelf
* Sets the embedded cover art image with cover art retrieved from Audible
""" },
}
.AsReadOnly();
public static string GetHelpText(string settingName)
=> HelpText.TryGetValue(settingName, out var value) ? value : null;
}
}

View File

@ -73,9 +73,12 @@ namespace LibationFileManager
public bool Exists(string propertyName) => persistentDictionary.Exists(propertyName);
[Description("Set cover art as the folder's icon. (Windows and macOS only)")]
[Description("Set cover art as the folder's icon.")]
public bool UseCoverAsFolderIcon { get => GetNonString(defaultValue: false); set => SetNonString(value); }
[Description("Save audiobook metadata to metadata.json")]
public bool SaveMetadataToFile { get => GetNonString(defaultValue: false); set => SetNonString(value); }
[Description("Use the beta version of Libation\r\nNew and experimental features, but probably buggy.\r\n(requires restart to take effect)")]
public bool BetaOptIn { get => GetNonString(defaultValue: false); set => SetNonString(value); }
@ -164,6 +167,9 @@ namespace LibationFileManager
[Description("Save cover image alongside audiobook?")]
public bool DownloadCoverArt { get => GetNonString(defaultValue: false); set => SetNonString(value); }
[Description("Combine nested chapter titles")]
public bool CombineNestedChapterTitles { get => GetNonString(defaultValue: false); set => SetNonString(value); }
[Description("Download clips and bookmarks?")]
public bool DownloadClipsBookmarks { get => GetNonString(defaultValue: false); set => SetNonString(value); }

View File

@ -14,12 +14,16 @@ namespace LibationWinForms.Dialogs
this.createCueSheetCbox.Text = desc(nameof(config.CreateCueSheet));
this.downloadCoverArtCbox.Text = desc(nameof(config.DownloadCoverArt));
this.retainAaxFileCbox.Text = desc(nameof(config.RetainAaxFile));
this.combineNestedChapterTitlesCbox.Text = desc(nameof(config.CombineNestedChapterTitles));
this.splitFilesByChapterCbox.Text = desc(nameof(config.SplitFilesByChapter));
this.mergeOpeningEndCreditsCbox.Text = desc(nameof(config.MergeOpeningAndEndCredits));
this.stripAudibleBrandingCbox.Text = desc(nameof(config.StripAudibleBrandAudio));
this.stripUnabridgedCbox.Text = desc(nameof(config.StripUnabridged));
this.moveMoovAtomCbox.Text = desc(nameof(config.MoveMoovToBeginning));
toolTip.SetToolTip(combineNestedChapterTitlesCbox, Configuration.GetHelpText(nameof(config.CombineNestedChapterTitles)));
toolTip.SetToolTip(allowLibationFixupCbox, Configuration.GetHelpText(nameof(config.AllowLibationFixup)));
fileDownloadQualityCb.Items.AddRange(
new object[]
{
@ -55,6 +59,7 @@ namespace LibationWinForms.Dialogs
fileDownloadQualityCb.SelectedItem = config.FileDownloadQuality;
clipsBookmarksFormatCb.SelectedItem = config.ClipsBookmarksFileFormat;
retainAaxFileCbox.Checked = config.RetainAaxFile;
combineNestedChapterTitlesCbox.Checked = config.CombineNestedChapterTitles;
splitFilesByChapterCbox.Checked = config.SplitFilesByChapter;
mergeOpeningEndCreditsCbox.Checked = config.MergeOpeningAndEndCredits;
stripUnabridgedCbox.Checked = config.StripUnabridged;
@ -99,6 +104,7 @@ namespace LibationWinForms.Dialogs
config.FileDownloadQuality = (Configuration.DownloadQuality)fileDownloadQualityCb.SelectedItem;
config.ClipsBookmarksFileFormat = (Configuration.ClipBookmarkFormat)clipsBookmarksFormatCb.SelectedItem;
config.RetainAaxFile = retainAaxFileCbox.Checked;
config.CombineNestedChapterTitles = combineNestedChapterTitlesCbox.Checked;
config.SplitFilesByChapter = splitFilesByChapterCbox.Checked;
config.MergeOpeningAndEndCredits = mergeOpeningEndCreditsCbox.Checked;
config.StripUnabridged = stripUnabridgedCbox.Checked;

View File

@ -80,6 +80,7 @@
tab4AudioFileOptions = new System.Windows.Forms.TabPage();
fileDownloadQualityCb = new System.Windows.Forms.ComboBox();
fileDownloadQualityLbl = new System.Windows.Forms.Label();
combineNestedChapterTitlesCbox = new System.Windows.Forms.CheckBox();
clipsBookmarksFormatCb = new System.Windows.Forms.ComboBox();
downloadClipsBookmarksCbox = new System.Windows.Forms.CheckBox();
audiobookFixupsGb = new System.Windows.Forms.GroupBox();
@ -126,6 +127,7 @@
retainAaxFileCbox = new System.Windows.Forms.CheckBox();
downloadCoverArtCbox = new System.Windows.Forms.CheckBox();
createCueSheetCbox = new System.Windows.Forms.CheckBox();
saveMetadataToFileCbox = new System.Windows.Forms.CheckBox();
badBookGb.SuspendLayout();
tabControl.SuspendLayout();
tab1ImportantSettings.SuspendLayout();
@ -168,7 +170,7 @@
// saveBtn
//
saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
saveBtn.Location = new System.Drawing.Point(1334, 982);
saveBtn.Location = new System.Drawing.Point(1337, 998);
saveBtn.Margin = new System.Windows.Forms.Padding(8, 6, 8, 6);
saveBtn.Name = "saveBtn";
saveBtn.Size = new System.Drawing.Size(176, 54);
@ -181,7 +183,7 @@
//
cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
cancelBtn.Location = new System.Drawing.Point(1570, 982);
cancelBtn.Location = new System.Drawing.Point(1573, 998);
cancelBtn.Margin = new System.Windows.Forms.Padding(8, 6, 8, 6);
cancelBtn.Name = "cancelBtn";
cancelBtn.Size = new System.Drawing.Size(176, 54);
@ -223,7 +225,7 @@
badBookGb.Margin = new System.Windows.Forms.Padding(6);
badBookGb.Name = "badBookGb";
badBookGb.Padding = new System.Windows.Forms.Padding(6);
badBookGb.Size = new System.Drawing.Size(1668, 152);
badBookGb.Size = new System.Drawing.Size(1671, 152);
badBookGb.TabIndex = 13;
badBookGb.TabStop = false;
badBookGb.Text = "[bad book desc]";
@ -304,7 +306,7 @@
allowLibationFixupCbox.AutoSize = true;
allowLibationFixupCbox.Checked = true;
allowLibationFixupCbox.CheckState = System.Windows.Forms.CheckState.Checked;
allowLibationFixupCbox.Location = new System.Drawing.Point(38, 316);
allowLibationFixupCbox.Location = new System.Drawing.Point(38, 362);
allowLibationFixupCbox.Margin = new System.Windows.Forms.Padding(6);
allowLibationFixupCbox.Name = "allowLibationFixupCbox";
allowLibationFixupCbox.Size = new System.Drawing.Size(315, 36);
@ -316,7 +318,7 @@
// convertLossyRb
//
convertLossyRb.AutoSize = true;
convertLossyRb.Location = new System.Drawing.Point(26, 316);
convertLossyRb.Location = new System.Drawing.Point(26, 318);
convertLossyRb.Margin = new System.Windows.Forms.Padding(6);
convertLossyRb.Name = "convertLossyRb";
convertLossyRb.Size = new System.Drawing.Size(659, 36);
@ -329,7 +331,7 @@
//
convertLosslessRb.AutoSize = true;
convertLosslessRb.Checked = true;
convertLosslessRb.Location = new System.Drawing.Point(26, 222);
convertLosslessRb.Location = new System.Drawing.Point(26, 224);
convertLosslessRb.Margin = new System.Windows.Forms.Padding(6);
convertLosslessRb.Name = "convertLosslessRb";
convertLosslessRb.Size = new System.Drawing.Size(670, 36);
@ -346,7 +348,7 @@
inProgressSelectControl.Location = new System.Drawing.Point(14, 136);
inProgressSelectControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8);
inProgressSelectControl.Name = "inProgressSelectControl";
inProgressSelectControl.Size = new System.Drawing.Size(1656, 103);
inProgressSelectControl.Size = new System.Drawing.Size(1659, 103);
inProgressSelectControl.TabIndex = 19;
//
// logsBtn
@ -366,7 +368,7 @@
booksSelectControl.Location = new System.Drawing.Point(14, 46);
booksSelectControl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8);
booksSelectControl.Name = "booksSelectControl";
booksSelectControl.Size = new System.Drawing.Size(1658, 204);
booksSelectControl.Size = new System.Drawing.Size(1661, 204);
booksSelectControl.TabIndex = 2;
//
// loggingLevelLbl
@ -400,7 +402,7 @@
tabControl.Margin = new System.Windows.Forms.Padding(6);
tabControl.Name = "tabControl";
tabControl.SelectedIndex = 0;
tabControl.Size = new System.Drawing.Size(1724, 946);
tabControl.Size = new System.Drawing.Size(1727, 962);
tabControl.TabIndex = 100;
//
// tab1ImportantSettings
@ -414,7 +416,7 @@
tab1ImportantSettings.Margin = new System.Windows.Forms.Padding(6);
tab1ImportantSettings.Name = "tab1ImportantSettings";
tab1ImportantSettings.Padding = new System.Windows.Forms.Padding(6);
tab1ImportantSettings.Size = new System.Drawing.Size(1708, 892);
tab1ImportantSettings.Size = new System.Drawing.Size(1711, 908);
tab1ImportantSettings.TabIndex = 0;
tab1ImportantSettings.Text = "Important settings";
tab1ImportantSettings.UseVisualStyleBackColor = true;
@ -424,7 +426,7 @@
betaOptInCbox.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
betaOptInCbox.AutoSize = true;
betaOptInCbox.Enabled = false;
betaOptInCbox.Location = new System.Drawing.Point(26, 828);
betaOptInCbox.Location = new System.Drawing.Point(26, 844);
betaOptInCbox.Margin = new System.Windows.Forms.Padding(6);
betaOptInCbox.Name = "betaOptInCbox";
betaOptInCbox.Size = new System.Drawing.Size(210, 36);
@ -447,7 +449,7 @@
booksGb.Margin = new System.Windows.Forms.Padding(6);
booksGb.Name = "booksGb";
booksGb.Padding = new System.Windows.Forms.Padding(6);
booksGb.Size = new System.Drawing.Size(1684, 498);
booksGb.Size = new System.Drawing.Size(1687, 498);
booksGb.TabIndex = 0;
booksGb.TabStop = false;
booksGb.Text = "Books location";
@ -525,7 +527,7 @@
tab2ImportLibrary.Margin = new System.Windows.Forms.Padding(6);
tab2ImportLibrary.Name = "tab2ImportLibrary";
tab2ImportLibrary.Padding = new System.Windows.Forms.Padding(6);
tab2ImportLibrary.Size = new System.Drawing.Size(1708, 892);
tab2ImportLibrary.Size = new System.Drawing.Size(1711, 908);
tab2ImportLibrary.TabIndex = 1;
tab2ImportLibrary.Text = "Import library";
tab2ImportLibrary.UseVisualStyleBackColor = true;
@ -565,6 +567,7 @@
//
// tab3DownloadDecrypt
//
tab3DownloadDecrypt.Controls.Add(saveMetadataToFileCbox);
tab3DownloadDecrypt.Controls.Add(useCoverAsFolderIconCb);
tab3DownloadDecrypt.Controls.Add(inProgressFilesGb);
tab3DownloadDecrypt.Controls.Add(customFileNamingGb);
@ -573,7 +576,7 @@
tab3DownloadDecrypt.Margin = new System.Windows.Forms.Padding(6);
tab3DownloadDecrypt.Name = "tab3DownloadDecrypt";
tab3DownloadDecrypt.Padding = new System.Windows.Forms.Padding(6);
tab3DownloadDecrypt.Size = new System.Drawing.Size(1708, 892);
tab3DownloadDecrypt.Size = new System.Drawing.Size(1711, 908);
tab3DownloadDecrypt.TabIndex = 2;
tab3DownloadDecrypt.Text = "Download/Decrypt";
tab3DownloadDecrypt.UseVisualStyleBackColor = true;
@ -598,7 +601,7 @@
inProgressFilesGb.Margin = new System.Windows.Forms.Padding(6);
inProgressFilesGb.Name = "inProgressFilesGb";
inProgressFilesGb.Padding = new System.Windows.Forms.Padding(6);
inProgressFilesGb.Size = new System.Drawing.Size(1682, 256);
inProgressFilesGb.Size = new System.Drawing.Size(1685, 256);
inProgressFilesGb.TabIndex = 21;
inProgressFilesGb.TabStop = false;
inProgressFilesGb.Text = "In progress files";
@ -620,7 +623,7 @@
customFileNamingGb.Margin = new System.Windows.Forms.Padding(6);
customFileNamingGb.Name = "customFileNamingGb";
customFileNamingGb.Padding = new System.Windows.Forms.Padding(6);
customFileNamingGb.Size = new System.Drawing.Size(1682, 374);
customFileNamingGb.Size = new System.Drawing.Size(1685, 374);
customFileNamingGb.TabIndex = 20;
customFileNamingGb.TabStop = false;
customFileNamingGb.Text = "Custom file naming";
@ -640,7 +643,7 @@
// chapterFileTemplateBtn
//
chapterFileTemplateBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
chapterFileTemplateBtn.Location = new System.Drawing.Point(1522, 248);
chapterFileTemplateBtn.Location = new System.Drawing.Point(1525, 248);
chapterFileTemplateBtn.Margin = new System.Windows.Forms.Padding(6);
chapterFileTemplateBtn.Name = "chapterFileTemplateBtn";
chapterFileTemplateBtn.Size = new System.Drawing.Size(150, 46);
@ -656,7 +659,7 @@
chapterFileTemplateTb.Margin = new System.Windows.Forms.Padding(6);
chapterFileTemplateTb.Name = "chapterFileTemplateTb";
chapterFileTemplateTb.ReadOnly = true;
chapterFileTemplateTb.Size = new System.Drawing.Size(1494, 39);
chapterFileTemplateTb.Size = new System.Drawing.Size(1497, 39);
chapterFileTemplateTb.TabIndex = 7;
//
// chapterFileTemplateLbl
@ -672,7 +675,7 @@
// fileTemplateBtn
//
fileTemplateBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
fileTemplateBtn.Location = new System.Drawing.Point(1522, 160);
fileTemplateBtn.Location = new System.Drawing.Point(1525, 160);
fileTemplateBtn.Margin = new System.Windows.Forms.Padding(6);
fileTemplateBtn.Name = "fileTemplateBtn";
fileTemplateBtn.Size = new System.Drawing.Size(150, 46);
@ -688,7 +691,7 @@
fileTemplateTb.Margin = new System.Windows.Forms.Padding(6);
fileTemplateTb.Name = "fileTemplateTb";
fileTemplateTb.ReadOnly = true;
fileTemplateTb.Size = new System.Drawing.Size(1494, 39);
fileTemplateTb.Size = new System.Drawing.Size(1497, 39);
fileTemplateTb.TabIndex = 4;
//
// fileTemplateLbl
@ -704,7 +707,7 @@
// folderTemplateBtn
//
folderTemplateBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
folderTemplateBtn.Location = new System.Drawing.Point(1520, 72);
folderTemplateBtn.Location = new System.Drawing.Point(1523, 72);
folderTemplateBtn.Margin = new System.Windows.Forms.Padding(6);
folderTemplateBtn.Name = "folderTemplateBtn";
folderTemplateBtn.Size = new System.Drawing.Size(150, 46);
@ -720,7 +723,7 @@
folderTemplateTb.Margin = new System.Windows.Forms.Padding(6);
folderTemplateTb.Name = "folderTemplateTb";
folderTemplateTb.ReadOnly = true;
folderTemplateTb.Size = new System.Drawing.Size(1494, 39);
folderTemplateTb.Size = new System.Drawing.Size(1497, 39);
folderTemplateTb.TabIndex = 1;
//
// folderTemplateLbl
@ -737,6 +740,7 @@
//
tab4AudioFileOptions.Controls.Add(fileDownloadQualityCb);
tab4AudioFileOptions.Controls.Add(fileDownloadQualityLbl);
tab4AudioFileOptions.Controls.Add(combineNestedChapterTitlesCbox);
tab4AudioFileOptions.Controls.Add(clipsBookmarksFormatCb);
tab4AudioFileOptions.Controls.Add(downloadClipsBookmarksCbox);
tab4AudioFileOptions.Controls.Add(audiobookFixupsGb);
@ -751,7 +755,7 @@
tab4AudioFileOptions.Margin = new System.Windows.Forms.Padding(6);
tab4AudioFileOptions.Name = "tab4AudioFileOptions";
tab4AudioFileOptions.Padding = new System.Windows.Forms.Padding(6);
tab4AudioFileOptions.Size = new System.Drawing.Size(1708, 892);
tab4AudioFileOptions.Size = new System.Drawing.Size(1711, 908);
tab4AudioFileOptions.TabIndex = 3;
tab4AudioFileOptions.Text = "Audio File Options";
tab4AudioFileOptions.UseVisualStyleBackColor = true;
@ -776,6 +780,17 @@
fileDownloadQualityLbl.TabIndex = 22;
fileDownloadQualityLbl.Text = "[FileDownloadQuality desc]";
//
// combineNestedChapterTitlesCbox
//
combineNestedChapterTitlesCbox.AutoSize = true;
combineNestedChapterTitlesCbox.Location = new System.Drawing.Point(38, 314);
combineNestedChapterTitlesCbox.Margin = new System.Windows.Forms.Padding(6);
combineNestedChapterTitlesCbox.Name = "combineNestedChapterTitlesCbox";
combineNestedChapterTitlesCbox.Size = new System.Drawing.Size(428, 36);
combineNestedChapterTitlesCbox.TabIndex = 13;
combineNestedChapterTitlesCbox.Text = "[CombineNestedChapterTitles desc]";
combineNestedChapterTitlesCbox.UseVisualStyleBackColor = true;
//
// clipsBookmarksFormatCb
//
clipsBookmarksFormatCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -806,11 +821,11 @@
audiobookFixupsGb.Controls.Add(convertLosslessRb);
audiobookFixupsGb.Controls.Add(convertLossyRb);
audiobookFixupsGb.Controls.Add(stripAudibleBrandingCbox);
audiobookFixupsGb.Location = new System.Drawing.Point(12, 382);
audiobookFixupsGb.Location = new System.Drawing.Point(12, 399);
audiobookFixupsGb.Margin = new System.Windows.Forms.Padding(6);
audiobookFixupsGb.Name = "audiobookFixupsGb";
audiobookFixupsGb.Padding = new System.Windows.Forms.Padding(6);
audiobookFixupsGb.Size = new System.Drawing.Size(806, 370);
audiobookFixupsGb.Size = new System.Drawing.Size(806, 365);
audiobookFixupsGb.TabIndex = 19;
audiobookFixupsGb.TabStop = false;
audiobookFixupsGb.Text = "Audiobook Fix-ups";
@ -818,7 +833,7 @@
// moveMoovAtomCbox
//
moveMoovAtomCbox.AutoSize = true;
moveMoovAtomCbox.Location = new System.Drawing.Point(46, 266);
moveMoovAtomCbox.Location = new System.Drawing.Point(46, 268);
moveMoovAtomCbox.Margin = new System.Windows.Forms.Padding(6);
moveMoovAtomCbox.Name = "moveMoovAtomCbox";
moveMoovAtomCbox.Size = new System.Drawing.Size(372, 36);
@ -1324,13 +1339,24 @@
createCueSheetCbox.UseVisualStyleBackColor = true;
createCueSheetCbox.CheckedChanged += allowLibationFixupCbox_CheckedChanged;
//
// saveMetadataToFileCbox
//
saveMetadataToFileCbox.AutoSize = true;
saveMetadataToFileCbox.Location = new System.Drawing.Point(963, 830);
saveMetadataToFileCbox.Margin = new System.Windows.Forms.Padding(6);
saveMetadataToFileCbox.Name = "saveMetadataToFileCbox";
saveMetadataToFileCbox.Size = new System.Drawing.Size(328, 36);
saveMetadataToFileCbox.TabIndex = 22;
saveMetadataToFileCbox.Text = "[SaveMetadataToFile desc]";
saveMetadataToFileCbox.UseVisualStyleBackColor = true;
//
// SettingsDialog
//
AcceptButton = saveBtn;
AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
CancelButton = cancelBtn;
ClientSize = new System.Drawing.Size(1772, 1060);
ClientSize = new System.Drawing.Size(1775, 1076);
Controls.Add(tabControl);
Controls.Add(cancelBtn);
Controls.Add(saveBtn);
@ -1475,5 +1501,7 @@
private System.Windows.Forms.Label lastWriteTimeLbl;
private System.Windows.Forms.ComboBox fileDownloadQualityCb;
private System.Windows.Forms.Label fileDownloadQualityLbl;
private System.Windows.Forms.CheckBox combineNestedChapterTitlesCbox;
private System.Windows.Forms.CheckBox saveMetadataToFileCbox;
}
}

View File

@ -32,6 +32,7 @@ namespace LibationWinForms.Dialogs
badBookRetryRb.Text = Configuration.BadBookAction.Retry.GetDescription();
badBookIgnoreRb.Text = Configuration.BadBookAction.Ignore.GetDescription();
useCoverAsFolderIconCb.Text = desc(nameof(config.UseCoverAsFolderIcon));
saveMetadataToFileCbox.Text = desc(nameof(config.SaveMetadataToFile));
inProgressSelectControl.SetDirectoryItems(new()
{
@ -60,6 +61,7 @@ namespace LibationWinForms.Dialogs
fileTemplateTb.Text = config.FileTemplate;
chapterFileTemplateTb.Text = config.ChapterFileTemplate;
useCoverAsFolderIconCb.Checked = config.UseCoverAsFolderIcon;
saveMetadataToFileCbox.Checked = config.SaveMetadataToFile;
}
private void Save_DownloadDecrypt(Configuration config)
@ -77,6 +79,7 @@ namespace LibationWinForms.Dialogs
config.FileTemplate = fileTemplateTb.Text;
config.ChapterFileTemplate = chapterFileTemplateTb.Text;
config.UseCoverAsFolderIcon = useCoverAsFolderIconCb.Checked;
config.SaveMetadataToFile = saveMetadataToFileCbox.Checked;
}
}
}

View File

@ -9,6 +9,12 @@ namespace LibationWinForms.Dialogs
{
private Configuration config { get; } = Configuration.Instance;
private Func<string, string> desc { get; } = Configuration.GetDescription;
private readonly ToolTip toolTip = new ToolTip
{
InitialDelay = 300,
AutoPopDelay = 10000,
ReshowDelay = 0
};
public SettingsDialog()
{