diff --git a/OneMore/Commands/Tagging/HashtagScanner.cs b/OneMore/Commands/Tagging/HashtagScanner.cs index 1aa56031c2..240a67ae10 100644 --- a/OneMore/Commands/Tagging/HashtagScanner.cs +++ b/OneMore/Commands/Tagging/HashtagScanner.cs @@ -140,31 +140,54 @@ public void Dispose() var notebooks = root.Elements(ns + "Notebook"); if (notebooks.Any()) { + var knownNotebooks = provider.ReadKnownNotebookIDs(); + foreach (var notebook in notebooks) { // gets sections for this notebook var notebookID = notebook.Attribute("ID").Value; var name = notebook.Attribute("name").Value; - - if (notebookFilters is null || - notebookFilters.Contains(notebookID)) + var scanned = false; + + // Filter on two levels... + // + // knownNotebooks + // If knownNotebooks is empty, then we assume that this is the first scan + // and will allow all; otherwise we only scan known notebooks to avoid + // pulling in large data from newly added notebooks - user must schedule + // a scan to pull in those new notebooks explicitly. + // + // notebookFilters + // If notebookFilters is empty then allow any notebook that has passed the + // knownNotebook test; otherwise, the user has explicitly requested a scan + // of notebooks specified in the notebookFilters list. + // + + if (knownNotebooks.Count == 0 || + knownNotebooks.Contains(notebookID)) { - //logger.Verbose($"scanning notebook {notebookID} \"{name}\""); - - var sections = await one.GetNotebook(notebookID); - if (sections is not null) + if (notebookFilters is null || + notebookFilters.Contains(notebookID)) { - var (dp, tp) = await Scan(one, sections, notebookID, $"/{name}"); + //logger.Verbose($"scanning notebook {notebookID} \"{name}\""); - dirtyPages += dp; - totalPages += tp; - } + var sections = await one.GetNotebook(notebookID); + if (sections is not null) + { + var (dp, tp) = await Scan(one, sections, notebookID, $"/{name}"); - provider.WriteNotebook(notebookID, name); + dirtyPages += dp; + totalPages += tp; + } + + provider.WriteNotebook(notebookID, name); + scanned = true; + } } - else + + if (!scanned) { - //logger.Verbose($"skipping notebook {notebookID} \"{name}\""); + logger.Verbose($"skipping notebook {notebookID} \"{name}\""); } } } diff --git a/OneMore/Commands/Tagging/HashtagsDB.sql b/OneMore/Commands/Tagging/HashtagsDB.sql index 3a6b68bd08..5acd0c1973 100644 --- a/OneMore/Commands/Tagging/HashtagsDB.sql +++ b/OneMore/Commands/Tagging/HashtagsDB.sql @@ -1,7 +1,7 @@ CREATE TABLE IF NOT EXISTS hashtag_scanner (scannerID INTEGER PRIMARY KEY UNIQUE NOT NULL, version NUMERIC (12) UNIQUE NOT NULL, scanTime TEXT NOT NULL); CREATE TABLE IF NOT EXISTS hashtag (tag TEXT NOT NULL, moreID TEXT NOT NULL, objectID TEXT NOT NULL, snippet TEXT, lastModified TEXT NOT NULL, PRIMARY KEY (tag, objectID), CONSTRAINT FK_moreID FOREIGN KEY (moreID) REFERENCES hashtag_page (moreID) ON DELETE CASCADE); CREATE TABLE IF NOT EXISTS hashtag_page (moreID PRIMARY KEY, pageID TEXT NOT NULL, titleID TEXT, notebookID TEXT NOT NULL, sectionID TEXT NOT NULL, path TEXT, name TEXT); -CREATE TABLE IF NOT EXISTS hashtag_notebooks (notebookID TEXT PRIMARY KEY, name TEXT); +CREATE TABLE IF NOT EXISTS hashtag_notebook (notebookID TEXT PRIMARY KEY, name TEXT); CREATE INDEX IF NOT EXISTS IDX_moreID ON hashtag (moreID); CREATE INDEX IF NOT EXISTS IDX_pageID ON hashtag_page (pageID); CREATE INDEX IF NOT EXISTS IDX_tag ON hashtag (tag); diff --git a/OneMore/Commands/Tagging/ScheduleScanDialog.Designer.cs b/OneMore/Commands/Tagging/ScheduleScanDialog.Designer.cs index cde4ff3511..3f4c5427df 100644 --- a/OneMore/Commands/Tagging/ScheduleScanDialog.Designer.cs +++ b/OneMore/Commands/Tagging/ScheduleScanDialog.Designer.cs @@ -64,11 +64,11 @@ private void InitializeComponent() this.topPanel.Controls.Add(this.dateTimePicker); this.topPanel.Dock = System.Windows.Forms.DockStyle.Top; this.topPanel.ForeColor = System.Drawing.SystemColors.ControlText; - this.topPanel.Location = new System.Drawing.Point(0, 62); + this.topPanel.Location = new System.Drawing.Point(0, 83); this.topPanel.Margin = new System.Windows.Forms.Padding(0); this.topPanel.Name = "topPanel"; this.topPanel.Padding = new System.Windows.Forms.Padding(40, 40, 20, 20); - this.topPanel.Size = new System.Drawing.Size(693, 305); + this.topPanel.Size = new System.Drawing.Size(718, 305); this.topPanel.TabIndex = 4; // // warningLabel @@ -77,7 +77,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.warningLabel.Location = new System.Drawing.Point(70, 216); this.warningLabel.Name = "warningLabel"; - this.warningLabel.Size = new System.Drawing.Size(600, 46); + this.warningLabel.Size = new System.Drawing.Size(625, 46); this.warningLabel.TabIndex = 6; this.warningLabel.Text = "OneNote may appear sluggish while scanning. If OneNote is closed during the scan," + " it cannot be opened until the scan completes."; @@ -151,10 +151,10 @@ private void InitializeComponent() this.notebooksPanel.Controls.Add(this.sep1); this.notebooksPanel.Controls.Add(this.selectNoneLink); this.notebooksPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.notebooksPanel.Location = new System.Drawing.Point(0, 367); + this.notebooksPanel.Location = new System.Drawing.Point(0, 388); this.notebooksPanel.Name = "notebooksPanel"; this.notebooksPanel.Padding = new System.Windows.Forms.Padding(0, 0, 20, 20); - this.notebooksPanel.Size = new System.Drawing.Size(693, 281); + this.notebooksPanel.Size = new System.Drawing.Size(718, 260); this.notebooksPanel.TabIndex = 25; this.notebooksPanel.ThemedBack = "ControlLightLight"; this.notebooksPanel.ThemedFore = null; @@ -171,7 +171,7 @@ private void InitializeComponent() this.booksPanel.BottomBorderSize = 0; this.booksPanel.Location = new System.Drawing.Point(31, 46); this.booksPanel.Name = "booksPanel"; - this.booksPanel.Size = new System.Drawing.Size(631, 212); + this.booksPanel.Size = new System.Drawing.Size(656, 191); this.booksPanel.TabIndex = 21; this.booksPanel.ThemedBack = null; this.booksPanel.ThemedFore = null; @@ -182,7 +182,7 @@ private void InitializeComponent() // this.sep2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.sep2.AutoSize = true; - this.sep2.Location = new System.Drawing.Point(589, 16); + this.sep2.Location = new System.Drawing.Point(614, 16); this.sep2.Name = "sep2"; this.sep2.Size = new System.Drawing.Size(14, 20); this.sep2.TabIndex = 24; @@ -212,7 +212,7 @@ private void InitializeComponent() this.resetLink.Cursor = System.Windows.Forms.Cursors.Hand; this.resetLink.HoverColor = System.Drawing.Color.MediumOrchid; this.resetLink.LinkColor = System.Drawing.SystemColors.ControlDark; - this.resetLink.Location = new System.Drawing.Point(610, 16); + this.resetLink.Location = new System.Drawing.Point(635, 16); this.resetLink.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.resetLink.MaximumSize = new System.Drawing.Size(420, 0); this.resetLink.Name = "resetLink"; @@ -234,7 +234,7 @@ private void InitializeComponent() this.selectAllLink.Cursor = System.Windows.Forms.Cursors.Hand; this.selectAllLink.HoverColor = System.Drawing.Color.MediumOrchid; this.selectAllLink.LinkColor = System.Drawing.SystemColors.ControlDark; - this.selectAllLink.Location = new System.Drawing.Point(383, 16); + this.selectAllLink.Location = new System.Drawing.Point(408, 16); this.selectAllLink.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.selectAllLink.MaximumSize = new System.Drawing.Size(420, 0); this.selectAllLink.Name = "selectAllLink"; @@ -252,7 +252,7 @@ private void InitializeComponent() // this.sep1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.sep1.AutoSize = true; - this.sep1.Location = new System.Drawing.Point(465, 16); + this.sep1.Location = new System.Drawing.Point(490, 16); this.sep1.Name = "sep1"; this.sep1.Size = new System.Drawing.Size(14, 20); this.sep1.TabIndex = 22; @@ -268,7 +268,7 @@ private void InitializeComponent() this.selectNoneLink.Cursor = System.Windows.Forms.Cursors.Hand; this.selectNoneLink.HoverColor = System.Drawing.Color.MediumOrchid; this.selectNoneLink.LinkColor = System.Drawing.SystemColors.ControlDark; - this.selectNoneLink.Location = new System.Drawing.Point(486, 16); + this.selectNoneLink.Location = new System.Drawing.Point(511, 16); this.selectNoneLink.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.selectNoneLink.MaximumSize = new System.Drawing.Size(420, 0); this.selectNoneLink.Name = "selectNoneLink"; @@ -291,7 +291,7 @@ private void InitializeComponent() this.buttonPanel.ForeColor = System.Drawing.SystemColors.ControlText; this.buttonPanel.Location = new System.Drawing.Point(0, 648); this.buttonPanel.Name = "buttonPanel"; - this.buttonPanel.Size = new System.Drawing.Size(693, 61); + this.buttonPanel.Size = new System.Drawing.Size(718, 61); this.buttonPanel.TabIndex = 5; // // cancelButton @@ -301,7 +301,7 @@ private void InitializeComponent() this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancelButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.cancelButton.ImageOver = null; - this.cancelButton.Location = new System.Drawing.Point(566, 13); + this.cancelButton.Location = new System.Drawing.Point(591, 13); this.cancelButton.Name = "cancelButton"; this.cancelButton.ShowBorder = true; this.cancelButton.Size = new System.Drawing.Size(115, 36); @@ -319,7 +319,7 @@ private void InitializeComponent() this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; this.okButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.okButton.ImageOver = null; - this.okButton.Location = new System.Drawing.Point(445, 13); + this.okButton.Location = new System.Drawing.Point(470, 13); this.okButton.Name = "okButton"; this.okButton.ShowBorder = true; this.okButton.Size = new System.Drawing.Size(115, 36); @@ -335,8 +335,8 @@ private void InitializeComponent() this.introBox.Dock = System.Windows.Forms.DockStyle.Top; this.introBox.Location = new System.Drawing.Point(0, 0); this.introBox.Name = "introBox"; - this.introBox.Padding = new System.Windows.Forms.Padding(30, 12, 20, 12); - this.introBox.Size = new System.Drawing.Size(693, 62); + this.introBox.Padding = new System.Windows.Forms.Padding(30, 20, 20, 12); + this.introBox.Size = new System.Drawing.Size(718, 83); this.introBox.TabIndex = 11; this.introBox.Text = "The hashtag catalog has not yet been created. Choose below when OneMore should bu" + "ild the catalog."; @@ -349,7 +349,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(693, 709); + this.ClientSize = new System.Drawing.Size(718, 709); this.Controls.Add(this.notebooksPanel); this.Controls.Add(this.topPanel); this.Controls.Add(this.introBox); @@ -358,7 +358,7 @@ private void InitializeComponent() this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(715, 720); + this.MinimumSize = new System.Drawing.Size(740, 760); this.Name = "ScheduleScanDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Schedule Hashtag Scanning";