View Single Post
  #456  
Old 27.04.2018, 14:50
peymanch peymanch is offline
Baby Loader
 
Join Date: Mar 2018
Posts: 5
Default

Quote:
Originally Posted by peymanch View Post
thanks but how to use this script in jdownloader?:confused:
when run script this give error "ReferenceError: interval is not defined. (#9)"
Quote:
Originally Posted by mgpai View Post
In the Event Scripter main panel, select "Interval" as trigger, then open the script editor and the set the interval value as per instructions given in the script.
i copy code in script and select interval as trigger
but when downloaded from myhost as dailylimit didnot stop download!

Code:
var dailyLimit = 0.001; // <- Set daily limit in GiB
var myHost = "dl-vip.com"; // <- Set JD plugin (host) name
interval = 300000;

(function() {
    if (interval < 60000) return;
    if (!getRunningDownloadLinks().length) return;

    var bytesLoaded = 0;

    getAllDownloadLinks().forEach(function(link) {
        if (link.getHost() != myHost) return;
        var finishedToday = new Date(link.getFinishedDate()).setHours(0, 0, 0, 0) == new Date().setHours(0, 0, 0, 0);
        var partiallyLoaded = !link.isFinished() && link.getBytesLoaded() > 0;
        if (finishedToday || partiallyLoaded) bytesLoaded += link.getBytesLoaded();
    });

    if (bytesLoaded / (1024 * 1024 * 1024) >= dailyLimit) skipHost();

    function skipHost() {
        getAllDownloadLinks().forEach(function(link) {
            if (!link.isFinished() && link.getHost() == myHost && !link.isSkipped()) link.setSkipped(true);
        });
    }
})();

Last edited by peymanch; 27.04.2018 at 18:34.
Reply With Quote