View Single Post
  #31  
Old 04.02.2017, 19:40
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 639
Default

Quote:
Originally Posted by jdorg View Post
is it possible to also reconnect and not just stop and restart?
Code:
// Request reconnect if the current average speed is below limit.
// Trigger Required: "Interval"

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

if (running() && !limitEnabled() && getAverageSpeed() < minSpeed * 1024) {
    requestReconnect();
}

// Check if all downloads are resumeable and have been running for atleast the minimum duration.
function running() {
    var links = getRunningDownloadLinks();
    if (links.length > 0) {
        for (i = 0; i < links.length; i++) {
            var link = links[i];
            if (!link.isResumeable() || link.getDownloadDuration() < minDuration * 60 * 1000) {
                return false;
            }
        }
        return true;
    }
    return false;
}

// Check if Speed limit or pause is currently enabled
function limitEnabled() {
    if (callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "downloadspeedlimitenabled") || isDownloadControllerPaused()) {
        return true;
    }
    return false;
}
Quote:
Originally Posted by jdorg View Post
...is there a way to make buttons for the toolbar, that actives/deactivates an specific script from the event scripter list?
Not that I know of. And yes, just disabling the event scripter does not seem to terminate running scripts. Seems it needs to be disabled in the list.

Quote:
Originally Posted by jdorg View Post
thank you for your work/help
:)
You are welcome

Last edited by mgpai; 06.02.2017 at 14:13. Reason: Added check for non-resumeable downloads before reconnect
Reply With Quote