Quote:
Originally Posted by Tyler
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();
}