message: Fix unhandled exception when getting book details with incorrect ASIN.

change_type: MODIFY

diff:
CREATE TABLE type(id INTEGER, label INTEGER, singular_label INTEGER, icon INTEGER, top_mentioned_entities TEXT, PRIMARY KEY(id));
-INSERT INTO `type` VALUES ('1','7','8','1', '');
-INSERT INTO `type` VALUES ('2','9','10','2', '');
+INSERT INTO `type` VALUES ('1','9','10','1', '');
+INSERT INTO `type` VALUES ('2','11','12','2', '');
CREATE TABLE string(id INTEGER, language TEXT, text TEXT);
INSERT INTO `string` VALUES ('0','de','Alle');
INSERT INTO `string` VALUES ('0','en','All');

diff:
@@ -519,7 +519,8 @@ private XRay.Term GetTerm(string baseUrl, string relativeUrl)
result.DescUrl = tempUri.ToString();
HtmlDocument charDoc = new HtmlDocument();
charDoc.LoadHtml(HttpDownloader.GetPageHtml(tempUri.ToString()));
- HtmlNode mainNode = charDoc.DocumentNode.SelectSingleNode("//div[@class='mainContentFloat']");
+ HtmlNode mainNode = charDoc.DocumentNode.SelectSingleNode("//div[@class='mainContentFloat']")
+ ?? charDoc.DocumentNode.SelectSingleNode("//div[@class='mainContentFloat ']");
result.TermName = mainNode.SelectSingleNode("./h1").InnerText;
mainNode = mainNode.SelectSingleNode("//div[@class='grey500BoxContent']");
HtmlNodeCollection tempNodes = mainNode.SelectNodes("//div[@class='floatingBox']");

diff:
@@ -794,7 +794,14 @@ private void txtMobi_TextChanged(object sender, EventArgs e)
}
catch (Exception ex)
{
- Log("An error occurred metadata: " + ex.Message + "\r\n" + ex.StackTrace);
+ Log("An error occurred metadata: " + ex.Message);
+ return;
+ }
+
+ if (results.Count != 7)
+ {
+ this.Cursor = Cursors.Default;
+ txtMobi.Text = "";
return;
}

license: MIT License


message:
Minor GUI updates to main form and X-ray terms creator.
Series count match primary works/work - for one book in series.
Don't show "Extracting metadata..." on initial load.

diff: Binary files a/Resources/cancel.png and b/Resources/cancel.png differ

diff:
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Icon.ico" />
- <None Include="packages.config" />
<None Include="Resources\cancel.png" />
+ <None Include="packages.config" />
<None Include="Resources\file-on.png" />
<None Include="Resources\file-off.png" />
<None Include="doc\Help.pdf">

diff:
@@ -263,7 +263,7 @@ public override async Task<BookInfo> GetNextInSeries(BookInfo curBook, AuthorPro
if (seriesHtmlDoc != null)
{
SeriesNode = seriesHtmlDoc.DocumentNode.SelectSingleNode("//div[@class='greyText']");
- match = Regex.Match(SeriesNode.InnerText, @"([0-9]*) primary works");
+ match = Regex.Match(SeriesNode.InnerText, @"([0-9]*) primary works?");
if (match.Success)
{
@@ -271,7 +271,7 @@ public override async Task<BookInfo> GetNextInSeries(BookInfo curBook, AuthorPro
}
else
{
- match = Regex.Match(SeriesNode.InnerText, @"([0-9]*) works,");
+ match = Regex.Match(SeriesNode.InnerText, @"([0-9]*) works?,");
curBook.totalInSeries = match.Groups[1].Value;
}
bool notWholeNumber = curBook.seriesPosition.Contains(".");

diff:
@@ -304,7 +304,8 @@ private void InitializeComponent()
this.dgvTerms.AllowUserToDeleteRows = false;
this.dgvTerms.AllowUserToResizeRows = false;
this.dgvTerms.BackgroundColor = System.Drawing.SystemColors.Window;
- this.dgvTerms.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.dgvTerms.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.dgvTerms.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
this.dgvTerms.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvTerms.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1,

diff:
@@ -50,6 +50,10 @@ private void InitializeComponent()
this.prgBar = new System.Windows.Forms.ProgressBar();
this.txtOutput = new System.Windows.Forms.RichTextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.pbFile4 = new System.Windows.Forms.PictureBox();
+ this.pbFile3 = new System.Windows.Forms.PictureBox();
+ this.pbFile2 = new System.Windows.Forms.PictureBox();
+ this.pbFile1 = new System.Windows.Forms.PictureBox();
this.lblFiles = new System.Windows.Forms.Label();
this.txtAsin = new System.Windows.Forms.LinkLabel();
this.txtAuthor = new System.Windows.Forms.Label();
@@ -57,6 +61,7 @@ private void InitializeComponent()
this.lblAsin = new System.Windows.Forms.Label();
this.lblAuthor = new System.Windows.Forms.Label();
this.lblTitle = new System.Windows.Forms.Label();
+ this.pbCover = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnCreate = new System.Windows.Forms.Button();
@@ -64,11 +69,6 @@ private void InitializeComponent()
this.btnAbout = new System.Windows.Forms.Button();
this.btnHelp = new System.Windows.Forms.Button();
this.btnExtractTerms = new System.Windows.Forms.Button();
- this.pbFile4 = new System.Windows.Forms.PictureBox();
- this.pbFile3 = new System.Windows.Forms.PictureBox();
- this.pbFile2 = new System.Windows.Forms.PictureBox();
- this.pbFile1 = new System.Windows.Forms.PictureBox();
- this.pbCover = new System.Windows.Forms.PictureBox();
this.btnBrowseOutput = new System.Windows.Forms.Button();
this.btnOneClick = new System.Windows.Forms.Button();
this.btnUnpack = new System.Windows.Forms.Button();
@@ -268,9 +268,9 @@ private void InitializeComponent()
//
this.prgBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.prgBar.Location = new System.Drawing.Point(12, 540);
+ this.prgBar.Location = new System.Drawing.Point(12, 543);
this.prgBar.Name = "prgBar";
- this.prgBar.Size = new System.Drawing.Size(780, 12);
+ this.prgBar.Size = new System.Drawing.Size(772, 14);
this.prgBar.Step = 1;
this.prgBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.prgBar.TabIndex = 18;
@@ -287,7 +287,7 @@ private void InitializeComponent()
this.txtOutput.Name = "txtOutput";
this.txtOutput.ReadOnly = true;
this.txtOutput.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
- this.txtOutput.Size = new System.Drawing.Size(596, 335);
+ this.txtOutput.Size = new System.Drawing.Size(596, 338);
this.txtOutput.TabIndex = 61;
this.txtOutput.Text = "";
this.txtOutput.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.txtOutput_LinkClicked);
@@ -314,6 +314,42 @@ private void InitializeComponent()
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Book Details";
//
+ // pbFile4
+ //
+ this.pbFile4.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
+ this.pbFile4.Location = new System.Drawing.Point(107, 323);
+ this.pbFile4.Name = "pbFile4";
+ this.pbFile4.Size = new System.Drawing.Size(9, 9);
+ this.pbFile4.TabIndex = 73;
+ this.pbFile4.TabStop = false;
+ //
+ // pbFile3
+ //
+ this.pbFile3.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
+ this.pbFile3.Location = new System.Drawing.Point(90, 323);
+ this.pbFile3.Name = "pbFile3";
+ this.pbFile3.Size = new System.Drawing.Size(9, 9);
+ this.pbFile3.TabIndex = 72;
+ this.pbFile3.TabStop = false;
+ //
+ // pbFile2
+ //
+ this.pbFile2.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
+ this.pbFile2.Location = new System.Drawing.Point(73, 323);
+ this.pbFile2.Name = "pbFile2";
+ this.pbFile2.Size = new System.Drawing.Size(9, 9);
+ this.pbFile2.TabIndex = 71;
+ this.pbFile2.TabStop = false;
+ //
+ // pbFile1
+ //
+ this.pbFile1.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
+ this.pbFile1.Location = new System.Drawing.Point(56, 323);
+ this.pbFile1.Name = "pbFile1";
+ this.pbFile1.Size = new System.Drawing.Size(9, 9);
+ this.pbFile1.TabIndex = 70;
+ this.pbFile1.TabStop = false;
+ //
// lblFiles
//
this.lblFiles.AutoSize = true;
@@ -401,6 +437,15 @@ private void InitializeComponent()
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblTitle.Visible = false;
//
+ // pbCover
+ //
+ this.pbCover.Location = new System.Drawing.Point(14, 20);
+ this.pbCover.Name = "pbCover";
+ this.pbCover.Size = new System.Drawing.Size(166, 249);
+ this.pbCover.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+ this.pbCover.TabIndex = 0;
+ this.pbCover.TabStop = false;
+ //
// label1
//
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
@@ -411,11 +456,12 @@ private void InitializeComponent()
//
// btnCancel
//
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Enabled = false;
this.btnCancel.Image = global::XRayBuilderGUI.Properties.Resources.cancel;
- this.btnCancel.Location = new System.Drawing.Point(797, 537);
+ this.btnCancel.Location = new System.Drawing.Point(795, 539);
this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(18, 18);
+ this.btnCancel.Size = new System.Drawing.Size(22, 22);
this.btnCancel.TabIndex = 69;
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -470,51 +516,6 @@ private void InitializeComponent()
this.btnExtractTerms.UseVisualStyleBackColor = true;
this.btnExtractTerms.Click += new System.EventHandler(this.btnExtractTerms_Click);
//
- // pbFile4
- //
- this.pbFile4.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
- this.pbFile4.Location = new System.Drawing.Point(107, 323);
- this.pbFile4.Name = "pbFile4";
- this.pbFile4.Size = new System.Drawing.Size(9, 9);
- this.pbFile4.TabIndex = 73;
- this.pbFile4.TabStop = false;
- //
- // pbFile3
- //
- this.pbFile3.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
- this.pbFile3.Location = new System.Drawing.Point(90, 323);
- this.pbFile3.Name = "pbFile3";
- this.pbFile3.Size = new System.Drawing.Size(9, 9);
- this.pbFile3.TabIndex = 72;
- this.pbFile3.TabStop = false;
- //
- // pbFile2
- //
- this.pbFile2.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
- this.pbFile2.Location = new System.Drawing.Point(73, 323);
- this.pbFile2.Name = "pbFile2";
- this.pbFile2.Size = new System.Drawing.Size(9, 9);
- this.pbFile2.TabIndex = 71;
- this.pbFile2.TabStop = false;
- //
- // pbFile1
- //
- this.pbFile1.Image = global::XRayBuilderGUI.Properties.Resources.file_off;
- this.pbFile1.Location = new System.Drawing.Point(56, 323);
- this.pbFile1.Name = "pbFile1";
- this.pbFile1.Size = new System.Drawing.Size(9, 9);
- this.pbFile1.TabIndex = 70;
- this.pbFile1.TabStop = false;
- //
- // pbCover
- //
- this.pbCover.Location = new System.Drawing.Point(14, 20);
- this.pbCover.Name = "pbCover";
- this.pbCover.Size = new System.Drawing.Size(166, 249);
- this.pbCover.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
- this.pbCover.TabIndex = 0;
- this.pbCover.TabStop = false;
- //
// btnBrowseOutput
//
this.btnBrowseOutput.Image = ((System.Drawing.Image)(resources.GetObject("btnBrowseOutput.Image")));
@@ -621,7 +622,7 @@ private void InitializeComponent()
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(828, 564);
+ this.ClientSize = new System.Drawing.Size(828, 572);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnCreate);
this.Controls.Add(this.btnPreview);

diff:
@@ -850,7 +850,7 @@ private void txtMobi_TextChanged(object sender, EventArgs e)
}
else
{
- Logger.Log("Extracting metadata...");
+ //Logger.Log("Extracting metadata...");
try
{
Unpack.Metadata md = Functions.GetMetaDataInternal(txtMobi.Text, settings.outDir, false);

original_message:
- Minor GUI updates to main form and X-ray terms creator.
- Series count match primary works/work - for one book in series.
- Don't show "Extracting metadata..." on initial load.


message:
Improve matching
add title case conversion

diff:
@@ -74,5 +74,17 @@ public static string TrimNonPrintableAscii(this string value)
var pattern = new Regex("[^ -~]+");
return pattern.Replace(value, "");
}
+
+ /// <summary>
+ /// Returns the specified string converted to Title Case
+ /// </summary>
+ public static string ToTitleCase(this string value)
+ {
+ if (string.IsNullOrEmpty(value) || value.Any(t => char.IsLetter(t) && !char.IsUpper(t)))
+ return value;
+
+ var textInfo = new CultureInfo("en-US",false).TextInfo;
+ return textInfo.ToTitleCase(value.ToLower());
+ }
}
}
\ No newline at end of file

original_message:
- Improve matching
- add title case conversion

(cherry picked from commit cea8e54e48bfc2d7585ff024f295690cb6b344bb)


message:
Fix log message.
Only display log if related books exist.
Resize very large author images.

diff:
@@ -58,11 +58,17 @@ public async Task<HtmlDocument> GetPageAsync(string url, CancellationToken cance
}
// TODO should this return image not bitmap?
- public async Task<Bitmap> GetImageAsync(string url, bool greyscale = false, CancellationToken cancellationToken = default)
+ public async Task<Bitmap> GetImageAsync(string url, int maxWidthHeight = -1, bool greyscale = false, CancellationToken cancellationToken = default)
{
var response = await GetStreamAsync(url, cancellationToken);
var image = new Bitmap(response);
+ if (maxWidthHeight > -1 && (image.Height > maxWidthHeight || image.Width > maxWidthHeight))
+ {
+ var scaledImage = image.Scale(maxWidthHeight, maxWidthHeight, false);
+ image = (Bitmap) scaledImage;
+ }
+
image = greyscale
? (Bitmap) image.ToGrayscale3()
: image;
@@ -70,11 +76,11 @@ public async Task<Bitmap> GetImageAsync(string url, bool greyscale = false, Canc
return image;
}
- public async IAsyncEnumerable<Bitmap> GetImages(IEnumerable<string> urls, bool greyscale = false, [EnumeratorCancellation] CancellationToken cancellationToken = default)
+ public async IAsyncEnumerable<Bitmap> GetImages(IEnumerable<string> urls, int maxWidthHeight = -1, bool greyscale = false, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
foreach (var url in urls.Where(url => !string.IsNullOrEmpty(url)))
{
- yield return await GetImageAsync(url, greyscale, cancellationToken);
+ yield return await GetImageAsync(url, maxWidthHeight, greyscale, cancellationToken);
}
}

diff:
@@ -15,8 +15,8 @@ public interface IHttpClient
Task<string> GetStringAsync(string url, CancellationToken cancellationToken);
Task<Stream> GetStreamAsync(string url, CancellationToken cancellationToken);
Task<HtmlDocument> GetPageAsync(string url, CancellationToken cancellationToken = default);
- Task<Bitmap> GetImageAsync(string url, bool greyscale = false, CancellationToken cancellationToken = default);
- IAsyncEnumerable<Bitmap> GetImages(IEnumerable<string> urls, bool greyscale = false, CancellationToken cancellationToken = default);
+ Task<Bitmap> GetImageAsync(string url, int maxWidthHeight = -1, bool greyscale = false, CancellationToken cancellationToken = default);
+ IAsyncEnumerable<Bitmap> GetImages(IEnumerable<string> urls, int maxWidthHeight = -1, bool greyscale = false, CancellationToken cancellationToken = default);
Task<HttpResponseMessage> GetAsync(string requestUri);
Task<HttpResponseMessage> GetAsync(Uri requestUri);
Task<HttpResponseMessage> GetAsync(string requestUri, HttpCompletionOption completionOption);

diff:
using System;
using System.Drawing;
+using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
@@ -49,5 +50,74 @@ public static string ToBase64(this Image image, ImageFormat format)
image.Save(ms, format);
return Convert.ToBase64String(ms.ToArray());
}
+
+ /// <summary>
+ /// Resize the image to the specified width and height.
+ /// https://stackoverflow.com/a/10323949
+ /// InterpolationMode HighQualityBicubic introducing artifacts on edge of resized images
+ /// https://stackoverflow.com/a/8312531
+ /// </summary>
+ /// <param name="original">The image to resize.</param>
+ /// <param name="width">The width to resize to.</param>
+ /// <param name="height">The height to resize to.</param>
+ /// <param name="fill">Fill the resized image keeping aspect ratio.</param>
+ /// <returns>The resized image.</returns>
+ public static Image Scale(this Image original, int width, int height, bool fill)
+ {
+ #region Calculations
+
+ var sourceWidth = original.Width;
+ var sourceHeight = original.Height;
+ const int sourceX = 0;
+ const int sourceY = 0;
+ double destX = 0;
+ double destY = 0;
+
+ double nScale;
+
+ var nScaleW = width / (double)sourceWidth;
+ var nScaleH = height / (double) sourceHeight;
+ if (!fill)
+ {
+ nScale = Math.Min(nScaleH, nScaleW);
+ }
+ else
+ {
+ nScale = Math.Max(nScaleH, nScaleW);
+ destY = (height - sourceHeight * nScale) / 2;
+ destX = (width - sourceWidth * nScale) / 2;
+ }
+
+ var destWidth = (int) Math.Round(sourceWidth * nScale);
+ var destHeight = (int) Math.Round(sourceHeight * nScale);
+
+ #endregion
+
+ Bitmap bmPhoto;
+ try
+ {
+ bmPhoto = new Bitmap(destWidth + (int) Math.Round(2 * destX), destHeight + (int) Math.Round(2 * destY));
+ }
+ catch (Exception)
+ {
+ return new Bitmap(original);
+ }
+
+ using var grPhoto = Graphics.FromImage(bmPhoto);
+ grPhoto.CompositingMode = CompositingMode.SourceCopy;
+ grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ grPhoto.PixelOffsetMode = PixelOffsetMode.HighQuality;
+ grPhoto.CompositingQuality = CompositingQuality.HighQuality;
+ grPhoto.SmoothingMode = SmoothingMode.HighQuality;
+
+ var to = new Rectangle((int) Math.Round(destX), (int) Math.Round(destY), destWidth, destHeight);
+ var from = new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight);
+
+ using var wrapMode = new ImageAttributes();
+ wrapMode.SetWrapMode(WrapMode.TileFlipXY);
+ grPhoto.DrawImage(original, to, 0, 0, from.Width, from.Height, GraphicsUnit.Pixel, wrapMode);
+
+ return bmPhoto;
+ }
}
}
\ No newline at end of file

diff:
@@ -22,6 +22,8 @@ public partial class frmPreviewEA : Form, IPreviewForm
private readonly Settings _settings = Settings.Default;
private string _authorUrl = string.Empty;
+ private const int MaxImageSize = 750;
+
#region SET LISTVIEW ICON SPACING
// http://qdevblog.blogspot.ch/2011/11/c-listview-item-spacing.html
@@ -80,7 +82,7 @@ public async Task Populate(string inputFile, CancellationToken cancellationToken
lblAuthor.Text = author.Name;
lblAuthorRecs.Text = $@"More by {author.Name}";
if (!string.IsNullOrEmpty(author.ImageUrl))
- pbAuthor.Image = await _httpClient.GetImageAsync(author.ImageUrl, false, cancellationToken);
+ pbAuthor.Image = await _httpClient.GetImageAsync(author.ImageUrl, MaxImageSize, false, cancellationToken);
}
if (endActions.Data.PublicSharedRating != null)
@@ -109,7 +111,7 @@ public async Task Populate(string inputFile, CancellationToken cancellationToken
var nextBook = endActions.Data.NextBook;
txtNextInSeries.Text = nextBook.Title;
if (!string.IsNullOrEmpty(nextBook.ImageUrl))
- pbNextCover.Image = await _httpClient.GetImageAsync(nextBook.ImageUrl, false, cancellationToken);
+ pbNextCover.Image = await _httpClient.GetImageAsync(nextBook.ImageUrl, MaxImageSize, false, cancellationToken);
}
else
{
@@ -130,7 +132,7 @@ private async Task PopulateImagesFromBooks(ListView listView, ImageList imageLis
ListViewItem_SetSpacing(listView, 60 + 12, 90 + 12);
var urls = books.Select(book => book.ImageUrl);
- var images = await _httpClient.GetImages(urls, false, cancellationToken).ToArrayAsync(cancellationToken);
+ var images = await _httpClient.GetImages(urls, MaxImageSize, false, cancellationToken).ToArrayAsync(cancellationToken);
var i = 0;
foreach (var image in images)

diff:
@@ -20,6 +20,7 @@ public partial class frmPreviewSA : Form, IPreviewForm
private readonly IHttpClient _httpClient;
private readonly Regex _regexHighlights = new Regex(@"(?<text>(?<num>[\d,.]+) passages have been highlighted (?<total>[\d,.]+) times)", RegexOptions.Compiled);
+ private const int MaxImageSize = 750;
public frmPreviewSA(IHttpClient httpClient)
{
@@ -95,7 +96,7 @@ public async Task Populate(string inputFile, CancellationToken cancellationToken
{
var imageUrl = author.ImageUrl;
if (!string.IsNullOrEmpty(imageUrl))
- pbAuthorImage.Image = await _httpClient.GetImageAsync(imageUrl, false, cancellationToken);
+ pbAuthorImage.Image = await _httpClient.GetImageAsync(imageUrl, MaxImageSize, false, cancellationToken);
lblBiography.Text = author.Bio;
}
@@ -106,7 +107,7 @@ public async Task Populate(string inputFile, CancellationToken cancellationToken
{
var imageUrl = rec.ImageUrl;
if (!string.IsNullOrEmpty(imageUrl))
- ilOtherBooks.Images.Add(await _httpClient.GetImageAsync(imageUrl, false, cancellationToken));
+ ilOtherBooks.Images.Add(await _httpClient.GetImageAsync(imageUrl, MaxImageSize, false, cancellationToken));
}
ListViewItem_SetSpacing(lvOtherBooks, 60 + 12, 90 + 12);
for (var i = 0; i < ilOtherBooks.Images.Count; i++)
@@ -128,7 +129,7 @@ public async Task Populate(string inputFile, CancellationToken cancellationToken
lblPreviousTitle.Text = startActions.Data.PreviousBookInTheSeries.Title;
var imageUrl = startActions.Data.PreviousBookInTheSeries.ImageUrl;
if (!string.IsNullOrEmpty(imageUrl))
- pbPreviousCover.Image = await _httpClient.GetImageAsync(imageUrl, false, cancellationToken);
+ pbPreviousCover.Image = await _httpClient.GetImageAsync(imageUrl, MaxImageSize, false, cancellationToken);
}
}

diff:
@@ -465,7 +465,7 @@ private async Task btnKindleExtras_Run()
{
_logger.Log(MainStrings.WritingStartActionsFile);
File.WriteAllText(saPath, Functions.ExpandUnicode(JsonConvert.SerializeObject(startActions)));
- _logger.Log($@"{MainStrings.StartActionsCreated}\r\n{string.Format(MainStrings.SavedTo, saPath)}");
+ _logger.Log($@"{MainStrings.StartActionsCreated}{Environment.NewLine}{string.Format(MainStrings.SavedTo, saPath)}");
needSa = false;
}
}
@@ -486,7 +486,7 @@ private async Task btnKindleExtras_Run()
{
_logger.Log(MainStrings.WritingEndActionsFile);
File.WriteAllText(eaPath, Functions.ExpandUnicode(JsonConvert.SerializeObject(endActions)));
- _logger.Log($@"{MainStrings.EndActionsCreated}\r\n{string.Format(MainStrings.SavedTo, eaPath)}");
+ _logger.Log($@"{MainStrings.EndActionsCreated}{Environment.NewLine}{string.Format(MainStrings.SavedTo, eaPath)}");
needEa = false;
}
}
@@ -629,7 +629,7 @@ string AsinPrompt(string title, string author)
_logger.Log($@"{MainStrings.ErrorCreatingStartActions}: {ex.Message}{Environment.NewLine}{ex.StackTrace}");
}
- _logger.Log($@"{MainStrings.StartActionsCreated}\r\n{string.Format(MainStrings.SavedTo, saPath)}");
+ _logger.Log($@"{MainStrings.StartActionsCreated}{Environment.NewLine}{string.Format(MainStrings.SavedTo, saPath)}");
}
}
@@ -797,6 +797,7 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)
_settings.mobiFile = txtMobi.Text;
_settings.xmlFile = txtXMLFile.Text;
_settings.Goodreads = txtGoodreads.Text;
+ _settings.Save();
if (txtOutput.Text.Trim().Length != 0)
File.WriteAllText(_currentLog, txtOutput.Text);


message: Various updates...

diff:
@@ -17,5 +17,7 @@ public interface IAmazonClient
Task<AuthorSearchResults> SearchAuthor(string author, string TLD, CancellationToken cancellationToken, bool enableLog = true);
Task<BookInfo> SearchBook(string title, string author, string TLD, CancellationToken cancellationToken);
IAsyncEnumerable<BookInfo> EnhanceBookInfos(IEnumerable<BookInfo> books, CancellationToken cancellationToken);
+ [CanBeNull]
+ Task<BookInfo> GetBookByAsin(string asin, string tld, CancellationToken cancellationToken);
}
}
\ No newline at end of file

diff:
@@ -153,20 +153,20 @@ public override async Task<SeriesInfo> GetSeriesInfoAsync(string dataUrl, Cancel
var seriesHtmlDoc = await _httpClient.GetPageAsync(series.Url, cancellationToken);
- seriesNode = seriesHtmlDoc.DocumentNode.SelectSingleNode("//div[contains(@class, 'responsiveSeriesHeader__subtitle')]");
- match = Regex.Match(seriesNode?.InnerText ?? "", @"([0-9]+) (?:primary )?works?");
- if (match.Success)
- series.Total = int.Parse(match.Groups[1].Value);
-
- var positionInt = (int)Convert.ToDouble(series.Position, CultureInfo.InvariantCulture.NumberFormat);
- var totalInt = (int)Convert.ToDouble(series.Total, CultureInfo.InvariantCulture.NumberFormat);
-
var bookNodes = seriesHtmlDoc.DocumentNode.SelectNodes("//div[@itemtype='http://schema.org/Book']");
if (bookNodes == null)
return series;
- var prevSearch = series.Position.Contains(".")
- ? $"book {positionInt}"
- : $"book {positionInt - 1}";
+
+ series.Total = bookNodes
+ .Select(node => node.PreviousSibling)
+ .Count(node => Regex.IsMatch(node?.InnerText.ToUpper() ?? "", @"^BOOK ([0-9]+)$"));
+
+ if (series.Total == 0)
+ return series;
+
+ var positionInt = (int)Convert.ToDouble(series.Position, CultureInfo.InvariantCulture.NumberFormat);
+
+ var prevSearch = $"book {positionInt - 1}";
var nextSearch = $"book {positionInt + 1}";
async Task<BookInfo> ParseSeriesBook(HtmlNode bookNode)
@@ -201,7 +201,7 @@ async Task<BookInfo> ParseSeriesBook(HtmlNode bookNode)
else if (bookIndexText == nextSearch)
series.Next = await ParseSeriesBook(bookNode);
- if (series.Previous != null && (series.Next != null || positionInt == totalInt))
+ if (series.Previous != null && (series.Next != null || positionInt == series.Total))
break; // next and prev found or prev found and latest in series
}

diff:
@@ -61,6 +61,11 @@ public async Task<Response> GenerateAsync(Request request, Func<string, bool> ed
if (searchResults == null)
return null; // Already logged error in search function
+ // Filter out any results that are the same title but not the same asin
+ searchResults.Books = searchResults.Books
+ .Where(book => !book.Title.ToLower().Contains(request.Book.Title.ToLower()) && book.Asin != request.Book.Asin)
+ .ToArray();
+
var authorAsin = searchResults.Asin;
//todo re-implement saving in a nicer way

diff:
@@ -96,12 +96,18 @@ public string GenerateNew(Request request)
endActions.Data.AuthorRecs = new Recs
{
Class = "featuredRecommendationList",
- Recommendations = request.AuthorOtherBooks.Select(bk => Extensions.BookInfoToBook(bk, true)).ToArray()
+ Recommendations = request.AuthorOtherBooks
+ .Select(bk => Extensions.BookInfoToBook(bk, true))
+ .ToArray()
};
+
endActions.Data.CustomersWhoBoughtRecs = new Recs
{
Class = "featuredRecommendationList",
- Recommendations = request.CustomerAlsoBought.Select(bk => Extensions.BookInfoToBook(bk, true)).ToArray()
+ Recommendations = request.CustomerAlsoBought
+ .Where(b => request.AuthorOtherBooks.All(a => a.Asin != b.Asin && !b.Title.ToLower().Contains(a.Title.ToLower())))
+ .Select(bk => Extensions.BookInfoToBook(bk, true))
+ .ToArray()
};
try

diff:
@@ -139,7 +139,7 @@ string ReadDesc(string file)
: Enumerable.Empty<BookInfo>();
}).Where(list => list != null)
.Distinct()
- .Where(book => book.Title != curBook.Title && book.Asin != curBook.Asin)
+ .Where(book => !book.Title.ToLower().Contains(curBook.Title.ToLower()) && book.Asin != curBook.Asin && !_invalidBookTitleRegex.IsMatch(curBook.Title))
.ToArray();
if (settings.UseNewVersion && relatedBooks.Any())
@@ -362,7 +362,11 @@ async Task<BookInfo> FromApOrSearch(BookInfo book, CancellationToken ct)
{
_logger.Log($"Series URL: {curBook.Series.Url}");
if (!string.IsNullOrEmpty(curBook.Series.Name))
- _logger.Log($"This is book {curBook.Series.Position} of {curBook.Series.Total} in the {curBook.Series.Name} series");
+ {
+ _logger.Log((int) Convert.ToDouble(curBook.Series.Position) == curBook.Series.Total
+ ? $"This is the latest book in the {curBook.Series.Name} series."
+ : $"This is book {curBook.Series.Position} of {curBook.Series.Total} in the {curBook.Series.Name} series.");
+ }
if (curBook.Series.Previous != null)
_logger.Log($"Preceded by: {curBook.Series.Previous.Title}");
if (curBook.Series.Next != null)

diff:
@@ -31,7 +31,7 @@ public sealed class ConsoleLogger : ILogger
public void Log(string message, LogLevel level = LogLevel.Info)
{
- Console.WriteLine($"{level}: {message}");
+ Console.WriteLine($@"{level}: {message}");
LogEvent?.Invoke(new LogEventArgs
{
Message = message,

diff:
@@ -123,7 +123,7 @@ private void InitializeComponent()
this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDescription.Location = new System.Drawing.Point(159, 156);
this.lblDescription.Name = "lblDescription";
- this.lblDescription.Size = new System.Drawing.Size(270, 70);
+ this.lblDescription.Size = new System.Drawing.Size(334, 70);
this.lblDescription.TabIndex = 23;
this.lblDescription.Text = "Description";
//

diff:
@@ -847,7 +847,10 @@ private void Form1_Load(object sender, EventArgs e)
if (_settings.outDir == "")
_settings.outDir = $@"{Environment.CurrentDirectory}\out";
- txtGoodreads.Text = _settings.Goodreads;
+ txtGoodreads.Text = !File.Exists(txtMobi.Text)
+ ? ""
+ : _settings.Goodreads;
+
if (_settings.buildSource == "Goodreads")
{
rdoGoodreads.Checked = true;
@@ -911,9 +914,10 @@ private void SetSelectedDatasource()
private void SetDatasourceLink(string url)
{
+ txtDatasource.Visible = true;
if (string.IsNullOrEmpty(url))
{
- txtDatasource.Text = "";
+ txtDatasource.Text = "Search datasource...";
return;
}
@@ -922,7 +926,6 @@ private void SetDatasourceLink(string url)
if (!matchId.Success)
return;
_tooltip.SetToolTip(txtDatasource, url);
- txtDatasource.Visible = true;
txtDatasource.Text = matchId.Groups[2].Value;
}
@@ -986,14 +989,40 @@ private void rdoSource_CheckedChanged(object sender, EventArgs e)
SetDatasourceLabels();
}
- private async void txtMobi_TextChanged(object sender, EventArgs e)
+ private void ClearInterface(bool bookOpened)
{
- if (txtMobi.Text == "" || !File.Exists(txtMobi.Text))
- return;
+ if (!bookOpened)
+ {
+ // todo centralized name (should the app name be localized?)
+ Text = "X-Ray Builder GUI";
+ txtMobi.Text = "";
+ txtOutput.Clear();
+ }
+ else
+ Text = $"X-Ray Builder GUI - {txtMobi.Text}";
+
txtGoodreads.Text = "";
- txtDatasource.Text = "";
+ pbCover.Image = Resources.missing_cover;
+ txtTitle.Text = "";
+ txtAuthor.Text = "";
+ txtAsin.Text = "";
+ // todo another copy
+ txtDatasource.Text = "Search datasource...";
prgBar.Value = 0;
_openedMetadata = null;
+ CheckFiles("","","","","","");
+ }
+
+ private async void txtMobi_TextChanged(object sender, EventArgs e)
+ {
+ if (txtMobi.Text == "" || !File.Exists(txtMobi.Text))
+ {
+ ClearInterface(false);
+ return;
+ }
+ ClearInterface(true);
+
+ ToggleInterface(false);
using var metadata = await GetAndValidateMetadataAsync(txtMobi.Text, false, _cancelTokens.Token);
if (metadata == null)
@@ -1021,8 +1050,19 @@ private async void txtMobi_TextChanged(object sender, EventArgs e)
btnOneClick.Enabled = metadata.XRaySupported;
btnUnpack.Enabled = metadata.RawMlSupported;
- // todo centralized name (should the app name be localized?)
- Text = $"X-Ray Builder GUI - {txtMobi.Text}";
+ //TODO: Check ASIN matches selected Amazon region.
+ //try
+ //{
+ // _logger.Log(@$"Checking if this ASIN matches a book available on Amazon{_settings.amazonTLD}...");
+ // var localBookResult = await _amazonClient.SearchBook(metadata.Title, metadata.Author, _settings.amazonTLD, _cancelTokens.Token);
+ // _logger.Log(localBookResult.Asin == metadata.Asin
+ // ? $@"Successfully found a matching book: {localBookResult.Title}!"
+ // : $"Warning: {localBookResult.Title} by {localBookResult.Author} was found, but the ASIN does not match for your selected Amazon region!\n\rURL: {localBookResult.AmazonUrl}");
+ //}
+ //catch (Exception)
+ //{
+ // // Ignored
+ //}
try
{
@@ -1038,6 +1078,7 @@ private async void txtMobi_TextChanged(object sender, EventArgs e)
{
// Ignored
}
+ ToggleInterface(true);
}
private async void tmiAuthorProfile_Click(object sender, EventArgs e)
@@ -1341,6 +1382,7 @@ private void txtGoodreads_TextChanged(object sender, EventArgs e)
private void pbCover_Click(object sender, EventArgs e)
{
+ if (_openedMetadata == null) return;
using var frmBook = _diContainer.GetInstance<frmBookInfo>();
frmBook.Setup(_openedMetadata, (Image) pbCover.Image.Clone(), new frmBookInfo.DialogData(txtGoodreads.Text, "", "", _settings.buildSource));
frmBook.ShowDialog();

diff:
@@ -807,9 +807,11 @@ private void InitializeComponent()
//
// cmbRegion
//
+ this.cmbRegion.DropDownHeight = 162;
this.cmbRegion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbRegion.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbRegion.FormattingEnabled = true;
+ this.cmbRegion.IntegralHeight = false;
this.cmbRegion.Location = new System.Drawing.Point(106, 116);
this.cmbRegion.Name = "cmbRegion";
this.cmbRegion.Size = new System.Drawing.Size(138, 23);

original_message: Various updates...


message:
Update Norwegian translation
Match box set or boxset
Improve ASIN and Author detection when parsing booklist

diff:
@@ -396,8 +396,14 @@ public async Task<BookInfo> SearchBook(string title, string author, string TLD,
var foundAsin = ParseAsinFromUrl(nodeASIN.OuterHtml);
var titleNode = node.SelectSingleNode(".//div/div/div/div[@class='a-fixed-left-grid-col a-col-right']/div/a")
?? node.SelectSingleNode(".//h2");
+
if (titleNode != null)
- result = new BookInfo(WebUtility.HtmlDecode(titleNode.InnerText.Trim()), author, foundAsin);
+ {
+ result = new BookInfo(WebUtility.HtmlDecode(titleNode.InnerText.Trim()), author, foundAsin)
+ {
+ Tld = TLD
+ };
+ }
}
return result;
}

diff:
@@ -17,6 +17,7 @@ public class AmazonInfoParser : IAmazonInfoParser
private readonly IHttpClient _httpClient;
private readonly Regex _numbersRegex = new(@"(\d+)", RegexOptions.Compiled);
+ private readonly Regex _regex404 = new(@"(cs_404_logo|cs_404_link)", RegexOptions.Compiled);
public AmazonInfoParser(ILogger logger, IHttpClient httpClient)
{
@@ -62,6 +63,9 @@ public InfoResponse ParseAmazonDocument(HtmlDocument bookDoc)
{
var response = new InfoResponse();
+ if (_regex404.IsMatch(bookDoc.DocumentNode.InnerHtml))
+ return response;
+
CheckCaptcha(bookDoc);
#region Image URL

diff:
@@ -55,9 +55,6 @@ public async Task<Response> GenerateOld(BookInfo curBook, Settings settings, IPr
//Generate Book search URL from book's ASIN
var ebookLocation = $@"https://www.amazon.{settings.AmazonTld}/dp/{curBook.Asin}";
- // Search Amazon for book
- //_logger.Log(String.Format("Book's Amazon page URL: {0}", ebookLocation));
-
HtmlDocument bookHtmlDoc;
try
{
@@ -120,15 +117,16 @@ string ReadDesc(string file)
{
var listSelectors = new[]
{
+ "//ol[@class='a-carousel' and @role='list']/li[@class='a-carousel-card']",
"//ol[@class='a-carousel' and @role='list']/li[@class='a-carousel-card a-float-left']",
"//ol[@class='a-carousel' and @role='list']/li[@class='a-carousel-card aok-float-left']",
- "//*[contains(@id, 'desktop-dp-sims_purchase-similarities-esp')]//li",
- "//*[@id='desktop-dp-sims_purchase-similarities-sims-feature']//li",
- "//*[contains(@id, 'dp-sims_OnlineDpSimsPurchaseStrategy-sims')]//li",
- "//*[@id='view_to_purchase-sims-feature']//li",
- "//*[@id='desktop-dp-sims_vtp-60-sims-feature']//li",
- "//div[@id='desktop-dp-sims_session-similarities-sims-feature']//li",
- "//div[@id='desktop-dp-sims_session-similarities-brand-protection-sims-feature']//li"
+ "//*[contains(@id, 'desktop-dp-sims_purchase-similarities-esp')]/li",
+ "//*[contains(@id, 'dp-sims_OnlineDpSimsPurchaseStrategy-sims')]/li",
+ "//*[@id='desktop-dp-sims_purchase-similarities-sims-feature']/li",
+ "//*[@id='desktop-dp-sims_vtp-60-sims-feature']/li",
+ "//div[@id='desktop-dp-sims_session-similarities-brand-protection-sims-feature']/li",
+ "//div[@id='desktop-dp-sims_session-similarities-sims-feature']/li",
+ "//*[@id='view_to_purchase-sims-feature']/li"
};
var relatedBooks = listSelectors.SelectMany(selector =>
@@ -221,10 +219,22 @@ private IEnumerable<BookInfo> ParseBookList(HtmlNodeCollection books)
private async Task<BookInfo> SearchOrPrompt(BookInfo book, Func<string, string, string> asinPrompt, Settings settings, CancellationToken cancellationToken = default)
{
- // If the asin was available from another source, use it
if (!string.IsNullOrEmpty(book.Asin))
{
var response = await _amazonInfoParser.GetAndParseAmazonDocument($"https://www.amazon.{settings.AmazonTld}/dp/{book.Asin}", cancellationToken);
+ if (string.IsNullOrEmpty(response.Description))
+ {
+ var localAmazonBook = await _amazonClient.SearchBook(book.Title, book.Author, settings.AmazonTld,
+ cancellationToken);
+ if (localAmazonBook != null)
+ {
+ response = await _amazonInfoParser.GetAndParseAmazonDocument(localAmazonBook.AmazonUrl, cancellationToken);
+ response.ApplyToBookInfo(localAmazonBook);
+ localAmazonBook.Title = book.Title;
+ return localAmazonBook;
+ }
+ response = await _amazonInfoParser.GetAndParseAmazonDocument($"https://www.amazon.com/dp/{book.Asin}", cancellationToken);
+ }
response.ApplyToBookInfo(book);
return book;
@@ -281,8 +291,7 @@ async Task<BookInfo> FromApOrSearch(BookInfo book, CancellationToken ct)
if (series.Next == null && int.TryParse(series.Position, out var seriesPosition) && seriesPosition != series.Total)
{
- _logger.Log("Book was found to be part of a series, but an error occurred finding the next book.\r\n"
- + "Please report this book, the URL, and output log to improve parsing (if it's a real book).");
+ _logger.Log($@"Book was found to be part of a series, but an error occurred finding the next book.{Environment.NewLine}Please report this book, the URL, and output log to improve parsing (if it's a real book).");
}
}

original_message:
- Update Norwegian translation
- Match box set or boxset
- Improve ASIN and Author detection when parsing booklist


message: Fix biography not being updated from searchResults.

diff:
@@ -150,13 +150,13 @@ string TrimBio(string bio)
request.Settings.AmazonTld = "com";
var tempSearchResults = await _amazonClient.SearchAuthor(request.Book.Author, request.Settings.AmazonTld, cancellationToken);
if (tempSearchResults?.Biography != null)
- {
searchResults.Biography = tempSearchResults.Biography;
- biography = searchResults.Biography;
- }
}
}
+ if (searchResults.Biography != null)
+ biography = searchResults.Biography;
+
if (File.Exists(bioFile) && request.Settings.SaveBio)
{
biography = ReadBio(bioFile);


message:
Rework ASIN and Goodreads prompts.
Minor change to settings form.

diff:
@@ -42,9 +42,9 @@ private void InitializeComponent()
// btnOK
//
this.btnOK.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btnOK.Location = new System.Drawing.Point(15, 108);
+ this.btnOK.Location = new System.Drawing.Point(146, 88);
this.btnOK.Name = "btnOK";
- this.btnOK.Size = new System.Drawing.Size(275, 32);
+ this.btnOK.Size = new System.Drawing.Size(100, 26);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
@@ -53,48 +53,48 @@ private void InitializeComponent()
// tbAsin
//
this.tbAsin.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.tbAsin.Location = new System.Drawing.Point(88, 65);
+ this.tbAsin.Location = new System.Drawing.Point(65, 54);
this.tbAsin.Name = "tbAsin";
- this.tbAsin.Size = new System.Drawing.Size(201, 23);
+ this.tbAsin.Size = new System.Drawing.Size(180, 23);
this.tbAsin.TabIndex = 0;
//
// lblTitle
//
this.lblTitle.AutoEllipsis = true;
this.lblTitle.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTitle.Location = new System.Drawing.Point(84, 12);
+ this.lblTitle.Location = new System.Drawing.Point(66, 9);
this.lblTitle.Name = "lblTitle";
- this.lblTitle.Size = new System.Drawing.Size(199, 20);
+ this.lblTitle.Size = new System.Drawing.Size(182, 15);
this.lblTitle.TabIndex = 3;
this.lblTitle.Text = "Title";
//
// lblTitleHead
//
this.lblTitleHead.AutoSize = true;
- this.lblTitleHead.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTitleHead.Location = new System.Drawing.Point(33, 12);
+ this.lblTitleHead.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblTitleHead.Location = new System.Drawing.Point(19, 9);
this.lblTitleHead.Name = "lblTitleHead";
- this.lblTitleHead.Size = new System.Drawing.Size(42, 20);
+ this.lblTitleHead.Size = new System.Drawing.Size(35, 15);
this.lblTitleHead.TabIndex = 4;
this.lblTitleHead.Text = "Title:";
//
// lblAsin
//
this.lblAsin.AutoSize = true;
- this.lblAsin.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAsin.Location = new System.Drawing.Point(28, 68);
+ this.lblAsin.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblAsin.Location = new System.Drawing.Point(19, 57);
this.lblAsin.Name = "lblAsin";
- this.lblAsin.Size = new System.Drawing.Size(47, 20);
+ this.lblAsin.Size = new System.Drawing.Size(38, 15);
this.lblAsin.TabIndex = 5;
this.lblAsin.Text = "ASIN:";
//
// label1
//
this.label1.AutoSize = true;
- this.label1.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label1.Location = new System.Drawing.Point(13, 40);
+ this.label1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label1.Location = new System.Drawing.Point(8, 30);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(62, 20);
+ this.label1.Size = new System.Drawing.Size(49, 15);
this.label1.TabIndex = 7;
this.label1.Text = "Author:";
//
@@ -102,18 +102,18 @@ private void InitializeComponent()
//
this.lblAuthor.AutoEllipsis = true;
this.lblAuthor.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAuthor.Location = new System.Drawing.Point(84, 40);
+ this.lblAuthor.Location = new System.Drawing.Point(66, 30);
this.lblAuthor.Name = "lblAuthor";
- this.lblAuthor.Size = new System.Drawing.Size(199, 20);
+ this.lblAuthor.Size = new System.Drawing.Size(182, 15);
this.lblAuthor.TabIndex = 6;
this.lblAuthor.Text = "Author";
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(114, 75);
+ this.btnCancel.Location = new System.Drawing.Point(11, 88);
this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(86, 23);
+ this.btnCancel.Size = new System.Drawing.Size(100, 26);
this.btnCancel.TabIndex = 8;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
@@ -126,7 +126,7 @@ private void InitializeComponent()
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(306, 156);
+ this.ClientSize = new System.Drawing.Size(257, 125);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.label1);
this.Controls.Add(this.lblAuthor);
@@ -149,6 +149,7 @@ private void InitializeComponent()
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
+
}
private System.Windows.Forms.Button btnCancel;

diff:
@@ -50,9 +50,9 @@ private void InitializeComponent()
this.cbResults.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbResults.FormattingEnabled = true;
this.cbResults.IntegralHeight = false;
- this.cbResults.Location = new System.Drawing.Point(17, 17);
+ this.cbResults.Location = new System.Drawing.Point(12, 12);
this.cbResults.Name = "cbResults";
- this.cbResults.Size = new System.Drawing.Size(478, 28);
+ this.cbResults.Size = new System.Drawing.Size(410, 23);
this.cbResults.TabIndex = 3;
this.cbResults.SelectedIndexChanged += new System.EventHandler(this.cbResults_SelectedIndexChanged);
//
@@ -60,17 +60,17 @@ private void InitializeComponent()
//
this.lblMessage1.AutoEllipsis = true;
this.lblMessage1.AutoSize = true;
- this.lblMessage1.Location = new System.Drawing.Point(13, 57);
+ this.lblMessage1.Location = new System.Drawing.Point(9, 44);
this.lblMessage1.Name = "lblMessage1";
- this.lblMessage1.Size = new System.Drawing.Size(350, 20);
+ this.lblMessage1.Size = new System.Drawing.Size(278, 15);
this.lblMessage1.TabIndex = 4;
this.lblMessage1.Text = "?? matches for this book were found on Goodreads.";
//
// btnOK
//
- this.btnOK.Location = new System.Drawing.Point(396, 79);
+ this.btnOK.Location = new System.Drawing.Point(323, 60);
this.btnOK.Name = "btnOK";
- this.btnOK.Size = new System.Drawing.Size(100, 32);
+ this.btnOK.Size = new System.Drawing.Size(100, 26);
this.btnOK.TabIndex = 5;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
@@ -80,9 +80,9 @@ private void InitializeComponent()
//
this.lblMessage2.AutoEllipsis = true;
this.lblMessage2.AutoSize = true;
- this.lblMessage2.Location = new System.Drawing.Point(13, 85);
+ this.lblMessage2.Location = new System.Drawing.Point(9, 65);
this.lblMessage2.Name = "lblMessage2";
- this.lblMessage2.Size = new System.Drawing.Size(239, 20);
+ this.lblMessage2.Size = new System.Drawing.Size(191, 15);
this.lblMessage2.TabIndex = 6;
this.lblMessage2.Text = "Which book would you like to use?";
//
@@ -96,9 +96,9 @@ private void InitializeComponent()
this.groupBox1.Controls.Add(this.lblID);
this.groupBox1.Controls.Add(this.pbCover);
this.groupBox1.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.groupBox1.Location = new System.Drawing.Point(17, 117);
+ this.groupBox1.Location = new System.Drawing.Point(12, 89);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(478, 137);
+ this.groupBox1.Size = new System.Drawing.Size(410, 123);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Book Details";
@@ -110,9 +110,9 @@ private void InitializeComponent()
this.linkID.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.linkID.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
this.linkID.LinkColor = System.Drawing.Color.MediumBlue;
- this.linkID.Location = new System.Drawing.Point(194, 101);
+ this.linkID.Location = new System.Drawing.Point(165, 96);
this.linkID.Name = "linkID";
- this.linkID.Size = new System.Drawing.Size(24, 20);
+ this.linkID.Size = new System.Drawing.Size(18, 15);
this.linkID.TabIndex = 6;
this.linkID.TabStop = true;
this.linkID.Text = "ID";
@@ -124,9 +124,9 @@ private void InitializeComponent()
//
this.lblEditions.AutoEllipsis = true;
this.lblEditions.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblEditions.Location = new System.Drawing.Point(91, 82);
+ this.lblEditions.Location = new System.Drawing.Point(81, 77);
this.lblEditions.Name = "lblEditions";
- this.lblEditions.Size = new System.Drawing.Size(379, 20);
+ this.lblEditions.Size = new System.Drawing.Size(323, 15);
this.lblEditions.TabIndex = 5;
this.lblEditions.Text = "Editions:";
this.lblEditions.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -135,9 +135,9 @@ private void InitializeComponent()
//
this.lblRating.AutoEllipsis = true;
this.lblRating.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblRating.Location = new System.Drawing.Point(91, 63);
+ this.lblRating.Location = new System.Drawing.Point(81, 58);
this.lblRating.Name = "lblRating";
- this.lblRating.Size = new System.Drawing.Size(379, 20);
+ this.lblRating.Size = new System.Drawing.Size(323, 15);
this.lblRating.TabIndex = 4;
this.lblRating.Text = "Rating:";
this.lblRating.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -146,9 +146,9 @@ private void InitializeComponent()
//
this.lblTitle.AutoEllipsis = true;
this.lblTitle.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTitle.Location = new System.Drawing.Point(91, 25);
+ this.lblTitle.Location = new System.Drawing.Point(81, 20);
this.lblTitle.Name = "lblTitle";
- this.lblTitle.Size = new System.Drawing.Size(379, 20);
+ this.lblTitle.Size = new System.Drawing.Size(323, 15);
this.lblTitle.TabIndex = 3;
this.lblTitle.Text = "Title";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -158,9 +158,9 @@ private void InitializeComponent()
//
this.lblAuthor.AutoEllipsis = true;
this.lblAuthor.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAuthor.Location = new System.Drawing.Point(91, 44);
+ this.lblAuthor.Location = new System.Drawing.Point(81, 39);
this.lblAuthor.Name = "lblAuthor";
- this.lblAuthor.Size = new System.Drawing.Size(379, 20);
+ this.lblAuthor.Size = new System.Drawing.Size(323, 15);
this.lblAuthor.TabIndex = 2;
this.lblAuthor.Text = "Author";
this.lblAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -170,9 +170,9 @@ private void InitializeComponent()
this.lblID.AutoEllipsis = true;
this.lblID.AutoSize = true;
this.lblID.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblID.Location = new System.Drawing.Point(91, 101);
+ this.lblID.Location = new System.Drawing.Point(81, 96);
this.lblID.Name = "lblID";
- this.lblID.Size = new System.Drawing.Size(104, 20);
+ this.lblID.Size = new System.Drawing.Size(81, 15);
this.lblID.TabIndex = 1;
this.lblID.Text = "Goodreads ID:";
this.lblID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -180,7 +180,7 @@ private void InitializeComponent()
// pbCover
//
this.pbCover.Image = ((System.Drawing.Image)(resources.GetObject("pbCover.Image")));
- this.pbCover.Location = new System.Drawing.Point(18, 28);
+ this.pbCover.Location = new System.Drawing.Point(13, 21);
this.pbCover.Name = "pbCover";
this.pbCover.Size = new System.Drawing.Size(60, 90);
this.pbCover.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -189,9 +189,9 @@ private void InitializeComponent()
//
// frmGR
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(512, 270);
+ this.ClientSize = new System.Drawing.Size(434, 223);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.lblMessage2);
this.Controls.Add(this.btnOK);

diff:
@@ -148,7 +148,7 @@ private void InitializeComponent()
// btnSave
//
this.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.btnSave.Location = new System.Drawing.Point(494, 285);
+ this.btnSave.Location = new System.Drawing.Point(489, 285);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(100, 26);
this.btnSave.TabIndex = 37;


message:
BookInfo code cleanup.
Rework Start Action form.

diff:
@@ -33,7 +33,7 @@ private void InitializeComponent()
this.ilOtherBooks = new System.Windows.Forms.ImageList(this.components);
this.lblTime = new System.Windows.Forms.Label();
this.lblVotes = new System.Windows.Forms.Label();
- this.lblHighlights = new System.Windows.Forms.Label();
+ this.lblHighlightsCount = new System.Windows.Forms.Label();
this.lblBiography = new System.Windows.Forms.Label();
this.lblAboutAuthor = new System.Windows.Forms.Label();
this.lblPreviousTitle = new System.Windows.Forms.Label();
@@ -52,12 +52,17 @@ private void InitializeComponent()
this.pbAuthorImage = new System.Windows.Forms.PictureBox();
this.pbPreviousCover = new System.Windows.Forms.PictureBox();
this.pbSeperator1 = new System.Windows.Forms.PictureBox();
+ this.linkStore = new System.Windows.Forms.LinkLabel();
+ this.lblAboutAuthorName = new System.Windows.Forms.Label();
+ this.pictureBox3 = new System.Windows.Forms.PictureBox();
+ this.lblHighlights = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbRating)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbAuthorImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbPreviousCover)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbSeperator1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
this.SuspendLayout();
//
// ilOtherBooks
@@ -69,10 +74,10 @@ private void InitializeComponent()
// lblTime
//
this.lblTime.AutoSize = true;
- this.lblTime.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTime.Location = new System.Drawing.Point(13, 498);
+ this.lblTime.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblTime.Location = new System.Drawing.Point(9, 162);
this.lblTime.Name = "lblTime";
- this.lblTime.Size = new System.Drawing.Size(143, 20);
+ this.lblTime.Size = new System.Drawing.Size(116, 15);
this.lblTime.TabIndex = 82;
this.lblTime.Text = "Typical time to read";
this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -80,41 +85,41 @@ private void InitializeComponent()
// lblVotes
//
this.lblVotes.AutoSize = true;
- this.lblVotes.Font = new System.Drawing.Font("Segoe UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblVotes.Location = new System.Drawing.Point(101, 56);
+ this.lblVotes.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblVotes.Location = new System.Drawing.Point(98, 50);
this.lblVotes.Name = "lblVotes";
- this.lblVotes.Size = new System.Drawing.Size(50, 19);
+ this.lblVotes.Size = new System.Drawing.Size(40, 13);
this.lblVotes.TabIndex = 79;
this.lblVotes.Text = "(votes)";
this.lblVotes.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
- // lblHighlights
+ // lblHighlightsCount
//
- this.lblHighlights.AutoEllipsis = true;
- this.lblHighlights.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblHighlights.Location = new System.Drawing.Point(13, 521);
- this.lblHighlights.Name = "lblHighlights";
- this.lblHighlights.Size = new System.Drawing.Size(417, 20);
- this.lblHighlights.TabIndex = 77;
- this.lblHighlights.Text = "No popular highlight information available";
+ this.lblHighlightsCount.AutoEllipsis = true;
+ this.lblHighlightsCount.Font = new System.Drawing.Font("Segoe UI", 9F);
+ this.lblHighlightsCount.Location = new System.Drawing.Point(9, 510);
+ this.lblHighlightsCount.Name = "lblHighlightsCount";
+ this.lblHighlightsCount.Size = new System.Drawing.Size(415, 15);
+ this.lblHighlightsCount.TabIndex = 77;
+ this.lblHighlightsCount.Text = "No popular highlight information available";
//
// lblBiography
//
this.lblBiography.AutoEllipsis = true;
this.lblBiography.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblBiography.Location = new System.Drawing.Point(89, 373);
+ this.lblBiography.Location = new System.Drawing.Point(80, 399);
this.lblBiography.Name = "lblBiography";
- this.lblBiography.Size = new System.Drawing.Size(341, 103);
+ this.lblBiography.Size = new System.Drawing.Size(344, 77);
this.lblBiography.TabIndex = 76;
this.lblBiography.Text = "Biography";
//
// lblAboutAuthor
//
this.lblAboutAuthor.AutoSize = true;
- this.lblAboutAuthor.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAboutAuthor.Location = new System.Drawing.Point(13, 345);
+ this.lblAboutAuthor.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblAboutAuthor.Location = new System.Drawing.Point(9, 353);
this.lblAboutAuthor.Name = "lblAboutAuthor";
- this.lblAboutAuthor.Size = new System.Drawing.Size(127, 20);
+ this.lblAboutAuthor.Size = new System.Drawing.Size(103, 15);
this.lblAboutAuthor.TabIndex = 74;
this.lblAboutAuthor.Text = "About the author";
this.lblAboutAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -123,20 +128,19 @@ private void InitializeComponent()
//
this.lblPreviousTitle.AutoEllipsis = true;
this.lblPreviousTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblPreviousTitle.Location = new System.Drawing.Point(85, 271);
+ this.lblPreviousTitle.Location = new System.Drawing.Point(80, 282);
this.lblPreviousTitle.Name = "lblPreviousTitle";
- this.lblPreviousTitle.Size = new System.Drawing.Size(345, 20);
+ this.lblPreviousTitle.Size = new System.Drawing.Size(344, 30);
this.lblPreviousTitle.TabIndex = 73;
this.lblPreviousTitle.Text = "Previous Title";
- this.lblPreviousTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPreviousHeading
//
- this.lblPreviousHeading.AutoEllipsis = true;
- this.lblPreviousHeading.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblPreviousHeading.Location = new System.Drawing.Point(85, 248);
+ this.lblPreviousHeading.AutoSize = true;
+ this.lblPreviousHeading.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblPreviousHeading.Location = new System.Drawing.Point(80, 263);
this.lblPreviousHeading.Name = "lblPreviousHeading";
- this.lblPreviousHeading.Size = new System.Drawing.Size(345, 20);
+ this.lblPreviousHeading.Size = new System.Drawing.Size(159, 15);
this.lblPreviousHeading.TabIndex = 72;
this.lblPreviousHeading.Text = "Previous book in the series:";
this.lblPreviousHeading.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -145,9 +149,9 @@ private void InitializeComponent()
//
this.lblSeries.AutoEllipsis = true;
this.lblSeries.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblSeries.Location = new System.Drawing.Point(85, 225);
+ this.lblSeries.Location = new System.Drawing.Point(81, 244);
this.lblSeries.Name = "lblSeries";
- this.lblSeries.Size = new System.Drawing.Size(345, 20);
+ this.lblSeries.Size = new System.Drawing.Size(344, 15);
this.lblSeries.TabIndex = 70;
this.lblSeries.Text = "This is book n of n in Series Name";
this.lblSeries.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -155,10 +159,10 @@ private void InitializeComponent()
// lblAboutSeries
//
this.lblAboutSeries.AutoSize = true;
- this.lblAboutSeries.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAboutSeries.Location = new System.Drawing.Point(13, 192);
+ this.lblAboutSeries.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblAboutSeries.Location = new System.Drawing.Point(9, 217);
this.lblAboutSeries.Name = "lblAboutSeries";
- this.lblAboutSeries.Size = new System.Drawing.Size(119, 20);
+ this.lblAboutSeries.Size = new System.Drawing.Size(98, 15);
this.lblAboutSeries.TabIndex = 69;
this.lblAboutSeries.Text = "About the series";
this.lblAboutSeries.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -167,9 +171,9 @@ private void InitializeComponent()
//
this.lblReadingTime.AutoEllipsis = true;
this.lblReadingTime.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblReadingTime.Location = new System.Drawing.Point(13, 544);
+ this.lblReadingTime.Location = new System.Drawing.Point(9, 183);
this.lblReadingTime.Name = "lblReadingTime";
- this.lblReadingTime.Size = new System.Drawing.Size(417, 20);
+ this.lblReadingTime.Size = new System.Drawing.Size(415, 15);
this.lblReadingTime.TabIndex = 68;
this.lblReadingTime.Text = "No typical reading time information available";
this.lblReadingTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -178,9 +182,9 @@ private void InitializeComponent()
//
this.lblDescription.AutoEllipsis = true;
this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblDescription.Location = new System.Drawing.Point(12, 78);
+ this.lblDescription.Location = new System.Drawing.Point(9, 71);
this.lblDescription.Name = "lblDescription";
- this.lblDescription.Size = new System.Drawing.Size(418, 98);
+ this.lblDescription.Size = new System.Drawing.Size(416, 78);
this.lblDescription.TabIndex = 66;
this.lblDescription.Text = "Description";
//
@@ -188,19 +192,19 @@ private void InitializeComponent()
//
this.lblAuthor.AutoEllipsis = true;
this.lblAuthor.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.lblAuthor.Location = new System.Drawing.Point(13, 35);
+ this.lblAuthor.Location = new System.Drawing.Point(9, 28);
this.lblAuthor.Name = "lblAuthor";
- this.lblAuthor.Size = new System.Drawing.Size(417, 20);
+ this.lblAuthor.Size = new System.Drawing.Size(417, 15);
this.lblAuthor.TabIndex = 65;
this.lblAuthor.Text = "Author";
this.lblAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTitle
//
- this.lblTitle.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTitle.Location = new System.Drawing.Point(13, 12);
+ this.lblTitle.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblTitle.Location = new System.Drawing.Point(9, 9);
this.lblTitle.Name = "lblTitle";
- this.lblTitle.Size = new System.Drawing.Size(417, 20);
+ this.lblTitle.Size = new System.Drawing.Size(417, 15);
this.lblTitle.TabIndex = 64;
this.lblTitle.Text = "Title";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -208,10 +212,10 @@ private void InitializeComponent()
// lblAuthorMore
//
this.lblAuthorMore.AutoSize = true;
- this.lblAuthorMore.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblAuthorMore.Location = new System.Drawing.Point(442, 12);
+ this.lblAuthorMore.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblAuthorMore.Location = new System.Drawing.Point(433, 9);
this.lblAuthorMore.Name = "lblAuthorMore";
- this.lblAuthorMore.Size = new System.Drawing.Size(143, 20);
+ this.lblAuthorMore.Size = new System.Drawing.Size(115, 15);
this.lblAuthorMore.TabIndex = 83;
this.lblAuthorMore.Text = "More by the author";
this.lblAuthorMore.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -222,9 +226,9 @@ private void InitializeComponent()
this.lvOtherBooks.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvOtherBooks.HideSelection = false;
this.lvOtherBooks.LargeImageList = this.ilOtherBooks;
- this.lvOtherBooks.Location = new System.Drawing.Point(439, 43);
+ this.lvOtherBooks.Location = new System.Drawing.Point(430, 31);
this.lvOtherBooks.Name = "lvOtherBooks";
- this.lvOtherBooks.Size = new System.Drawing.Size(244, 512);
+ this.lvOtherBooks.Size = new System.Drawing.Size(234, 491);
this.lvOtherBooks.TabIndex = 84;
this.lvOtherBooks.UseCompatibleStateImageBehavior = false;
this.lvOtherBooks.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvOtherBooks_ItemSelectionChanged);
@@ -233,7 +237,7 @@ private void InitializeComponent()
//
this.pictureBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(205)))), ((int)(((byte)(205)))));
this.pictureBox2.InitialImage = null;
- this.pictureBox2.Location = new System.Drawing.Point(17, 485);
+ this.pictureBox2.Location = new System.Drawing.Point(12, 479);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(413, 1);
this.pictureBox2.TabIndex = 81;
@@ -243,7 +247,7 @@ private void InitializeComponent()
//
this.pictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(205)))), ((int)(((byte)(205)))));
this.pictureBox1.InitialImage = null;
- this.pictureBox1.Location = new System.Drawing.Point(17, 332);
+ this.pictureBox1.Location = new System.Drawing.Point(12, 343);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(413, 1);
this.pictureBox1.TabIndex = 80;
@@ -252,7 +256,7 @@ private void InitializeComponent()
// pbRating
//
this.pbRating.Image = global::XRayBuilderGUI.Properties.Resources.STAR0;
- this.pbRating.Location = new System.Drawing.Point(17, 59);
+ this.pbRating.Location = new System.Drawing.Point(12, 50);
this.pbRating.Name = "pbRating";
this.pbRating.Size = new System.Drawing.Size(80, 16);
this.pbRating.TabIndex = 78;
@@ -261,7 +265,7 @@ private void InitializeComponent()
// pbAuthorImage
//
this.pbAuthorImage.Image = ((System.Drawing.Image)(resources.GetObject("pbAuthorImage.Image")));
- this.pbAuthorImage.Location = new System.Drawing.Point(17, 378);
+ this.pbAuthorImage.Location = new System.Drawing.Point(12, 377);
this.pbAuthorImage.Name = "pbAuthorImage";
this.pbAuthorImage.Size = new System.Drawing.Size(60, 90);
this.pbAuthorImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
@@ -271,7 +275,7 @@ private void InitializeComponent()
// pbPreviousCover
//
this.pbPreviousCover.Image = ((System.Drawing.Image)(resources.GetObject("pbPreviousCover.Image")));
- this.pbPreviousCover.Location = new System.Drawing.Point(17, 225);
+ this.pbPreviousCover.Location = new System.Drawing.Point(12, 241);
this.pbPreviousCover.Name = "pbPreviousCover";
this.pbPreviousCover.Size = new System.Drawing.Size(60, 90);
this.pbPreviousCover.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -282,17 +286,67 @@ private void InitializeComponent()
//
this.pbSeperator1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(205)))), ((int)(((byte)(205)))));
this.pbSeperator1.InitialImage = null;
- this.pbSeperator1.Location = new System.Drawing.Point(17, 179);
+ this.pbSeperator1.Location = new System.Drawing.Point(12, 207);
this.pbSeperator1.Name = "pbSeperator1";
this.pbSeperator1.Size = new System.Drawing.Size(413, 1);
this.pbSeperator1.TabIndex = 67;
this.pbSeperator1.TabStop = false;
//
+ // linkStore
+ //
+ this.linkStore.ActiveLinkColor = System.Drawing.Color.RoyalBlue;
+ this.linkStore.AutoSize = true;
+ this.linkStore.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.linkStore.Location = new System.Drawing.Point(357, 50);
+ this.linkStore.Name = "linkStore";
+ this.linkStore.Size = new System.Drawing.Size(67, 13);
+ this.linkStore.TabIndex = 85;
+ this.linkStore.TabStop = true;
+ this.linkStore.Text = "See in store";
+ this.linkStore.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.linkStore.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkStore_LinkClicked);
+ //
+ // lblAboutAuthorName
+ //
+ this.lblAboutAuthorName.AutoSize = true;
+ this.lblAboutAuthorName.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblAboutAuthorName.Location = new System.Drawing.Point(81, 380);
+ this.lblAboutAuthorName.Name = "lblAboutAuthorName";
+ this.lblAboutAuthorName.Size = new System.Drawing.Size(46, 15);
+ this.lblAboutAuthorName.TabIndex = 86;
+ this.lblAboutAuthorName.Text = "Author";
+ this.lblAboutAuthorName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // pictureBox3
+ //
+ this.pictureBox3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(205)))), ((int)(((byte)(205)))));
+ this.pictureBox3.InitialImage = null;
+ this.pictureBox3.Location = new System.Drawing.Point(12, 152);
+ this.pictureBox3.Name = "pictureBox3";
+ this.pictureBox3.Size = new System.Drawing.Size(413, 1);
+ this.pictureBox3.TabIndex = 87;
+ this.pictureBox3.TabStop = false;
+ //
+ // lblHighlights
+ //
+ this.lblHighlights.AutoSize = true;
+ this.lblHighlights.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblHighlights.Location = new System.Drawing.Point(9, 489);
+ this.lblHighlights.Name = "lblHighlights";
+ this.lblHighlights.Size = new System.Drawing.Size(108, 15);
+ this.lblHighlights.TabIndex = 88;
+ this.lblHighlights.Text = "Popular Highlights";
+ this.lblHighlights.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
// frmPreviewSA
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(699, 576);
+ this.ClientSize = new System.Drawing.Size(675, 534);
+ this.Controls.Add(this.lblHighlights);
+ this.Controls.Add(this.pictureBox3);
+ this.Controls.Add(this.lblAboutAuthorName);
+ this.Controls.Add(this.linkStore);
this.Controls.Add(this.lvOtherBooks);
this.Controls.Add(this.lblAuthorMore);
this.Controls.Add(this.lblTime);
@@ -300,7 +354,7 @@ private void InitializeComponent()
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.lblVotes);
this.Controls.Add(this.pbRating);
- this.Controls.Add(this.lblHighlights);
+ this.Controls.Add(this.lblHighlightsCount);
this.Controls.Add(this.lblBiography);
this.Controls.Add(this.pbAuthorImage);
this.Controls.Add(this.lblAboutAuthor);
@@ -330,6 +384,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.pbAuthorImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbPreviousCover)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbSeperator1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -342,7 +397,7 @@ private void InitializeComponent()
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label lblVotes;
private System.Windows.Forms.PictureBox pbRating;
- private System.Windows.Forms.Label lblHighlights;
+ private System.Windows.Forms.Label lblHighlightsCount;
private System.Windows.Forms.Label lblBiography;
private System.Windows.Forms.PictureBox pbAuthorImage;
private System.Windows.Forms.Label lblAboutAuthor;
@@ -358,5 +413,9 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Label lblAuthorMore;
private System.Windows.Forms.ListView lvOtherBooks;
+ private System.Windows.Forms.LinkLabel linkStore;
+ private System.Windows.Forms.Label lblAboutAuthorName;
+ private System.Windows.Forms.PictureBox pictureBox3;
+ private System.Windows.Forms.Label lblHighlights;
}
}
\ No newline at end of file

diff:
@@ -34,7 +34,7 @@ public partial class frmBookInfo : Form
public DialogData Result { get; private set; }
private readonly ToolTip _tooltip = new();
- private string tempUrl = "";
+ private string secondaryDataSourceUrl;
public frmBookInfo(IHttpClient httpClient, Container diContainer, IAmazonClient amazonClient)
{
@@ -52,7 +52,7 @@ public void Setup(IMetadata metadata, Image coverImage, DialogData dialogData)
txtBio.Text = dialogData.AuthorBiography;
txtDataProviderUrl.Text = dialogData.SecondarySourceUrl;
- tempUrl = dialogData.SecondarySourceUrl;
+ secondaryDataSourceUrl = dialogData.SecondarySourceUrl;
cmbSecondaryDataSource.Text = Settings.Default.dataSource;
_tooltip.SetToolTip(btnAuthorUrlSearch, $"Search for {_metadata.Author}\r\non Amazon.{_settings.amazonTLD}.");
@@ -60,7 +60,7 @@ public void Setup(IMetadata metadata, Image coverImage, DialogData dialogData)
_tooltip.SetToolTip(btnAuthorUrlSearch, $"Search for {_metadata.Author}\r\non Amazon.{_settings.amazonTLD}.");
_tooltip.SetToolTip(cmbSecondaryDataSource, MainStrings.SecondarySourceTooltip);
- foreach (var button in this.Controls.OfType<Button>())
+ foreach (var button in Controls.OfType<Button>())
{
if (button.Name.Contains("UrlLink"))
_tooltip.SetToolTip(button, "Open this link in your\r\ndefault browser.");
@@ -301,7 +301,7 @@ private void cmbSecondaryDataSource_SelectedIndexChanged(object sender, EventArg
{
var dataProvider = cmbSecondaryDataSource.Text;
lblDataProviderUrl.Text = $@"{dataProvider} URL:";
- txtDataProviderUrl.Text = tempUrl.Contains(dataProvider.ToLower()) && !string.IsNullOrEmpty(tempUrl) ? tempUrl : string.Empty;
+ txtDataProviderUrl.Text = secondaryDataSourceUrl.Contains(dataProvider.ToLower()) && !string.IsNullOrEmpty(secondaryDataSourceUrl) ? secondaryDataSourceUrl : string.Empty;
_tooltip.SetToolTip(btnDataProviderSearch, $"Search for {_metadata.Title} on {dataProvider}.");
var dataSource = (SecondaryDataSourceFactory.Enum) Enum.Parse(typeof(SecondaryDataSourceFactory.Enum), dataProvider);


message: Update page count parse on Amazon.

diff:
@@ -16,7 +16,7 @@ public class AmazonInfoParser : IAmazonInfoParser
private readonly ILogger _logger;
private readonly IHttpClient _httpClient;
- private readonly Regex _numbersRegex = new(@"(\d+)", RegexOptions.Compiled);
+ private readonly Regex _numbersRegex = new(@"(\d+|\d{1,3}([,\.]\d{3})*)(?=\s)", RegexOptions.Compiled);
private readonly Regex _regex404 = new(@"(cs_404_logo|cs_404_link)", RegexOptions.Compiled);
public AmazonInfoParser(ILogger logger, IHttpClient httpClient)
@@ -176,6 +176,18 @@ public InfoResponse ParseAmazonDocument(HtmlDocument bookDoc)
response.Pages = int.Parse(match.Value);
}
+ if (pagesNode == null)
+ {
+ pagesNode = bookDoc.DocumentNode.SelectSingleNode("//*[@id='detailBullets_feature_div']/ul");
+ var lengthNode = pagesNode?.SelectSingleNode(".//span[contains(text(),'pages')]");
+ if (lengthNode != null)
+ {
+ var match = _numbersRegex.Match(lengthNode.InnerText);
+ if (match.Success)
+ response.Pages = int.Parse(match.Value);
+ }
+ }
+
#endregion
return response;

original_message: Update page count parse on Amazon.


message:
Fix End Actions not calculating reading time from curBook.PageCount.
Refactor reading time to a function.
Ignore zero or null popular highlights.
Dispose preview forms so text is rest on next display.

diff:
@@ -250,35 +250,13 @@ public override async Task<bool> GetPageCountAsync(BookInfo curBook, Cancellatio
var minutes = int.Parse(match.Groups[1].Value, NumberStyles.AllowThousands) * 1.098507462686567;
var span = TimeSpan.FromMinutes(minutes);
-
- var d = PluralUtil.Pluralize($"{span.Days:day}");
- var h = PluralUtil.Pluralize($"{span.Hours:hour}");
- var m = PluralUtil.Pluralize($"{span.Minutes:minute}");
var p = match.Groups["pages"].Value;
curBook.PageCount = int.Parse(p, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
curBook.ReadingHours = span.Hours;
curBook.ReadingMinutes = span.Minutes;
- // todo clean up this section
- if (span.Days > 1)
- {
- _logger.Log($"Typical time to read: {d}, {h}, and {m} ({p} pages)");
- return true;
- }
-
- if (span.Hours > 1)
- {
- _logger.Log($"Typical time to read: {h}, and {m} ({p} pages)");
- return true;
- }
-
- if (span.Minutes <= 1)
- {
- _logger.Log($"Typical time to read: {m} ({p} pages)");
- return true;
- }
-
+ _logger.Log(Functions.GetReadingTime(curBook));
return true;
}

diff:
using HtmlAgilityPack;
using JetBrains.Annotations;
using XRayBuilder.Core.DataSources.Secondary.Model;
+using XRayBuilder.Core.Libraries;
using XRayBuilder.Core.Libraries.Http;
using XRayBuilder.Core.Libraries.Logging;
using XRayBuilder.Core.Libraries.Progress;
@@ -107,10 +108,10 @@ public override async Task<bool> GetPageCountAsync(BookInfo curBook, Cancellatio
{
var minutes = int.Parse(match1.Groups[1].Value, NumberStyles.AllowThousands) * 1.098507462686567;
var span = TimeSpan.FromMinutes(minutes);
- _logger.Log(string.Format("Typical time to read: {0} hours and {1} minutes ({2} pages)", span.Hours, span.Minutes, match1.Groups[1].Value));
curBook.PageCount = int.Parse(match1.Groups[1].Value);
curBook.ReadingHours = span.Hours;
curBook.ReadingMinutes = span.Minutes;
+ _logger.Log(Functions.GetReadingTime(curBook));
return true;
}
return false;

diff:
@@ -316,7 +316,7 @@ public sealed class DataJson
[JsonProperty("welcomeText")]
public WelcomeText WelcomeText { get; set; }
- [JsonProperty("popularHighlightsText")]
+ [JsonProperty("popularHighlightsText", NullValueHandling = NullValueHandling.Ignore)]
public PopularHighlightsText PopularHighlightsText { get; set; }
[JsonProperty("grokShelfInfo")]

diff:
@@ -383,6 +383,9 @@ async Task<BookInfo> FromApOrSearch(BookInfo book, CancellationToken ct)
}
try
+ {
+ var readingTimeFromPageCount = Functions.GetReadingTime(curBook);
+ if (string.IsNullOrEmpty(readingTimeFromPageCount))
{
if (!await dataSource.GetPageCountAsync(curBook, cancellationToken))
{
@@ -399,6 +402,9 @@ async Task<BookInfo> FromApOrSearch(BookInfo book, CancellationToken ct)
_logger.Log($"No page count found on {dataSource.Name} or in metadata");
}
}
+ else
+ _logger.Log(readingTimeFromPageCount);
+ }
catch (Exception ex)
{
_logger.Log($"An error occurred while searching for or estimating the page count: {ex.Message}\r\n{ex.StackTrace}");

diff:
@@ -70,8 +70,15 @@ public Artifacts.StartActions GenerateStartActions(BookInfo curBook, AuthorProfi
}
};
startActions.Data.AuthorSubscriptions = startActions.Data.FollowSubscriptions;
- startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMPASSAGES%", $"{curBook.NotableClips?.Count ?? 0}");
- startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMHIGHLIGHTS%", $"{curBook.NotableClips?.Sum(c => c.Likes) ?? 0}");
+ if (curBook.NotableClips == null || curBook.NotableClips?.Count == 0)
+ {
+ startActions.Data.PopularHighlightsText = null;
+ }
+ else
+ {
+ startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMPASSAGES%", $"{curBook.NotableClips?.Count}");
+ startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMHIGHLIGHTS%", $"{curBook.NotableClips?.Sum(c => c.Likes)}");
+ }
startActions.Data.GrokShelfInfo.Asin = curBook.Asin;
startActions.Data.GrokShelfInfo.IsAutoshelvingEnabled = true;

diff:
using System.Text.RegularExpressions;
using HtmlAgilityPack;
using JetBrains.Annotations;
+using XRayBuilder.Core.Libraries.Language.Pluralization;
using XRayBuilder.Core.Model;
namespace XRayBuilder.Core.Libraries
@@ -75,6 +76,26 @@ public static string TimeStamp()
return $"Running X-Ray Builder GUI v{version}. Log started on {date} at {time}.\r\n";
}
+ public static string GetReadingTime(BookInfo bookInfo)
+ {
+ if (bookInfo.PageCount == 0)
+ return null;
+
+ var minutes = bookInfo.PageCount * 1.098507462686567;
+ var span = TimeSpan.FromMinutes(minutes);
+
+ var d = PluralUtil.Pluralize($"{span.Days:day}");
+ var h = PluralUtil.Pluralize($"{span.Hours:hour}");
+ var m = PluralUtil.Pluralize($"{span.Minutes:minute}");
+ var p = bookInfo.PageCount;
+
+ bookInfo.ReadingHours = span.Hours;
+ bookInfo.ReadingMinutes = span.Minutes;
+
+ var formatted = $"Typical time to read: {(span.Days > 1 ? $"{d}, " : string.Empty)}{(span.Hours > 1 ? $"{h}" : string.Empty)}{(span.Hours > 1 ? " and " : ", ")}{(span.Minutes > 1 ? $"{m}" : string.Empty)} ({p} pages)";
+ return formatted.StartsWith(", ") ? formatted.Substring(2, formatted.Length) : formatted;
+ }
+
public static string GetPageCount(string rawMl, BookInfo bookInfo)
{
string output;
@@ -113,8 +134,7 @@ public static string GetPageCount(string rawMl, BookInfo bookInfo)
bookInfo.PageCount = pageCount;
bookInfo.ReadingHours = span.Hours;
bookInfo.ReadingMinutes = span.Minutes;
- output = $"Typical time to read: {span.Hours} hours and {span.Minutes} minutes ({bookInfo.PageCount} pages)";
- return output;
+ return GetReadingTime(bookInfo);
}
public static void RunNotepad(string filename)

diff:
@@ -118,7 +118,7 @@ private void InitializeComponent()
//
// frmPreviewAP
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(657, 556);
this.Controls.Add(this.dgvOtherBooks);
@@ -136,6 +136,7 @@ private void InitializeComponent()
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Abouth [author]";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmPreviewAP_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.pbAuthorImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvOtherBooks)).EndInit();
this.ResumeLayout(false);

diff:
@@ -52,5 +52,10 @@ public new void ShowDialog()
{
base.ShowDialog();
}
+
+ private void frmPreviewAP_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ Dispose();
+ }
}
}

diff:
@@ -128,7 +128,7 @@ private void InitializeComponent()
this.lblFollowAuthor.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblFollowAuthor.Location = new System.Drawing.Point(13, 78);
this.lblFollowAuthor.Name = "lblFollowAuthor";
- this.lblFollowAuthor.Size = new System.Drawing.Size(132, 20);
+ this.lblFollowAuthor.Size = new System.Drawing.Size(102, 15);
this.lblFollowAuthor.TabIndex = 79;
this.lblFollowAuthor.Text = "Follow the Author";
this.lblFollowAuthor.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -168,7 +168,7 @@ private void InitializeComponent()
this.lblYourRating.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblYourRating.Location = new System.Drawing.Point(13, 12);
this.lblYourRating.Name = "lblYourRating";
- this.lblYourRating.Size = new System.Drawing.Size(171, 20);
+ this.lblYourRating.Size = new System.Drawing.Size(133, 15);
this.lblYourRating.TabIndex = 75;
this.lblYourRating.Text = "Your Rating on Amazon";
this.lblYourRating.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -205,7 +205,7 @@ private void InitializeComponent()
this.lblCustomersWhoBoughtRecs.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCustomersWhoBoughtRecs.Location = new System.Drawing.Point(13, 228);
this.lblCustomersWhoBoughtRecs.Name = "lblCustomersWhoBoughtRecs";
- this.lblCustomersWhoBoughtRecs.Size = new System.Drawing.Size(319, 20);
+ this.lblCustomersWhoBoughtRecs.Size = new System.Drawing.Size(249, 15);
this.lblCustomersWhoBoughtRecs.TabIndex = 71;
this.lblCustomersWhoBoughtRecs.Text = "Customers who bought this book also bought";
this.lblCustomersWhoBoughtRecs.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -236,7 +236,7 @@ private void InitializeComponent()
this.lblNextInSeries.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblNextInSeries.Location = new System.Drawing.Point(408, 12);
this.lblNextInSeries.Name = "lblNextInSeries";
- this.lblNextInSeries.Size = new System.Drawing.Size(101, 20);
+ this.lblNextInSeries.Size = new System.Drawing.Size(77, 15);
this.lblNextInSeries.TabIndex = 68;
this.lblNextInSeries.Text = "Next in series";
this.lblNextInSeries.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -253,7 +253,7 @@ private void InitializeComponent()
//
// frmPreviewEA
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(809, 482);
this.Controls.Add(this.pictureBox2);
@@ -284,6 +284,7 @@ private void InitializeComponent()
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Before You Go...";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmPreviewEA_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbAuthor)).EndInit();

diff:
@@ -158,5 +158,10 @@ private void btnFollow_Click(object sender, EventArgs e)
if (string.IsNullOrEmpty(_authorUrl)) return;
Process.Start(_authorUrl);
}
+
+ private void frmPreviewEA_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ Dispose();
+ }
}
}
\ No newline at end of file

diff:
@@ -101,7 +101,7 @@ private void InitializeComponent()
this.lblHighlightsCount.Name = "lblHighlightsCount";
this.lblHighlightsCount.Size = new System.Drawing.Size(415, 15);
this.lblHighlightsCount.TabIndex = 77;
- this.lblHighlightsCount.Text = "No popular highlight information available";
+ this.lblHighlightsCount.Text = "n passages have been highlighten n times";
//
// lblBiography
//
@@ -378,6 +378,7 @@ private void InitializeComponent()
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About This Book";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmPreviewSA_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbRating)).EndInit();

diff:
@@ -95,7 +95,7 @@ private void InitializeComponent()
this.tbTerms.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tbTerms.Name = "tbTerms";
this.tbTerms.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.tbTerms.Size = new System.Drawing.Size(496, 602);
+ this.tbTerms.Size = new System.Drawing.Size(496, 579);
this.tbTerms.TabIndex = 2;
this.tbTerms.Text = "TERMS";
this.tbTerms.UseVisualStyleBackColor = true;
@@ -107,7 +107,7 @@ private void InitializeComponent()
this.pTerms.Location = new System.Drawing.Point(4, 5);
this.pTerms.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pTerms.Name = "pTerms";
- this.pTerms.Size = new System.Drawing.Size(488, 592);
+ this.pTerms.Size = new System.Drawing.Size(488, 569);
this.pTerms.TabIndex = 0;
//
// flpTerms
@@ -116,12 +116,12 @@ private void InitializeComponent()
this.flpTerms.Dock = System.Windows.Forms.DockStyle.Fill;
this.flpTerms.Location = new System.Drawing.Point(0, 0);
this.flpTerms.Name = "flpTerms";
- this.flpTerms.Size = new System.Drawing.Size(488, 592);
+ this.flpTerms.Size = new System.Drawing.Size(488, 569);
this.flpTerms.TabIndex = 2;
//
// frmPreviewXR
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(508, 625);
this.Controls.Add(this.tcXray);
@@ -134,6 +134,7 @@ private void InitializeComponent()
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "X-Ray";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmPreviewXR_FormClosing);
this.tcXray.ResumeLayout(false);
this.tpPeople.ResumeLayout(false);
this.pPeople.ResumeLayout(false);

diff:
@@ -60,5 +60,10 @@ private void flpPeople_Scroll(object sender, ScrollEventArgs e)
{
flpPeople.VerticalScroll.Value = e.NewValue;
}
+
+ private void frmPreviewXR_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ Dispose();
+ }
}
}


message:
Fix for interface being cleared when open book dialog cancelled, or same book selected.
Clear txtXMLFile when new book opened.
Minor position change to txtNotInSeries.Location on End Action preview form.

diff:
@@ -126,7 +126,7 @@ public async Task Populate(string inputFile, CancellationToken cancellationToken
lblNextAuthor.Visible = false;
linkStore.Visible = false;
- txtNotInSeries.Location = new Point(471, 55);
+ txtNotInSeries.Location = new Point(457, 63);
txtNotInSeries.Visible = true;
}

diff:
@@ -151,7 +151,10 @@ private void ToggleInterface(bool enabled)
private void btnBrowseMobi_Click(object sender, EventArgs e)
{
- txtMobi.Text = UIFunctions.GetBook("");
+ var file = UIFunctions.GetBook("");
+ if (string.IsNullOrEmpty(file) || txtMobi.Text.Equals(file))
+ return;
+ txtMobi.Text = file;
}
private void btnBrowseXML_Click(object sender, EventArgs e)
@@ -1002,6 +1005,7 @@ private void ClearInterface(bool bookOpened)
txtTitle.Text = "";
txtAuthor.Text = "";
txtAsin.Text = "";
+ txtXMLFile.Text = "";
// todo another copy
txtDatasource.Text = "Search datasource...";
prgBar.Value = 0;


message:
Fix Start action preview when book is not part of a series.
Remove unused records button from folder browser drop down.
Update folder browser button tooltip.
Don't duplicate log when searching for biography.

diff:
@@ -19,7 +19,7 @@ namespace XRayBuilderGUI.Localization.Main {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class MainStrings {
@@ -567,15 +567,6 @@ internal class MainStrings {
}
}
- /// <summary>
- /// Looks up a localized string similar to E-book.
- /// </summary>
- internal static string Ebook {
- get {
- return ResourceManager.GetString("Ebook", resourceCulture);
- }
- }
-
/// <summary>
/// Looks up a localized string similar to E-book Processing.
/// </summary>
@@ -1276,7 +1267,7 @@ internal class MainStrings {
}
/// <summary>
- /// Looks up a localized string similar to Open the default output directory..
+ /// Looks up a localized string similar to Open a folder in the program directory..
/// </summary>
internal static string OpenOutputDirectory {
get {
@@ -1393,7 +1384,7 @@ internal class MainStrings {
}
/// <summary>
- /// Looks up a localized string similar to Both Real and Pen names are required for End Actions file creation..
+ /// Looks up a localized string similar to Both "real" and "pen" names are required for End Actions file creation..
/// </summary>
internal static string PenNamesRequired {
get {

diff:
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
- <xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
@@ -451,7 +451,7 @@ Do you wish to continue?</value>
<value>Open a Kindle e-book.</value>
</data>
<data name="OpenOutputDirectory" xml:space="preserve">
- <value>Open the default output directory.</value>
+ <value>Open a folder in the program directory.</value>
</data>
<data name="XRay" xml:space="preserve">
<value>X-Ray</value>

diff:
@@ -80,7 +80,6 @@ private void InitializeComponent()
this.btnBrowseDump = new System.Windows.Forms.ToolStripMenuItem();
this.btnBrowseAliasesAndChapters = new System.Windows.Forms.ToolStripMenuItem();
this.btnBrowseLogs = new System.Windows.Forms.ToolStripMenuItem();
- this.btnBrowseRecords = new System.Windows.Forms.ToolStripMenuItem();
this.btnBrowseTemp = new System.Windows.Forms.ToolStripMenuItem();
this.btnBrowseXmlFolder = new System.Windows.Forms.ToolStripMenuItem();
this.btnSettings = new System.Windows.Forms.ToolStripButton();
@@ -641,7 +640,6 @@ private void InitializeComponent()
this.btnBrowseDump,
this.btnBrowseAliasesAndChapters,
this.btnBrowseLogs,
- this.btnBrowseRecords,
this.btnBrowseTemp,
this.btnBrowseXmlFolder});
this.btnBrowseFolders.Image = ((System.Drawing.Image)(resources.GetObject("btnBrowseFolders.Image")));
@@ -688,13 +686,6 @@ private void InitializeComponent()
this.btnBrowseLogs.Text = "Logs";
this.btnBrowseLogs.Click += new System.EventHandler(this.btnBrowseLogs_Click);
//
- // btnBrowseRecords
- //
- this.btnBrowseRecords.Name = "btnBrowseRecords";
- this.btnBrowseRecords.Size = new System.Drawing.Size(180, 22);
- this.btnBrowseRecords.Text = "Records";
- this.btnBrowseRecords.Click += new System.EventHandler(this.btnBrowseRecords_Click);
- //
// btnBrowseTemp
//
this.btnBrowseTemp.Name = "btnBrowseTemp";
@@ -992,7 +983,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem btnBrowseDump;
private System.Windows.Forms.ToolStripMenuItem btnBrowseAliasesAndChapters;
private System.Windows.Forms.ToolStripMenuItem btnBrowseLogs;
- private System.Windows.Forms.ToolStripMenuItem btnBrowseRecords;
private System.Windows.Forms.ToolStripMenuItem btnBrowseTemp;
private System.Windows.Forms.ToolStripMenuItem btnBrowseXmlFolder;
private System.Windows.Forms.ToolStripButton btnSettings;

diff:
@@ -853,7 +853,7 @@ private void Form1_Load(object sender, EventArgs e)
// TODO: Maybe do something about these paths
// TODO: ExtLoader or something?
- foreach (var dir in new [] { "out", "log", "dmp", "tmp", "ext", "rec" })
+ foreach (var dir in new [] { "out", "log", "dmp", "tmp", "ext" })
Directory.CreateDirectory($"{Environment.CurrentDirectory}\\{dir}");
if (_settings.outDir == "")
@@ -1317,11 +1317,6 @@ private void btnBrowseLogs_Click(object sender, EventArgs e)
UIFunctions.OpenDirectory($@"{Environment.CurrentDirectory}\log");
}
- private void btnBrowseRecords_Click(object sender, EventArgs e)
- {
- UIFunctions.OpenDirectory($@"{Environment.CurrentDirectory}\rec");
- }
-
private void btnBrowseTemp_Click(object sender, EventArgs e)
{
UIFunctions.OpenDirectory($@"{Environment.CurrentDirectory}\tmp");


message: Use notable clip count if there are no likes.

diff:
@@ -70,15 +70,19 @@ public Artifacts.StartActions GenerateStartActions(BookInfo curBook, AuthorProfi
}
};
startActions.Data.AuthorSubscriptions = startActions.Data.FollowSubscriptions;
+
if (curBook.NotableClips == null || curBook.NotableClips?.Count == 0)
- {
startActions.Data.PopularHighlightsText = null;
- }
else
{
+ var likes = curBook.NotableClips?.Sum(c => c.Likes);
+ if (likes == 0)
+ likes = curBook.NotableClips?.Count;
+
startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMPASSAGES%", $"{curBook.NotableClips?.Count}");
- startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMHIGHLIGHTS%", $"{curBook.NotableClips?.Sum(c => c.Likes)}");
+ startActions.Data.PopularHighlightsText.LocalizedText.Replace("%NUMHIGHLIGHTS%", $"{likes}");
}
+
startActions.Data.GrokShelfInfo.Asin = curBook.Asin;
startActions.Data.GrokShelfInfo.IsAutoshelvingEnabled = true;