View Single Post
  #1672  
Old 27.03.2021, 15:34
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,212
Default

Quote:
Originally Posted by nicolau View Post
I would like the script to start the connection process for a new download when 5 minutes are left to complete an active download
Code:
/*
    Start new downloads based of ETA of running downloads
    Trigger: Interval
*/    

var links = getRunningDownloadLinks();

if (links.length == 3) {
    links.some(function(link) {
        if (link.getEta() < 60 * 5) {
            setMax(4);
            setMax(3);
            return true;
        }
    })
}

function setMax(int) {
    var interfaceName = "org.jdownloader.settings.GeneralSettings";
    var key = "MaxSimultaneDownloads";
    callAPI("config", "set", interfaceName, null, key, int);
}
Reply With Quote