Thread: [User feedback required] Automatische Erhöhung des Tageslimits
View Single Post
  #11  
Old 11.06.2019, 23:30
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,290
Default

Habe mal versucht ein solches Skript zu bauen aber ist ungetestet.
Allgemein Interval wählen und auf 60000 stellen. Mit tempLimit stellst ein ab wie viel übrige Gigabytes die Downloads gestartet und worauf am Ende das Limit wieder gesetzt werden soll.

Meines Wissens kann man den Scheduler nicht für den Ereignis Skripter (Event Scripter) nutzen um eine gezielte Zeit einzustellen. Aus dem Grund hab ich die Startzeit und die Resetzeit als Uhrzeit im Skript hinterlegt.

Code:
// Change SO daily limit
// Trigger: Interval
var tempLimit = 50;
var starttime = "23:30"; //23:30 Uhr
var resettime = "00:00"; //00:00 Uhr

var displayName = "share-online.biz";
var interfaceName = "jd.plugins.hoster.ShareOnlineBiz";
var key = "TRAFFIC_LIMIT";
var values = ["100", "99", "98", "97", "96", "95", "90", "80", "70", "60", "50", "40", "30", "20", "10"];
var trafficLeft = "";
var trafficMax = "";
var defaultValue = "";
var value = "";

var hh = new Date().getHours();
var mm = new Date().getMinutes();
hh = (hh < 10) ? "0" + hh : hh;
mm = (mm < 10) ? "0" + mm : mm;
var checktime = hh + ":" + mm;
var long1;

if (checktime == starttime || checktime == resettime) {
    var premiumAccounts = callAPI("accountsV2", "listAccounts", {
        "enabled": true,
        "trafficLeft": true,
        "trafficMax": true
    });
    for (i = 0; i < premiumAccounts.length; ++i) {
        if (premiumAccounts[i].hostname == "share-online.biz" && premiumAccounts[i].enabled == true) {
            long1 = [premiumAccounts[i].uuid];
            trafficLeft = (premiumAccounts[i].trafficLeft / 1024 / 1024 / 1024);
            //trafficMax = (premiumAccounts[i].trafficLeft / 1024 / 1024 / 1024);
            break;
        }
    }

    var pluginquery = callAPI("plugins", "query", {
        "defaultValues": true,
        "description": true,
        "enumInfo": true,
        "includeExtensions": true,
        "values": true
    });
    for (i = 0; i < pluginquery.length; ++i) {
        if (pluginquery[i].storage == "share-online.biz" && pluginquery[i].key == "TRAFFIC_LIMIT") {
            defaultValue = pluginquery[i].defaultValue;
            value = pluginquery[i].Value;
            break;
        }
    }


    if (checktime == starttime) {
        //if (trafficLeft <= tempLimit) {
        //if ((100-trafficLeft) >= tempLimit) {
        if (trafficLeft >= tempLimit) {
            callAPI("plugins", "set", interfaceName, displayName, key, defaultValue.toString());
        } else {
            callAPI("plugins", "set", interfaceName, displayName, key, tempLimit.toString());
        }
        sleep(3000);
        callAPI("accountsV2", "disableAccounts", long1);
        sleep(5000);
        callAPI("accountsV2", "enableAccounts", long1);
        startDownloads();/*Start Downloads*/
    }
    if (checktime == resettime) {
        callAPI("plugins", "set", interfaceName, displayName, key, tempLimit.toString());
        sleep(3000);
        callAPI("accountsV2", "disableAccounts", long1);
        sleep(5000);
        callAPI("accountsV2", "enableAccounts", long1);
        stopDownloads();/*Stop Downloads*/
    }
}

Skript um SO Accounts schneller zu aktualisieren auch ohne Workaround:
Code:
// SO with faster account refresh
// Trigger: Interval (e.g. 600000ms = 10min)
var premiumAccounts = callAPI("accountsV2", "listAccounts", {
    "enabled": true,
    "userName": true,
});
for (i = 0; i < premiumAccounts.length; ++i) {
    if (premiumAccounts[i].hostname == "share-online.biz" && premiumAccounts[i].enabled == true) {
        var long1 = [premiumAccounts[i].uuid];
        callAPI("accountsV2", "refreshAccounts", long1, true);
    }
}
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 11.07.2019 at 17:36.
Reply With Quote