Quote:
Originally Posted by sherif011
I mean, I just need to set the limit for the current session, just after I click start, without counting previous downloads.
|
NOTE: Do not delete partiallly/completely downloaded links from the list, when the downloads are running.
Code:
// Limit per download session
// Trigger: Download Controller Started
var limit = 20; // <- Session limit (GB)
var interval = 30; // <- Interval between checks (seconds)
var getLoadedBytes = function() {
return callAPI("polling", "poll", {
"aggregatedNumbers": true
})[0].eventData.data.loadedBytes;
}
var loadedBytes = getLoadedBytes();
while (isDownloadControllerRunning() || isDownloadControllerPaused()) {
sleep(interval * 1000);
if ((getLoadedBytes() - loadedBytes) / 1e9 > limit) stopDownloads();
}