View Single Post
  #856  
Old 05.08.2019, 19:36
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

Quote:
Originally Posted by Fetter Biff View Post
Kann man JD automatisch neu starten lassen, so wie er 0 MB/s lädt / nichts mehr runterlädt, aber nur, wenn er nicht entpackt?
In addition to the extraction check, I have also included linkcrawler and linkcollector check. You can remove/comment them out if they are not required. Hope I have understood your requirement correctly.

Code:
// Restart JD if download speed in 0 and JD is idle.
// Trigger: Interval (Recommended: 60000 or more).
// IMPORTANT: Enable "Synchronous execution of script" checkbox in the top panel.

var mySeconds = 120; // (in seconds) <- Restart JD if speed remains at zero for this duration.

if (isSpeedZero()) {
    var elapsed = 0;
    while (isSpeedZero() && elapsed < mySeconds) {
        elapsed++;
        sleep(1000);
    }
    if (isSpeedZero() && isIdle()) callAPI("system", "restartJD");
}

//Functions
function isSpeedZero() {
    return getRunningDownloadLinks().length && !getTotalSpeed();
}

function isIdle() {
    if (callAPI("linkcrawler", "isCrawling")) return;
    if (callAPI("linkgrabberv2", "isCollecting")) return;
    if (callAPI("extraction", "getQueue").length > 0) return;
    return true;
}

What exactly is causing the downloads to stall? Does restart fix the issue? If not, the script will keep running in a loop. If you can provide a log Jiaz might be able to check it and fix the underlying issue, or recommend an alternative solution.
Reply With Quote