Quote:
Originally Posted by Tyler
I need a script that will stop downloads if my download speed drops below say 100kb\s for x amount of minutes and then restart after that time has passed.
|
Code:
// Auto stop/restart downloads 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.
var waitTime = 1; // (minutes) <- wait time before restart.
if (running() && getAverageSpeed() < minSpeed * 1024) {
stopDownloads();
sleep(waitTime * 60 * 1000);
startDownloads();
}
// Check if all downloads 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.getDownloadDuration() < minDuration * 60 * 1000) {
return false;
}
}
return true;
} else {
return false;
}
}