Vrs 0.4.0.0

Compilata da CSiCoAlm il 2025/12/27
Gestione dell'autenticazione sul sito A69
Impostato lavoro in parallelo

ToDo:
- Aggiungere gestione parallela della FIFO secondo vecchi modello per aumentare il feedback alla UI
- Inserire anche l'estrazione dei racconti
This commit is contained in:
CSiCoAlm committed 2025-12-27 12:28:13 +01:00
1 parent 3313b6b888
commit cb54dc4d5f
7 files changed
+70 -83

No files matched your search

+6
View File
@@ -144,6 +144,12 @@ namespace A69WD {
public virtual string TextEditor { get { return textEditor; } set { textEditor = value; } } public virtual string TextEditor { get { return textEditor; } set { textEditor = value; } }
private string textEditor; private string textEditor;
/// <summary>
/// Numero di thread secondari
/// </summary>
public virtual int nThread { get { return nthread; } set { nthread = value; } }
private int nthread;
#endregion #endregion
+16 -16
View File
@@ -84,22 +84,22 @@ namespace A69WD.Net {
public static bool InsertStartLink(Service_Crawler service) { public static bool InsertStartLink(Service_Crawler service) {
//int i = 1; //string url = LinkIdxBase.Replace("{Categoria}", "altro").Replace("{ID}", "1"); //LinkIdxBase.Replace("{Categoria}", "trio").Replace("{ID}", "1");
//try { //string name = "_A69_altro_0001.html"; //"_A69_trio_0001.html";
// foreach (string cat in categorie) { //service.EnqueueUrl(new cLink_A69(url, name));
// string url = LinkIdxBase.Replace("{Categoria}", cat).Replace("{ID}", i.ToString()); //return true;
// string name = string.Format("_A69_{0}_{1}.html", cat, i.ToString("0000")); int i = 1;
// service.EnqueueUrl(new cLink_A69(url, name)); try {
// } foreach (string cat in categorie) {
// return true; string url = LinkIdxBase.Replace("{Categoria}", cat).Replace("{ID}", i.ToString());
//} catch (Exception ex) { string name = string.Format("_A69_{0}_{1}.html", cat, i.ToString("0000"));
// Logger.Error("Errore inserendo A69 Start Link - " + ex.Message); service.EnqueueUrl(new cLink_A69(url, name));
// return false; }
//} return true;
string url = LinkIdxBase.Replace("{Categoria}", "altro").Replace("{ID}", "1"); //LinkIdxBase.Replace("{Categoria}", "trio").Replace("{ID}", "1"); } catch (Exception ex) {
string name = "_A69_altro_0001.html"; //"_A69_trio_0001.html"; Logger.Error("Errore inserendo A69 Start Link - " + ex.Message);
service.EnqueueUrl(new cLink_A69(url, name)); return false;
return true; }
} }
}//class cLink_A69 }//class cLink_A69
+17 -2
View File
@@ -32,8 +32,23 @@ using System.Runtime.InteropServices;
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // È 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: // usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.1.2")] [assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.3.1.2")] [assembly: AssemblyFileVersion("0.4.0.0")]
/*
*
* Vrs 0.4.0.0
*
* Compilata da CSiCoAlm il 2025/12/27
* Gestione dell'autenticazione sul sito A69
* Impostato lavoro in parallelo
*
* ToDo:
* - Aggiungere gestione parallela della FIFO secondo vecchi modello per aumentare il feedback alla UI
* - Inserire anche l'estrazione dei racconti
*
*/
/* /*
+10 -8
View File
@@ -22,7 +22,7 @@ namespace A69WD.Service {
private readonly BlockingCollection<iLink> _urlQueue = new BlockingCollection<iLink>(new ConcurrentQueue<iLink>()); private readonly BlockingCollection<iLink> _urlQueue = new BlockingCollection<iLink>(new ConcurrentQueue<iLink>());
// Semaforo per limitare il numero massimo di download simultanei // Semaforo per limitare il numero massimo di download simultanei
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(9); private readonly SemaphoreSlim _semaphore = null;
// Contatori // Contatori
private int _inCorso = 0; private int _inCorso = 0;
@@ -33,8 +33,10 @@ namespace A69WD.Service {
private iSiteType _site; private iSiteType _site;
public Service_Crawler(Label lblInCorso) { public Service_Crawler(Label lblInCorso, ProgressBar pbStatus) {
_semaphore = new SemaphoreSlim(Cfg.Settings.nThread);
_lblInCorso = lblInCorso; _lblInCorso = lblInCorso;
_progressBar = pbStatus;
} }
@@ -47,7 +49,7 @@ namespace A69WD.Service {
//private readonly Label _lblCompletati; //private readonly Label _lblCompletati;
//private readonly Label _lblDaFare; //private readonly Label _lblDaFare;
//private readonly Label _lblErrori; //private readonly Label _lblErrori;
//private readonly ProgressBar _progressBar; private readonly ProgressBar _progressBar;
@@ -128,11 +130,11 @@ namespace A69WD.Service {
_lblInCorso.Text = $"In corso: {_inCorso} - Completati: {_completati} - Errori: {_errori} - Da fare: {daFare}"; _lblInCorso.Text = $"In corso: {_inCorso} - Completati: {_completati} - Errori: {_errori} - Da fare: {daFare}";
//int totale = _inCorso + _completati + _errori + daFare; int totale = _inCorso + _completati + _errori + daFare;
//int fatti = _completati + _errori; int fatti = _completati + _errori;
//
//_progressBar.Maximum = totale > 0 ? totale : 1; _progressBar.Maximum = totale > 0 ? totale : 1;
//_progressBar.Value = fatti; _progressBar.Value = fatti;
} }
+3
View File
@@ -19,5 +19,8 @@
<!-- Text editor per la visualizzazione dei file. --> <!-- Text editor per la visualizzazione dei file. -->
<TextEditor>C:\Program Files\Notepad++\notepad++.exe</TextEditor> <TextEditor>C:\Program Files\Notepad++\notepad++.exe</TextEditor>
<!-- Numero di thread secondari. -->
<nThread>9</nThread>
</Cfg> </Cfg>
+16 -55
View File
@@ -24,20 +24,17 @@
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.btnClose = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button();
this.btnHide = new System.Windows.Forms.Button();
this.btnDownloadAll = new System.Windows.Forms.Button(); this.btnDownloadAll = new System.Windows.Forms.Button();
this.lblST = new System.Windows.Forms.Label(); this.lblST = new System.Windows.Forms.Label();
this.btnImportLinks = new System.Windows.Forms.Button(); this.btnImportLinks = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnShowLog = new System.Windows.Forms.Button(); this.btnShowLog = new System.Windows.Forms.Button();
this.cbSoloFileIndice = new System.Windows.Forms.CheckBox(); this.pbST = new System.Windows.Forms.ProgressBar();
this.tbNumThred = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnClose // btnClose
// //
this.btnClose.Location = new System.Drawing.Point(436, 12); this.btnClose.Location = new System.Drawing.Point(263, 12);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(79, 33); this.btnClose.Size = new System.Drawing.Size(79, 33);
this.btnClose.TabIndex = 14; this.btnClose.TabIndex = 14;
@@ -45,24 +42,13 @@
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// //
// btnHide
//
this.btnHide.Location = new System.Drawing.Point(317, 19);
this.btnHide.Name = "btnHide";
this.btnHide.Size = new System.Drawing.Size(97, 33);
this.btnHide.TabIndex = 13;
this.btnHide.Text = "Hide";
this.btnHide.UseVisualStyleBackColor = true;
this.btnHide.Visible = false;
this.btnHide.Click += new System.EventHandler(this.btnHide_Click);
//
// btnDownloadAll // btnDownloadAll
// //
this.btnDownloadAll.Location = new System.Drawing.Point(12, 12); this.btnDownloadAll.Location = new System.Drawing.Point(12, 12);
this.btnDownloadAll.Name = "btnDownloadAll"; this.btnDownloadAll.Name = "btnDownloadAll";
this.btnDownloadAll.Size = new System.Drawing.Size(79, 33); this.btnDownloadAll.Size = new System.Drawing.Size(79, 33);
this.btnDownloadAll.TabIndex = 11; this.btnDownloadAll.TabIndex = 11;
this.btnDownloadAll.Text = "Download All"; this.btnDownloadAll.Text = "Start A69";
this.btnDownloadAll.UseVisualStyleBackColor = true; this.btnDownloadAll.UseVisualStyleBackColor = true;
this.btnDownloadAll.Click += new System.EventHandler(this.btnDownloadAll_Click); this.btnDownloadAll.Click += new System.EventHandler(this.btnDownloadAll_Click);
// //
@@ -70,20 +56,21 @@
// //
this.lblST.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblST.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblST.Dock = System.Windows.Forms.DockStyle.Bottom; this.lblST.Dock = System.Windows.Forms.DockStyle.Bottom;
this.lblST.Location = new System.Drawing.Point(0, 52); this.lblST.Location = new System.Drawing.Point(0, 73);
this.lblST.Name = "lblST"; this.lblST.Name = "lblST";
this.lblST.Size = new System.Drawing.Size(524, 22); this.lblST.Size = new System.Drawing.Size(352, 22);
this.lblST.TabIndex = 9; this.lblST.TabIndex = 9;
this.lblST.Text = "Status"; this.lblST.Text = "Status";
this.lblST.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblST.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// btnImportLinks // btnImportLinks
// //
this.btnImportLinks.Enabled = false;
this.btnImportLinks.Location = new System.Drawing.Point(97, 12); this.btnImportLinks.Location = new System.Drawing.Point(97, 12);
this.btnImportLinks.Name = "btnImportLinks"; this.btnImportLinks.Name = "btnImportLinks";
this.btnImportLinks.Size = new System.Drawing.Size(79, 33); this.btnImportLinks.Size = new System.Drawing.Size(79, 33);
this.btnImportLinks.TabIndex = 15; this.btnImportLinks.TabIndex = 15;
this.btnImportLinks.Text = "Import Links"; this.btnImportLinks.Text = "From DB";
this.btnImportLinks.UseVisualStyleBackColor = true; this.btnImportLinks.UseVisualStyleBackColor = true;
this.btnImportLinks.Click += new System.EventHandler(this.btnImportLinks_Click); this.btnImportLinks.Click += new System.EventHandler(this.btnImportLinks_Click);
// //
@@ -102,65 +89,39 @@
this.btnShowLog.UseVisualStyleBackColor = true; this.btnShowLog.UseVisualStyleBackColor = true;
this.btnShowLog.Click += new System.EventHandler(this.btnShowLog_Click); this.btnShowLog.Click += new System.EventHandler(this.btnShowLog_Click);
// //
// cbSoloFileIndice // pbST
// //
this.cbSoloFileIndice.AutoSize = true; this.pbST.Dock = System.Windows.Forms.DockStyle.Bottom;
this.cbSoloFileIndice.Location = new System.Drawing.Point(263, 20); this.pbST.Location = new System.Drawing.Point(0, 55);
this.cbSoloFileIndice.Name = "cbSoloFileIndice"; this.pbST.Name = "pbST";
this.cbSoloFileIndice.Size = new System.Drawing.Size(76, 17); this.pbST.Size = new System.Drawing.Size(352, 18);
this.cbSoloFileIndice.TabIndex = 18; this.pbST.TabIndex = 18;
this.cbSoloFileIndice.Text = "Solo Index";
this.cbSoloFileIndice.UseVisualStyleBackColor = true;
//
// tbNumThred
//
this.tbNumThred.Location = new System.Drawing.Point(345, 18);
this.tbNumThred.Name = "tbNumThred";
this.tbNumThred.Size = new System.Drawing.Size(22, 20);
this.tbNumThred.TabIndex = 19;
this.tbNumThred.Text = "3";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(369, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.TabIndex = 20;
this.label1.Text = "Num Thread";
// //
// frmDownloader // frmDownloader
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(524, 74); this.ClientSize = new System.Drawing.Size(352, 95);
this.Controls.Add(this.label1); this.Controls.Add(this.pbST);
this.Controls.Add(this.tbNumThred);
this.Controls.Add(this.cbSoloFileIndice);
this.Controls.Add(this.btnShowLog); this.Controls.Add(this.btnShowLog);
this.Controls.Add(this.btnImportLinks); this.Controls.Add(this.btnImportLinks);
this.Controls.Add(this.btnClose); this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnHide);
this.Controls.Add(this.btnDownloadAll); this.Controls.Add(this.btnDownloadAll);
this.Controls.Add(this.lblST); this.Controls.Add(this.lblST);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "frmDownloader"; this.Name = "frmDownloader";
this.Text = "frmDownloader"; this.Text = "frmDownloader";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnHide;
private System.Windows.Forms.Button btnDownloadAll; private System.Windows.Forms.Button btnDownloadAll;
private System.Windows.Forms.Label lblST; private System.Windows.Forms.Label lblST;
private System.Windows.Forms.Button btnImportLinks; private System.Windows.Forms.Button btnImportLinks;
private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button btnShowLog; private System.Windows.Forms.Button btnShowLog;
private System.Windows.Forms.CheckBox cbSoloFileIndice; private System.Windows.Forms.ProgressBar pbST;
private System.Windows.Forms.TextBox tbNumThred;
private System.Windows.Forms.Label label1;
} }
} }
+2 -2
View File
@@ -32,7 +32,7 @@ namespace A69WD {
public frmDownloader() { public frmDownloader() {
InitializeComponent(); InitializeComponent();
this.Text = String.Format("A69WD - Dowloader Testi Vrs {0}", cTools.AssemblyVersion); this.Text = String.Format("A69WD - Dowloader Testi Vrs {0}", cTools.AssemblyVersion);
//engine = new cA69Engine(); //engine = new cA69Engine();
//engine.Updating += Engine_Updating; //engine.Updating += Engine_Updating;
} }
@@ -99,7 +99,7 @@ namespace A69WD {
// Preparo il servizio // Preparo il servizio
service = new Service_Crawler(lblST); service = new Service_Crawler(lblST, pbST);
// Inserisco i link iniziali nella coda // Inserisco i link iniziali nella coda
if (!cLink_A69.InsertStartLink(service)) { if (!cLink_A69.InsertStartLink(service)) {
lblST.Text = "Inserimento A69 start link fault."; lblST.Text = "Inserimento A69 start link fault.";