JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1721  
Old 19.05.2021, 20:50
namyar namyar is offline
Super Loader
 
Join Date: Apr 2016
Posts: 28
Question

Quote:
Originally Posted by namyar View Post
Works like a charm, thank you very much!
It seems that due to this script, links aren't always automatically transfered to the downloads tab but have to be added manually. Link crawler is set to transfer and start downloads by default, yet it fails to do so on occasion.
Reply With Quote
  #1722  
Old 26.05.2021, 13:35
sancrage sancrage is offline
Baby Loader
 
Join Date: Jul 2018
Posts: 5
Default

Hello,

Sorry to bother you, but wonder if there is a way to rename the filename to be the same as the directory when I provide the save path?

Thanks.
Reply With Quote
  #1723  
Old 26.05.2021, 14:03
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by sancrage View Post
... wonder if there is a way to rename the filename to be the same as the directory when I provide the save path?
Currently it is only possible to dynamically update/sync filename and/or downloadpath with the packagename. There is no variable or placeholder to access the save path. You will have to set the save path first and then use a script to rename the file based on it.

If however there is common logic/pattern in genrating the save path, for e.g. based on file name, download url, source url, etc., you can use packagizer rule or script to set them both at the same time.

If you provide some working examples I can look into it.
Reply With Quote
  #1724  
Old 26.05.2021, 14:07
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by namyar View Post
It seems that due to this script, links aren't always automatically transfered to the downloads tab but have to be added manually. Link crawler is set to transfer and start downloads by default, yet it fails to do so on occasion.
The script is executed even before packagizer rules are applied, so it is very unlikely that it is caused by it. In other words, the problem cannot be resolved by modifying the script.

Please wait for feedback from @Jiaz. In the meanwhile, you can try increasing the following advanced setting:
Code:
LinkgrabberSettings.autoconfirmdelay
Reply With Quote
  #1725  
Old 04.06.2021, 14:38
A-Dude A-Dude is offline
I will play nice!
 
Join Date: Jun 2021
Posts: 3
Default

Hi there,

id like a modification of this script

https://board.jdownloader.org/showpo...&postcount=881

The script restart JD just when JD is in idle, but my JD is never in idle

Is it possible that when a new update is availible, JD doesn´t start new downloads but finish current running downloads and then do the restart?
Reply With Quote
  #1726  
Old 04.06.2021, 14:41
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

Quote:
Originally Posted by A-Dude View Post
Is it possible that when a new update is availible, JD doesn´t start new downloads but finish current running downloads and then do the restart?
@mgpai: set stopmark on running download, then downloads will finish and then idle and then restart, that should work, via api
downloadsV2/setStopMark(long linkId, long packageId)
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 04.06.2021 at 14:50.
Reply With Quote
  #1727  
Old 04.06.2021, 15:26
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: set stopmark on running download, then downloads will finish and then idle and then restart, that should work, via api downloadsV2/setStopMark(long linkId, long packageId)
New downloads can still start till the link/package with stop mark is finished.
Reply With Quote
  #1728  
Old 04.06.2021, 15:27
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

Quote:
Originally Posted by mgpai View Post
New downloads can still start till the link/package with stop mark is finished.
set stopmark on disabled link and no further downloads will start, else further downloads will stop once the stopmark link is finished/failed or at least tried once
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 04.06.2021 at 15:31.
Reply With Quote
  #1729  
Old 04.06.2021, 15:49
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by Jiaz View Post
set stopmark on disabled link and no further downloads will start, else further downloads will stop once the stopmark link is finished/failed or at least tried once
Still a bit complicated since the trigger is interval. The stopmark will be set on each run. Also disabling a link just to set the stopmark is not an elegant solution. Will think of something.
Reply With Quote
  #1730  
Old 04.06.2021, 16:08
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by A-Dude View Post
Is it possible that when a new update is availible, JD doesn´t start new downloads but finish current running downloads and then do the restart?
Code:
/*
    if update is avaialble, finish running downloads and restart and update when JD is Idle
    Trigger Required: Interval
    Set Interval to 600000 or more
*/

var updateAvailable = callAPI("update", "isUpdateAvailable");

if (
    updateAvailable &&
    isDownloadControllerRunning() &&
    !getProperty("skipped", false)
) {
    getAllDownloadLinks().forEach(function(link) {
        if (!link.running && !link.finished) {
            link.skipped = true;
        }
    });

    setProperty("skipped", true, false);
}

if (
    updateAvailable &&
    !callAPI("linkcrawler", "isCrawling") &&
    !callAPI("linkgrabberv2", "isCollecting") &&
    !callAPI("extraction", "getQueue").length &&
    isDownloadControllerIdle()
) {
    callAPI("update", "restartAndUpdate");
}

Code:
/*
    if update is avaialble, finish running downloads and restart and update when JD is Idle
    Trigger Required: Interval
    Set Interval to 600000 or more
*/

var updateAvailable = callAPI("update", "isUpdateAvailable");

if (
    updateAvailable &&
    isDownloadControllerRunning() &&
    callAPI("downloadsV2", "getStopMark") == -1
) {
    callAPI("downloadsV2", "setStopMark", 0, 0);
}

if (
    updateAvailable &&
    !callAPI("linkcrawler", "isCrawling") &&
    !callAPI("linkgrabberv2", "isCollecting") &&
    !callAPI("extraction", "getQueue").length &&
    isDownloadControllerIdle()
) {
    callAPI("update", "restartAndUpdate");
}

Last edited by mgpai; 04.06.2021 at 17:40. Reason: Replaced script with one which uses new method.
Reply With Quote
  #1731  
Old 04.06.2021, 16:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: set stopmark on running download, then downloads will finish and then idle and then restart, that should work, via api downloadsV2/setStopMark(long linkId, long packageId)
This is more suitable, but difficult to control precisely, since it is toggle:
Code:
/toolbar/toggleStopAfterCurrentDownload
Reply With Quote
  #1732  
Old 04.06.2021, 16:22
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

@mgai: just set stopmark on any running download. I don't think that it's that impotant and the script will work fine again
I can also add new method to specifically set stopmark to stop new downloads instant, if you prefer that
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1733  
Old 04.06.2021, 16:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by Jiaz View Post
@mgai: just set stopmark on any running download. I don't think that it's that impotant and the script will work fine again
The default behavior stopmark of is perfectly fine and as it should be. It might not be suitable in cases like this, especially if there are many downloads above the link/package on which the stopmark is set. If for e.g. connection is lost JD will try/skip several downloads and end up starting a new download way down the list, the stopmark could be set anywhere. It will not be an issue when the user sets the stopmark manually, since it is set specifically on a chosen link/package.

Quote:
I can also add new method to specifically set stopmark to stop new downloads instant, if you prefer that
This might be a one off case, and the current solution should work just fine.
Reply With Quote
  #1734  
Old 04.06.2021, 16:49
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

@mgpai:I can add new set stopmark method that also supports the *don'T start any new downloads* handling.

after next core update new logic for setStopMark
linkID and packageID = -1 = NONE, same as removeStopMark
linkID and packageID = 0 = HIDDEN, special mode to instant stop new downloads and just finish running ones
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 04.06.2021 at 17:00.
Reply With Quote
  #1735  
Old 04.06.2021, 17:10
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by Jiaz View Post
after next core update new logic for setStopMark
Nice. Thanks Jiaz.
Reply With Quote
  #1736  
Old 04.06.2021, 17:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

Quote:
Originally Posted by mgpai View Post
Nice. Thanks Jiaz.
will be available in 5 mins
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1737  
Old 04.06.2021, 17:41
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,260
Default

Quote:
Originally Posted by Jiaz View Post
will be available in 5 mins
Updated the script with new method. Working fine. Thanks Jiaz.
Reply With Quote
  #1738  
Old 04.06.2021, 18:07
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

@mgpai: Thanks for the feedback
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1739  
Old 04.06.2021, 21:58
A-Dude A-Dude is offline
I will play nice!
 
Join Date: Jun 2021
Posts: 3
Default

Big thanks to mgpai and Jiaz!
I added the script (the first one for my JD ) and note the startup time.

Im realy happy now, my JD will be up to date and i don´t have to manually set stopmarks and trigger the restart
Reply With Quote
  #1740  
Old 07.06.2021, 11:31
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,413
Default

@A-Dude: All thanks goes to mgpai
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 20:32.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.