JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #61  
Old 29.03.2017, 08:01
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Stop and restart slow links.
// Trigger Required: "Interval" (Recommended: 30000 or more).
// IMPORTANT: Enable "Synchronous execution of script" (checkbox).

var minSpeed = 128; // (KiB/s) <- minimum download speed per link.
var minDuration = 1; // (minutes) <- minimum download duration per link.

var links = getRunningDownloadLinks();

for (i = 0; i < links.length; i++) {
    var link = links[i];
    if (link.getDownloadDuration() < minDuration * 60 * 1000) continue;
    if (link.getSpeed() > minSpeed * 1024) continue;
    link.abort();
}
and that restarts the links after x amount of time like the other one?
Reply With Quote
  #62  
Old 29.03.2017, 08:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 327
Default

Quote:
Originally Posted by Tyler View Post
... and that restarts the links after x amount of time like the other one?
Quote:
Originally Posted by Jiaz View Post
there is new method for Download.abort() that will stop download and DowloadController will start it again when possible and resume
No. This script has to process individual links, so it evaluates the current link and restarts it (if necessary) using the "abort()" method and immediately moves on to process the next link in the list.
Reply With Quote
  #63  
Old 29.03.2017, 08:53
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

Quote:
Originally Posted by mgpai View Post
No. This script has to process individual links, so it evaluates the current link and restarts it (if necessary) using the "abort()" method and immediately moves on to process the next link in the list.
so its not possible to stop the download of individual links and wait?
Reply With Quote
  #64  
Old 29.03.2017, 09:22
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 327
Default

Quote:
Originally Posted by Tyler View Post
so its not possible to stop the download of individual links and wait?
Not out of the box. This script should work just fine, so I am not sure if any other solution will be worth the effort.
Reply With Quote
  #65  
Old 29.03.2017, 10:15
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

Quote:
Originally Posted by mgpai View Post
Not out of the box. This script should work just fine, so I am not sure if any other solution will be worth the effort.
it works fine, its just not what i need.

its probably something that only i would use so i can see that it might not be worth the effort, thanks anyway though.

Last edited by Tyler; 29.03.2017 at 10:23.
Reply With Quote
  #66  
Old 29.03.2017, 10:38
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 327
Default

Quote:
Originally Posted by Tyler View Post
so its not possible to stop the download of individual links and wait?
Here is a workaround.

Code:
// Skip slow links and resume them after wait time.
// Trigger Required: "Interval" (Recommended: 30000 or more).
// IMPORTANT: Enable "Synchronous execution of script" (checkbox).

var minSpeed = 128; // (KiB/s) <- minimum download speed per link.
var minDuration = 1; // (minutes) <- minimum download duration per link.
var waitTime = 5; // (minutes) <- wait time before restart

var links = getRunningDownloadLinks();
var skipped = [];

for (i = 0; i < links.length; i++) {
    var link = links[i];
    if (link.getDownloadDuration() < minDuration * 60 * 1000) continue;
    if (link.getSpeed() > minSpeed * 1024) continue;
    link.setSkipped(true);
    skipped.push(link.getUUID());
}

if (skipped.length > 0) {
    sleep(waitTime * 60 * 1000);
    resumeLinks();
}

//functions
function resumeLinks() {
    callAPI("downloadsV2", "resumeLinks", skipped, []);
    while (isDownloadControllerStopping()) sleep(1000);
    if (!isDownloadControllerRunning()) startDownloads();
}
Reply With Quote
  #67  
Old 29.03.2017, 14:34
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

seems to just be setting the download to skip and starting another one.

maybe it needs to also change the simultaneous downloads from 2 to 1 during the sleep?

Last edited by Tyler; 29.03.2017 at 14:37.
Reply With Quote
  #68  
Old 29.03.2017, 14:48
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 327
Default

Does it stay 'skipped' even after the wait time? It will try to resume/restart the download immediately after the 'wait time'. But it can do so only if free slot is available.
Reply With Quote
  #69  
Old 29.03.2017, 16:18
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

yeah the skipped goes away but its still starting more downloads instead of just stopping the one link.
Reply With Quote
  #70  
Old 29.03.2017, 16:34
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 327
Default

If a download slot is free and there are pending downloads in the list, new downloads will naturally start. This will be the case, not only with the script, but even when you stop/skip the link manually. It is less likely to happen if 'abort()' method used, because it tries to download the same link immediately.
Reply With Quote
  #71  
Old 29.03.2017, 16:58
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

i know but i don't need new downloads to start, i just need the individual link that is slowed to stop.
Reply With Quote
  #72  
Old 10.04.2017, 12:27
Ezak Ezak is offline
I will play nice!
 
Join Date: Jan 2016
Posts: 5
Default

Hey guys,

maybe this is the wrong place, but i cant find a how to for call skript from event handler on my synology nas.

Is there something in the forum?

Thank you guys
Reply With Quote
  #73  
Old 10.04.2017, 17:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,797
Default

Install the Eventscript Extension via Webinterface in Settings. Then restart JDownloader.
Then easiest way to write script is by using a JDownloader with GUI, write your script there and finally copy over the value from settings-advanced settings-EventScripter.scripts to your other JDownloader

In case you need help with eventscripter, I suggest to ask mgpai for help
__________________
JD-Dev & Server-Admin
Reply With Quote
  #74  
Old 11.04.2017, 19:42
Ezak Ezak is offline
I will play nice!
 
Join Date: Jan 2016
Posts: 5
Default

Thank you Jiaz,

it works now so far, thank you.

But i have a Problem, i want to get the diretory Name of the extracted folder.

package.getName(); Works on my Laptop example : pictures2016

the same package on my nas gives me the value: VARIOUS
Reply With Quote
  #75  
Old 12.04.2017, 09:27
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,797
Default

Don't use package.getName as it returns the package name and not the extracted folder.
Better use *Archive extraction finished* and make use of archive information. there you an access the 'extract to' folder

package name depends on settings/packagizer rules/various package settings and many more.

You can ask mgpai for help with eventscripter.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #76  
Old 20.04.2017, 04:44
emilio530 emilio530 is offline
Bandwidth Beast
 
Join Date: Oct 2011
Location: Caracas
Posts: 148
Default

Hi! Is there a way i can access the plugins data? I would like to set a stopmark when captcha solver queue is high.

Thanks!
Reply With Quote
  #77  
Old 20.04.2017, 04:48
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 15,934
Default

plugins do not have data in that fashion.
they are just methods to perform tasks.

what you're trying todo is more complicated than you realise. How are you going to measure this, one could assume it should be done at the ces provider level then set a global stop mark and when loads reduce, remove said stopmark.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #78  
Old 20.04.2017, 08:04
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,797
Default

What exactly do you mean by *captcha solver queue* is high?
captcha solver queue max contains number of concurrent downloads + linkcrawler tasks.
so while downloading it can max contain 20 jobs....
__________________
JD-Dev & Server-Admin
Reply With Quote
  #79  
Old 21.04.2017, 17:49
emilio530 emilio530 is offline
Bandwidth Beast
 
Join Date: Oct 2011
Location: Caracas
Posts: 148
Default

Quote:
Originally Posted by raztoki View Post
plugins do not have data in that fashion.
they are just methods to perform tasks.

what you're trying todo is more complicated than you realise. How are you going to measure this, one could assume it should be done at the ces provider level then set a global stop mark and when loads reduce, remove said stopmark.
Quote:
Originally Posted by Jiaz View Post
What exactly do you mean by *captcha solver queue* is high?
captcha solver queue max contains number of concurrent downloads + linkcrawler tasks.
so while downloading it can max contain 20 jobs....
Hi, what i mean is to access the 9kw plugin data. I see that when enabled i have an icon in left bottom that tells me captcha queue, credits, and other info related to my 9kw account. I would like to know if i can invoke some function that can help me get that info in a script so i can set a stopmark when the 9kw captcha queue is too high.

Thanks raztoki and Jiaz!!

:thumbup:
Reply With Quote
  #80  
Old 21.04.2017, 18:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,797
Default

I will check next week and provide feedback here
__________________
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 16:27.
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 - 2018, Jelsoft Enterprises Ltd.