JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 25.01.2021, 00:33
Kayn Kayn is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 9
Post [Event Scripter] Help for a script

Hi, I'm trying to achieve a simple JD behaviour, but I don't know how to write the script. I've tried to modify the below script, but without succeeding.

Code:
//Pause downloads during extraction
// Trigger Required: Any Extraction Event
// Enable "Synchrounous Execution" checkbox in the top panel
// Related Post: https://board.jdownloader.org/showpo...&postcount=398

(function() {
    if (!isDownloadControllerRunning()) return;
    if (!callAPI("extraction", "getQueue").length) return;
    if (!isDownloadControllerPaused()) setDownloadsPaused(true);
    while (callAPI("extraction", "getQueue").length) sleep(1000);
    if (isDownloadControllerPaused()) setDownloadsPaused(false);
})();

I'd like that when an extraction start the download gets stopped until the extraction is finished, then I'd like that the download starts again.

A help would be very appreciated, I really don't understand how to figure it out. Thanks.

Last edited by Kayn; 25.01.2021 at 00:45.
Reply With Quote
  #2  
Old 25.01.2021, 06:29
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,551
Default

Quote:
Originally Posted by Kayn View Post
I'd like that when an extraction start the download gets stopped until the extraction is finished, then I'd like that the download starts again.
Code:
/* 
    Stop downloads during extraction
    Trigger Required: Any Extraction Event
*/

if (isDownloadControllerRunning()) {
    
    stopDownloads();
    
    while (callAPI("extraction", "getQueue").length) {
        sleep(1000);
    }
    
    startDownloads();
}
Reply With Quote
  #3  
Old 28.01.2021, 05:40
Kayn Kayn is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 9
Default

Thanks a million, that works like a charm However now the option "shutdown after downloads completed" or even "close Jdownloader after downloads completed" don't work anymore
Reply With Quote
  #4  
Old 28.01.2021, 11:39
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,551
Default

Quote:
Originally Posted by Kayn View Post
However now the option "shutdown after downloads completed" or even "close Jdownloader after downloads completed" don't work anymore
Does not close/shut down at all, or closes/shuts down before the downloads are finished?
Reply With Quote
  #5  
Old 29.01.2021, 14:04
Kayn Kayn is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Does not close/shut down at all, or closes/shuts down before the downloads are finished?
Not shuts itself down/close at all...
Reply With Quote
  #6  
Old 29.01.2021, 14:17
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,551
Default

There is a possibility of closing/shutting down when downloads are pending, since JD may trigger shutdown because downloads have stopped. But I do not see it preventing close/shutdown. I can confirm it since during my test I was able to both close/shutdown when the downloads were interrupted by the script.

Check the shutdown extension settings. By default it resets every session. There is a setting to prevent it.
Reply With Quote
  #7  
Old 11.03.2021, 01:41
Kayn Kayn is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 9
Default

Sorry if I pick this up after long time, but I moved to JDownloader on Synology and I'm not able to save the script
I mean it saves the script but it doesn't run it or even memorize it properly because when I came back to check the script is disappered...any tip ?
Reply With Quote
  #8  
Old 11.03.2021, 06:27
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,551
Default

Quote:
Originally Posted by Kayn View Post
I'm not able to save the script
Are you adding the script using GUI (Desktop) or WebUI?
Reply With Quote
  #9  
Old 12.03.2021, 00:14
Kayn Kayn is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Are you adding the script using GUI (Desktop) or WebUI?
WebUI
Reply With Quote
  #10  
Old 12.03.2021, 03:21
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,551
Default

Install/test the script in GUI and then copy the "EventScripter.scripts" value from advanced settings to headless install using WebUI OR copy "org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json" file from the 'cfg' folder in GUI, to the headless install.

If it still does not work, copy the "EventScripter.scripts" value from WebUI advanced settings and post it here.
Reply With Quote
  #11  
Old 13.03.2021, 00:46
Kayn Kayn is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Install/test the script in GUI and then copy the "EventScripter.scripts" value from advanced settings to headless install using WebUI OR copy "org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json" file from the 'cfg' folder in GUI, to the headless install.

If it still does not work, copy the "EventScripter.scripts" value from WebUI advanced settings and post it here.
Perfect, that works. Thanks a million.
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 13:52.
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 - 2024, Jelsoft Enterprises Ltd.