added separate option for max favorites threads. previously using max download threads.

This commit is contained in:
dazedcat19 2020-09-10 10:55:22 +08:00
parent 1d4f0be0d5
commit dcc451bc50
16 changed files with 127 additions and 43 deletions

View File

@ -126,10 +126,11 @@ var
OptionJPEGQuality: Integer = 80;
// connections
OptionConnectionTimeout: Integer = 30;
OptionMaxFavoriteThreads: Integer = 1;
OptionMaxParallel: Integer = 1;
OptionMaxThreads: Integer = 1;
OptionMaxRetry: Integer = 5;
OptionConnectionTimeout: Integer = 30;
OptionRetryFailedTask: Integer = 1;
OptionAlwaysStartTaskFromFailedChapters: Boolean = True;
OptionEnableCloudflareBypass: Boolean = True;

View File

@ -388,7 +388,7 @@ begin
if FavoriteInfo.Module = nil then
Status := STATUS_IDLE
else
if (Threads.Count < OptionMaxThreads) then
if (Threads.Count < OptionMaxFavoriteThreads) then
begin
EnterCriticalsection(CS_Threads);
try
@ -419,17 +419,17 @@ begin
try
while not Terminated do
begin
cmaxthreads := OptionMaxThreads;
cmaxthreads := OptionMaxFavoriteThreads;
// if current thread count > max Threads allowed we wait until thread count decreased
while (not Terminated) and (Threads.Count >= cmaxthreads) do
Sleep(HeartBeatRate);
Checkout;
// if there is concurent connection limit applied and no more possible item to check
// we will wait until thread count decreased
// break wait if OptionMaxThreads changed
// break wait if OptionMaxFavoriteThreads changed
cthread := Threads.Count;
while (not Terminated) and (Threads.Count > 0) and (Threads.Count = cthread) and
(cmaxthreads = OptionMaxThreads) do
(cmaxthreads = OptionMaxFavoriteThreads) do
Sleep(HeartBeatRate);
// if there is no more item need to be checked, but thread count still > 0 we will wait for it
// we will also wait if there is new item pushed, so we will check it after it

View File

@ -1713,6 +1713,10 @@ msgstr ""
"Note:\n"
"Manga Ordnername muss mindest %MANGA% haben."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Anzahl von Downloads zur selben Zeit"

View File

@ -1756,6 +1756,10 @@ msgstr ""
"Σημείωση:\n"
"Το όνομα φακέλου Manga πρέπει να έχει τουλάχιστον %MANGA%."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Αριθμός ταυτόχρονων εργασιών λήψης"

View File

@ -1711,6 +1711,10 @@ msgstr ""
"Note:\n"
"Manga folder name must have at least %MANGA%."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Number of downloaded tasks at the same time"

View File

@ -1713,6 +1713,10 @@ msgstr ""
"Nota:\n"
"El Nombre del la Carpeta del Manga debe tener al menos %MANGA%."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Numero de Tareas de Descargas al Mismo Tiempo"

View File

@ -1790,6 +1790,10 @@ msgstr ""
"Note :\n"
"Le nom du dossier du manga doit contenir %MANGA%"
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Nombre de tâches de téléchargement simultanées"

View File

@ -1715,6 +1715,10 @@ msgstr ""
"Catatan:\n"
"Nama direktori komik setidaknya harus memiliki %MANGA%."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Jumlah unduhan aktif pada waktu yang sama"

View File

@ -1770,6 +1770,10 @@ msgstr ""
"Notka:\n"
"Nazwa folderu z mangą musi mieć przynajmniej %MANGA%.\n"
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Ilość pobierań w tym samym czasie"

View File

@ -1602,6 +1602,10 @@ msgid ""
"Manga folder name must have at least %MANGA%."
msgstr ""
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr ""

View File

@ -1712,6 +1712,10 @@ msgstr ""
"Nota:\n"
"Nome da pasta Manga deve ter pelo menos %MANGA%."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Número de tarefas baixadas ao mesmo tempo"

View File

@ -1712,6 +1712,10 @@ msgstr ""
"Примечание:\n"
"Имя папки манги должно содержать как минимум %MANGA%."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Количество одновременно загружаемых задач"

View File

@ -1713,6 +1713,10 @@ msgstr ""
"Not:\n"
"Manga klasörü adı en azından %MANGA% içermelidir."
#: tmainform.lboptionmaxfavoritethreads.caption
msgid "Max number of favorite check at the same time"
msgstr ""
#: tmainform.lboptionmaxparallel.caption
msgid "Number of downloaded tasks at the same time"
msgstr "Eşzamanlı indirilen görev sayısı (Maks: 8)"

View File

@ -1,11 +1,11 @@
object MainForm: TMainForm
Left = 150
Height = 657
Top = 47
Left = 162
Height = 634
Top = 57
Width = 855
ActiveControl = pcMain
Caption = 'Free Manga Downloader'
ClientHeight = 657
ClientHeight = 634
ClientWidth = 855
Color = clWindow
OnClose = FormClose
@ -16,13 +16,13 @@ object MainForm: TMainForm
LCLVersion = '2.1.0.0'
object pcMain: TPageControl
Left = 2
Height = 626
Height = 603
Top = 8
Width = 853
ActivePage = tsDownload
ActivePage = tsOption
Align = alClient
ParentFont = False
TabIndex = 0
TabIndex = 3
TabOrder = 0
OnChange = pcMainChange
object tsDownload: TTabSheet
@ -2650,18 +2650,18 @@ object MainForm: TMainForm
object tsOption: TTabSheet
Caption = 'Options'
ChildSizing.TopBottomSpacing = 4
ClientHeight = 598
ClientHeight = 575
ClientWidth = 845
object pcOptions: TPageControl
Left = 0
Height = 500
Height = 477
Top = 4
Width = 845
ActivePage = tsGeneral
ActivePage = tsConnections
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
ParentFont = False
TabIndex = 0
TabIndex = 2
TabOrder = 0
object tsGeneral: TTabSheet
Caption = 'General'
@ -3115,22 +3115,22 @@ object MainForm: TMainForm
end
object tsConnections: TTabSheet
Caption = 'Connections'
ClientHeight = 472
ClientHeight = 449
ClientWidth = 837
object sbDownloadConnections: TScrollBox
Left = 0
Height = 472
Height = 449
Top = 0
Width = 837
HorzScrollBar.Page = 455
VertScrollBar.Page = 382
VertScrollBar.Page = 429
Align = alClient
BorderStyle = bsNone
ChildSizing.LeftRightSpacing = 4
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 4
ClientHeight = 472
ClientHeight = 449
ClientWidth = 837
TabOrder = 0
object cbOptionUseProxy: TCheckBox
@ -3139,7 +3139,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 4
Height = 19
Top = 246
Top = 293
Width = 72
BorderSpacing.Top = 20
Caption = 'Use proxy'
@ -3153,7 +3153,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 4
Height = 105
Top = 269
Top = 316
Width = 425
AutoSize = True
Caption = 'Proxy config'
@ -3314,10 +3314,13 @@ object MainForm: TMainForm
end
object seOptionMaxParallel: TSpinEdit
AnchorSideLeft.Control = sbDownloadConnections
AnchorSideTop.Control = seOptionMaxFavoriteThreads
AnchorSideTop.Side = asrBottom
Left = 4
Height = 23
Top = 8
Top = 82
Width = 52
BorderSpacing.Top = 12
MaxValue = 8
MinValue = 1
ParentFont = False
@ -3332,7 +3335,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 60
Height = 15
Top = 12
Top = 86
Width = 247
Caption = 'Number of downloaded tasks at the same time'
ParentColor = False
@ -3346,7 +3349,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 35
Top = 109
Width = 52
Anchors = [akTop, akLeft, akRight]
MaxValue = 32
@ -3363,7 +3366,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 60
Height = 15
Top = 39
Top = 113
Width = 286
Caption = 'Number of downloaded files per task at the same time'
ParentColor = False
@ -3377,7 +3380,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 62
Top = 136
Width = 52
Anchors = [akTop, akLeft, akRight]
MinValue = -1
@ -3392,7 +3395,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 60
Height = 15
Top = 66
Top = 140
Width = 391
Caption = 'Number of retry times if tasks have download problems (-1 = always retry)'
ParentColor = False
@ -3400,13 +3403,12 @@ object MainForm: TMainForm
end
object seOptionConnectionTimeout: TSpinEdit
AnchorSideLeft.Control = sbDownloadConnections
AnchorSideTop.Control = seOptionMaxRetry
AnchorSideTop.Side = asrBottom
AnchorSideTop.Control = sbDownloadConnections
AnchorSideRight.Control = seOptionMaxRetry
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 89
Top = 8
Width = 52
Anchors = [akTop, akLeft, akRight]
MaxValue = 300
@ -3423,7 +3425,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 60
Height = 15
Top = 93
Top = 12
Width = 161
Caption = 'Connection timeout (seconds)'
ParentColor = False
@ -3436,7 +3438,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 60
Height = 15
Top = 120
Top = 167
Width = 183
Caption = 'Number of retry times if task failed'
ParentColor = False
@ -3444,13 +3446,13 @@ object MainForm: TMainForm
end
object seOptionRetryFailedTask: TSpinEdit
AnchorSideLeft.Control = sbDownloadConnections
AnchorSideTop.Control = seOptionConnectionTimeout
AnchorSideTop.Control = seOptionMaxRetry
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = seOptionMaxRetry
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 116
Top = 163
Width = 52
Anchors = [akTop, akLeft, akRight]
ParentFont = False
@ -3464,7 +3466,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 4
Height = 19
Top = 145
Top = 192
Width = 216
BorderSpacing.Top = 6
Caption = 'Always start task from failed chapters'
@ -3478,7 +3480,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 203
Top = 250
Width = 829
Anchors = [akTop, akLeft, akRight]
TabOrder = 8
@ -3489,12 +3491,44 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 4
Height = 15
Top = 184
Top = 231
Width = 98
BorderSpacing.Top = 20
Caption = 'Default user-agent'
ParentColor = False
end
object seOptionMaxFavoriteThreads: TSpinEdit
AnchorSideLeft.Control = sbDownloadConnections
AnchorSideTop.Control = seOptionConnectionTimeout
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = seOptionMaxRetry
AnchorSideRight.Side = asrBottom
Left = 4
Height = 23
Top = 47
Width = 52
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 16
MaxValue = 32
MinValue = 1
ParentFont = False
ParentShowHint = False
TabOrder = 9
Value = 1
end
object lbOptionMaxFavoriteThreads: TLabel
AnchorSideLeft.Control = seOptionMaxFavoriteThreads
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = seOptionMaxFavoriteThreads
AnchorSideTop.Side = asrCenter
Left = 60
Height = 15
Top = 51
Width = 250
Caption = 'Max number of favorite check at the same time'
ParentColor = False
ParentFont = False
end
end
end
object tsSaveTo: TTabSheet
@ -4679,7 +4713,7 @@ object MainForm: TMainForm
object btOptionApply: TBitBtn
Left = 8
Height = 45
Top = 540
Top = 517
Width = 125
Anchors = [akLeft, akBottom]
AutoSize = True
@ -4976,7 +5010,7 @@ object MainForm: TMainForm
object sbMain: TStatusBar
Left = 0
Height = 23
Top = 634
Top = 611
Width = 855
Panels = <
item
@ -4990,7 +5024,7 @@ object MainForm: TMainForm
end
object spMainSplitter: TSplitter
Left = 0
Height = 626
Height = 603
Top = 8
Width = 2
OnMoved = spMainSplitterMoved

View File

@ -195,6 +195,7 @@
{"hash":225523060,"name":"tmainform.lboptionretryfailedtask.caption","sourcebytes":[78,117,109,98,101,114,32,111,102,32,114,101,116,114,121,32,116,105,109,101,115,32,105,102,32,116,97,115,107,32,102,97,105,108,101,100],"value":"Number of retry times if task failed"},
{"hash":168552227,"name":"tmainform.ckoptionsalwaysstarttaskfromfailedchapters.caption","sourcebytes":[65,108,119,97,121,115,32,115,116,97,114,116,32,116,97,115,107,32,102,114,111,109,32,102,97,105,108,101,100,32,99,104,97,112,116,101,114,115],"value":"Always start task from failed chapters"},
{"hash":83614548,"name":"tmainform.lboptiondefaultuseragent.caption","sourcebytes":[68,101,102,97,117,108,116,32,117,115,101,114,45,97,103,101,110,116],"value":"Default user-agent"},
{"hash":8982741,"name":"tmainform.lboptionmaxfavoritethreads.caption","sourcebytes":[77,97,120,32,110,117,109,98,101,114,32,111,102,32,102,97,118,111,114,105,116,101,32,99,104,101,99,107,32,97,116,32,116,104,101,32,115,97,109,101,32,116,105,109,101],"value":"Max number of favorite check at the same time"},
{"hash":160200703,"name":"tmainform.tssaveto.caption","sourcebytes":[83,97,118,101,32,116,111],"value":"Save to"},
{"hash":96652067,"name":"tmainform.rgoptioncompress.caption","sourcebytes":[83,97,118,101,32,100,111,119,110,108,111,97,100,101,100,32,99,104,97,112,116,101,114,115,32,97,115],"value":"Save downloaded chapters as"},
{"hash":206060487,"name":"tmainform.gboptionrenaming.caption","sourcebytes":[82,101,110,97,109,105,110,103],"value":"Renaming"},

View File

@ -94,6 +94,7 @@ type
edWebsitesSearch: TEditButton;
gbImageConversion: TGroupBox;
IconDLLeft: TImageList;
lbOptionMaxFavoriteThreads: TLabel;
lbOptionDefaultUserAgent: TLabel;
lbPNGCompressionLevel: TLabel;
lbJPEGQuality: TLabel;
@ -169,6 +170,7 @@ type
sbWebsiteOptions: TScrollBox;
btDownloadSplit: TSpeedButton;
sbGeneralSettings: TScrollBox;
seOptionMaxFavoriteThreads: TSpinEdit;
seOptionRetryFailedTask: TSpinEdit;
seJPEGQuality: TSpinEdit;
spThumb: TSplitter;
@ -5184,10 +5186,11 @@ begin
SaveDropTargetFormInformation;
// connections
WriteInteger('connections', 'ConnectionTimeout', seOptionConnectionTimeout.Value);
WriteInteger('connections', 'MaxFavoriteThreads', seOptionMaxFavoriteThreads.Value);
WriteInteger('connections', 'NumberOfTasks', seOptionMaxParallel.Value);
WriteInteger('connections', 'NumberOfThreadsPerTask', seOptionMaxThread.Value);
WriteInteger('connections', 'Retry', seOptionMaxRetry.Value);
WriteInteger('connections', 'ConnectionTimeout', seOptionConnectionTimeout.Value);
WriteInteger('connections', 'NumberOfAutoRetryFailedTask', seOptionRetryFailedTask.Value);
WriteBool('connections', 'AlwaysRetruFailedChaptersOnStart', ckOptionsAlwaysStartTaskFromFailedChapters.Checked);
if DefaultUserAgent <> UserAgentDefault then
@ -5351,12 +5354,13 @@ begin
OptionShowDownloadsTabOnNewTasks := cbOptionShowDownloadsTabOnNewTasks.Checked;
//connection
OptionConnectionTimeout := seOptionConnectionTimeout.Value;
OptionMaxFavoriteThreads := seOptionMaxFavoriteThreads.Value;
OptionMaxParallel := seOptionMaxParallel.Value;
OptionMaxThreads := seOptionMaxThread.Value;
OptionMaxRetry := seOptionMaxRetry.Value;
DLManager.RetryConnect := OptionMaxRetry;
SetDefaultRetryCountAndApply(OptionMaxRetry);
OptionConnectionTimeout := seOptionConnectionTimeout.Value;
SetDefaultTimeoutAndApply(OptionConnectionTimeout * 1000);
OptionRetryFailedTask := seOptionRetryFailedTask.Value;
OptionAlwaysStartTaskFromFailedChapters := ckOptionsAlwaysStartTaskFromFailedChapters.Checked;