a cui si levano i DIV interni.
+ try {
+ nodes = root.SelectNodes("//div[@class='testoracc']");
+ foreach (HtmlNode nd in nodes) {
+ foreach (HtmlNode n in nd.ChildNodes) {
+ if (n.Name.ToUpper() == "#TEXT") { rac.Trama += cTools.FormattaTesto(n.InnerText.Trim(), false); }
+ if (n.Name.ToUpper() == "BR") { rac.Trama += "\r"; }
+ if (n.Name.ToUpper() == "DIV") {; }
+ }
+ }
+ } catch (Exception ex) { Logger.Error(string.Format("Fallita estrazione Trama dal file {0}\r\n{1}", FileName, ex.Message)); return null; }
+ #endregion
+
+ #region Voto: --> Sempre "Non Letto"
+ rac.Voto = "Non Letto";
+ #endregion
+
+ #region Notes: --> SrcFile - Nome del file che si analizza
+ rac.Notes = new List
();
+ rac.Notes.Add(new Data.cNota("SrcFile", System.IO.Path.GetFileName(FileName)));
+ #endregion
+
+ // Formalizzo esito estrazione:
+ if (!rac.Validate()) {
+ rac = null;
+ }
+
+ } catch (Exception ex) {
+ Logger.Error($"A69 - Import Error - {FileName}: {ex.Message}");
+ Console.WriteLine($"A69 - Import Error - {FileName}: {ex.Message}");
+ return null;
+ }
+ return rac;
+ }
protected virtual void Format_Insert_Tags(Data.cRac rac, List items) {
// Per ora riporto tutti i tag rilevati, mentre in futuro dovrò:
diff --git a/Src/A69WD/Net/iLink.cs b/Src/A69WD/Net/iLink.cs
index 19799e8..59da2de 100644
--- a/Src/A69WD/Net/iLink.cs
+++ b/Src/A69WD/Net/iLink.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using A69WD.Data;
+using HtmlAgilityPack;
+
namespace A69WD.Net {
@@ -42,6 +45,8 @@ namespace A69WD.Net {
eLinkState Status { get; set; }
+ cRac EstraiRac(HtmlDocument doc);
+
}//interface iLink
}//namespace A69WD.Net
diff --git a/Src/A69WD/Properties/AssemblyInfo.cs b/Src/A69WD/Properties/AssemblyInfo.cs
index 983fffc..2d7310d 100644
--- a/Src/A69WD/Properties/AssemblyInfo.cs
+++ b/Src/A69WD/Properties/AssemblyInfo.cs
@@ -32,8 +32,24 @@ using System.Runtime.InteropServices;
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.4.6.0")]
-[assembly: AssemblyFileVersion("0.4.6.0")]
+[assembly: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("0.5.0.0")]
+
+
+/*
+ *
+ * Vrs 0.5.0.0
+ *
+ * Compilata da CSiCoAlm il 2025/12/29
+ * Inserito reader basilare (solo lettura, navigazione random o sequenziale)
+ * Integrato import e skraping sul reader
+ *
+ * ToDo:
+ * - Aggiungere gestione parallela della FIFO secondo vecchi modello per aumentare il feedback alla UI
+ * - Inserire anche l'estrazione dei racconti
+ * - Inserire funzionalità avanzate sul lettore
+ *
+ */
/*
diff --git a/Src/A69WD/Site/cSite_A69.cs b/Src/A69WD/Site/cSite_A69.cs
index 5d2a816..4601ae9 100644
--- a/Src/A69WD/Site/cSite_A69.cs
+++ b/Src/A69WD/Site/cSite_A69.cs
@@ -5,6 +5,7 @@ using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
+using A69WD.Data;
using A69WD.Net;
using HtmlAgilityPack;
@@ -239,6 +240,17 @@ namespace A69WD.Site {
}
#endregion
+ #region Estraggo il racconto dal file e lo inserisco nel DB
+ if (lk.FileName.StartsWith("A69_")) {
+ // Link ad un racconto
+ cRac rac = lk.EstraiRac(tdoc);
+ if (rac != null) {
+ // Racconto estratto correttamente, lo salvo sul DB
+ App.DB.ImportRac(rac);
+ }
+ }
+ #endregion
+
lk.Status = eLinkState.End;
App.DB.LinkLog(lk);
}
diff --git a/Src/A69WD/UI/frmDownloader.Designer.cs b/Src/A69WD/UI/frmDownloader.Designer.cs
deleted file mode 100644
index 2c1e625..0000000
--- a/Src/A69WD/UI/frmDownloader.Designer.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-namespace A69WD {
- partial class frmDownloader {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing) {
- if (disposing && (components != null)) {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent() {
- this.btnClose = new System.Windows.Forms.Button();
- this.btnDownloadAll = new System.Windows.Forms.Button();
- this.lblST = new System.Windows.Forms.Label();
- this.btnImportLinks = new System.Windows.Forms.Button();
- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- this.btnShowLog = new System.Windows.Forms.Button();
- this.pbST = new System.Windows.Forms.ProgressBar();
- this.btnImport = new System.Windows.Forms.Button();
- this.btnTest = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // btnClose
- //
- this.btnClose.Location = new System.Drawing.Point(348, 12);
- this.btnClose.Name = "btnClose";
- this.btnClose.Size = new System.Drawing.Size(79, 33);
- this.btnClose.TabIndex = 14;
- this.btnClose.Text = "Close";
- this.btnClose.UseVisualStyleBackColor = true;
- this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
- //
- // btnDownloadAll
- //
- this.btnDownloadAll.Location = new System.Drawing.Point(12, 12);
- this.btnDownloadAll.Name = "btnDownloadAll";
- this.btnDownloadAll.Size = new System.Drawing.Size(79, 33);
- this.btnDownloadAll.TabIndex = 11;
- this.btnDownloadAll.Text = "Start A69";
- this.btnDownloadAll.UseVisualStyleBackColor = true;
- this.btnDownloadAll.Click += new System.EventHandler(this.btnDownloadAll_Click);
- //
- // lblST
- //
- this.lblST.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.lblST.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.lblST.Location = new System.Drawing.Point(0, 73);
- this.lblST.Name = "lblST";
- this.lblST.Size = new System.Drawing.Size(433, 22);
- this.lblST.TabIndex = 9;
- this.lblST.Text = "Status";
- this.lblST.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // btnImportLinks
- //
- this.btnImportLinks.Enabled = false;
- this.btnImportLinks.Location = new System.Drawing.Point(97, 12);
- this.btnImportLinks.Name = "btnImportLinks";
- this.btnImportLinks.Size = new System.Drawing.Size(79, 33);
- this.btnImportLinks.TabIndex = 15;
- this.btnImportLinks.Text = "From DB";
- this.btnImportLinks.UseVisualStyleBackColor = true;
- this.btnImportLinks.Click += new System.EventHandler(this.btnImportLinks_Click);
- //
- // openFileDialog1
- //
- this.openFileDialog1.FileName = "openFileDialog1";
- this.openFileDialog1.Filter = "File Testo|*.tes|Tutti i file|*.*";
- //
- // btnShowLog
- //
- this.btnShowLog.Location = new System.Drawing.Point(263, 12);
- this.btnShowLog.Name = "btnShowLog";
- this.btnShowLog.Size = new System.Drawing.Size(79, 33);
- this.btnShowLog.TabIndex = 17;
- this.btnShowLog.Text = "Show Log";
- this.btnShowLog.UseVisualStyleBackColor = true;
- this.btnShowLog.Click += new System.EventHandler(this.btnShowLog_Click);
- //
- // pbST
- //
- this.pbST.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.pbST.Location = new System.Drawing.Point(0, 55);
- this.pbST.Name = "pbST";
- this.pbST.Size = new System.Drawing.Size(433, 18);
- this.pbST.TabIndex = 18;
- //
- // btnImport
- //
- this.btnImport.Location = new System.Drawing.Point(182, 12);
- this.btnImport.Name = "btnImport";
- this.btnImport.Size = new System.Drawing.Size(79, 33);
- this.btnImport.TabIndex = 19;
- this.btnImport.Text = "Import Rac";
- this.btnImport.UseVisualStyleBackColor = true;
- this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
- //
- // btnTest
- //
- this.btnTest.Location = new System.Drawing.Point(121, -1);
- this.btnTest.Name = "btnTest";
- this.btnTest.Size = new System.Drawing.Size(55, 33);
- this.btnTest.TabIndex = 20;
- this.btnTest.Text = "Test";
- this.btnTest.UseVisualStyleBackColor = true;
- this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
- //
- // frmDownloader
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(433, 95);
- this.Controls.Add(this.btnTest);
- this.Controls.Add(this.btnImport);
- this.Controls.Add(this.pbST);
- this.Controls.Add(this.btnShowLog);
- this.Controls.Add(this.btnImportLinks);
- this.Controls.Add(this.btnClose);
- this.Controls.Add(this.btnDownloadAll);
- this.Controls.Add(this.lblST);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.Name = "frmDownloader";
- this.Text = "frmDownloader";
- this.ResumeLayout(false);
-
- }
-
- #endregion
- private System.Windows.Forms.Button btnClose;
- private System.Windows.Forms.Button btnDownloadAll;
- private System.Windows.Forms.Label lblST;
- private System.Windows.Forms.Button btnImportLinks;
- private System.Windows.Forms.OpenFileDialog openFileDialog1;
- private System.Windows.Forms.Button btnShowLog;
- private System.Windows.Forms.ProgressBar pbST;
- private System.Windows.Forms.Button btnImport;
- private System.Windows.Forms.Button btnTest;
- }
-}
\ No newline at end of file
diff --git a/Src/A69WD/UI/frmDownloader.cs b/Src/A69WD/UI/frmDownloader.cs
deleted file mode 100644
index cc3562d..0000000
--- a/Src/A69WD/UI/frmDownloader.cs
+++ /dev/null
@@ -1,259 +0,0 @@
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using System.Diagnostics;
-using System.Threading;
-using System.Net;
-using static System.Windows.Forms.LinkLabel;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
-using A69WD.Site;
-using A69WD.Net;
-using System.Collections.Concurrent;
-using System.Xml.Linq;
-using A69WD.Service;
-using A69WD.Data;
-
-namespace A69WD {
-
- public partial class frmDownloader : Form {
-
- // Coda thread-safe di URL da scaricare
- private readonly BlockingCollection _urlQueue = new BlockingCollection(new ConcurrentQueue());
-
- // Semaforo per limitare il numero massimo di download simultanei
- private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1);
-
-
-
- public frmDownloader() {
- InitializeComponent();
- this.Text = String.Format("A69WD - Dowloader Testi Vrs {0}", cTools.AssemblyVersion);
- //engine = new cA69Engine();
- //engine.Updating += Engine_Updating;
- }
-
- //cA69Engine engine = null;
-
-
- ///
- /// Metodo per scansionare i link da un file di testo ed inserirli come da downloadare se non ci sono già
- ///
- private void btnImportLinks_Click(object sender, EventArgs e) {
- //// Chiedo il file di testo da caricare
- //lblST.Text = " ";
- //this.openFileDialog1.InitialDirectory = Cfg.Settings.PathApplicationRoot;
- //if (this.openFileDialog1.ShowDialog() == DialogResult.OK) {
- // lblST.Text = string.Format("Importati {0} link", engine.ImportLinkFromFile(openFileDialog1.FileNames[0]));
- //}
- }
-
- private async void btnDownloadAll_Click(object sender, EventArgs e) {
- btnDownloadAll.Enabled = false;
-
- // - Creo istanza del client per il sito con autenticazione:
- lblST.Text = DateTime.Now.ToString() + " - Login";
- A69WD.Site.iSiteType siteA69 = new cSite_A69();
- // - Eseguo l'autenticazione
- bool res = await siteA69.Authenticate();
- if (res) {
- lblST.Text = DateTime.Now.ToString() + " - sito loggato: " + res.ToString();
- Logger.Information("Sito correttamente loggato.");
- } else {
- Logger.Information("Errore di autenticazione al sito.");
- return;
- }
- // - Verifico path per il download
- if (!System.IO.Directory.Exists(Cfg.Settings.PathDownloadWorking)) System.IO.Directory.CreateDirectory(Cfg.Settings.PathDownloadWorking);
- // // Test downloadando tutti i 10 primi link per categoria
- // List links = cLink_A69.GetStartLink();
- // int i = 1;
- // foreach (iLink link in links) {
- // lblST.Text = "Start url " + link.FileName;
- // Logger.Information("Start url " + link.FileName);
- // await siteA69.CrawlPageAsync(link);
- // Logger.Information(" end url " + link.FileName);
- // i++;
- // }
-
- // // Inserisco i link iniziali sulla coda dei download:
- // if (!cLink_A69.InsertStartLink(_urlQueue)) {
- // lblST.Text = "Inserimento A69 start link fault.";
- // return;
- // }
- // lblST.Text = "In coda vi sono: " + _urlQueue.Count.ToString() + " url.";
- //
- // // Test estrazione link dal primo indice:
- // iLink link = new cLink_A69("https://www.annunci69.it/racconti-erotici/racconti_lista.php?genere=altro&pagina=1", "Idx_altro_1.html");
- // Logger.Information("Start url " + link.FileName);
- // List urls = await siteA69.CrawlPageAsync(link);
- // Logger.Information(" end url " + link.FileName + " - URL trovati: " + urls.Count.ToString("000"));
- // foreach (iLink url in urls) { _urlQueue.Add(url); }
- // lblST.Text = "In coda vi sono: " + _urlQueue.Count.ToString() + " url.";
-
-
- // Preparo il servizio
- serviceCrawler = new Service_Crawler(lblST, pbST);
- // Inserisco i link iniziali nella coda
- if (!cLink_A69.InsertStartLink(serviceCrawler)) {
- lblST.Text = "Inserimento A69 start link fault.";
- return;
- }
- // avvio il servizio
- serviceCrawler.StartWorker(siteA69);
-
-
- }
- private Service_Crawler serviceCrawler = null;
-
-
- private void btnShowLog_Click(object sender, EventArgs e) {
- cTools.ShowOnNotepad(Cfg.Settings.PathFileLogs);
- }
-
- private void btnHide_Click(object sender, EventArgs e) {
- if (MessageBox.Show("Metodo ancora da terminare, la finestra non sarà più visibile, killare il processo", "ATTENZIONE", MessageBoxButtons.OKCancel) == DialogResult.OK){
- this.Hide();
- }
- }
-
- private void btnClose_Click(object sender, EventArgs e) {
- //if (engine.Stop()) this.Close();
-
- // fermo i servizi
- if (serviceCrawler != null) serviceCrawler.StopWorker();
- if (serviceImporter != null) serviceImporter.StopWorker();
-
- this.Close();
- }
-
-
-
- #region Gestione eventi dal engine
- //
- // private void Engine_Updating(object sender, EngineEventArgs e) { EngineUpdatingStatus(e.Message, e.NTot, e.NtoDown, e.NDown); }
- //
- // delegate void EngineUpdatingStatusCallback(string Message, int NTot, int NtoDown, int NDown);
- // private void EngineUpdatingStatus(string Message, int NTot, int NtoDown, int NDown) {
- // try {
- // // InvokeRequired required compares the thread ID of the
- // // calling thread to the thread ID of the creating thread.
- // // If these threads are different, it returns true.
- // if (lblST.InvokeRequired) {
- // EngineUpdatingStatusCallback callBack = new EngineUpdatingStatusCallback(EngineUpdatingStatus);
- // this.Invoke(callBack, new object[] { Message, NTot, NtoDown, NDown });
- // } else {
- // lblST.Text = string.Format("{4} - {3} | {2} | {1} - {0}", Message, NTot, NtoDown, NDown, DateTime.Now.ToString("HH:mm:ss"));
- // Logger.Information(lblST.Text);
- // }
- // } catch (Exception ex) {
- // Logger.Log(new object[] { "Error Code: ER05553", "Errore in EngineUpdatingStatus():", ex });
- // }
- // }
- //
- #endregion
-
- private void btnImport_Click(object sender, EventArgs e) {
- // string fp = "C:\\Commesse\\_zPrivate\\A69WD\\Test\\Down\\__A69_altro_Collarini-e-fantasie_166756.html";
- // cLink_A69 lk = new cLink_A69("Tmp", "tmp");
- // cRac rac = await lk.EstraiRac(fp);
- // if (rac != null) {
- // //foreach (string tag in rac.Tags) {
- // for (int i = 0; i
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
\ No newline at end of file
diff --git a/Src/A69WD/UI/frmReader.cs b/Src/A69WD/UI/frmReader.cs
index 02154d4..2152825 100644
--- a/Src/A69WD/UI/frmReader.cs
+++ b/Src/A69WD/UI/frmReader.cs
@@ -682,10 +682,10 @@ namespace A69WD.UI {
// - Eseguo l'autenticazione
bool res = await siteA69.Authenticate();
if (res) {
- sbStatusLabel.Text = "sito loggato: " + res.ToString();
- Logger.Information("A69 logged");
+ sbStatusLabel.Text = "A69 logged";
+ Logger.Information("Sito A69 loggato: " + res.ToString());
} else {
- Logger.Information("Errore di autenticazione al sito A69.");
+ Logger.Information("Login Fault");
return;
}