
06.09.2016, 14:22
|
Script Master
|
|
Join Date: Sep 2013
Posts: 1,484
|
|
Update JD when idle.
Code:
// Restart and Update JD when idle
// Trigger Required: "Interval"
var newInterval = 600000;
if (interval == newInterval) {
if (isDownloadControllerIdle()) {
if (isUpdateAvailable() && !isExtracting() && !isCrawling()) {
restartAndUpdate();
} else {
if (!isAutoUpdateCheckEnabled()) {
runUpdateCheck();
}
}
}
} else {
interval = newInterval;
}
//Functions
function isUpdateAvailable() {
return callAPI("update", "isUpdateAvailable");
}
function isExtracting() {
return callAPI("extraction", "getQueue").length > 0;
}
function isCrawling() {
return callAPI("linkcrawler", "isCrawling");
}
function restartAndUpdate() {
callAPI("update", "restartAndUpdate");
}
function isAutoUpdateCheckEnabled() {
return callAPI("config", "get", "org.jdownloader.updatev2.UpdateSettings", null, "autoupdatecheckenabled");
}
function runUpdateCheck() {
callAPI("update", "runUpdateCheck");
}
Updated version of the script can be found in Post# 881 of this thread.
Last edited by mgpai; 15.09.2019 at 09:52.
Reason: Link to new version of the script.
|