Quote:
Originally Posted by thecoder2012
Simple example for high queue:
Code:
// Queue check for 9kw.eu
// Trigger Required: Interval
var newInterval = 10000;
if(interval == newInterval){
check9kw_queue();
}else{
interval = newInterval;
}
function check9kw_queue (){
var settings_9kw = "org.jdownloader.captcha.v2.solver.solver9kw.Captcha9kwSettings";
var https = callAPI("config", "get", settings_9kw, null, "https");
var servercheck_page = '://www.9kw.eu/grafik/servercheck.json';
var servercheck;
if (https == 1) {
servercheck = getPage("https" + servercheck_page);
} else {
servercheck = getPage("http" + servercheck_page);
}
if (servercheck.match(/^\{/)) {
var queue = JSON.parse(servercheck).queue;
if (parseInt(queue) > 100){
//callAPI("downloadsV2", "setStopMark", linkUUID, -1);//Set stop mark on link
//callAPI("downloadsV2", "setStopMark", -1, packageUUID);//Set stop mark on package
setDownloadsPaused(true);
//alert("High queue. " + "(" + queue + ")");
}else{
//callAPI("downloadsV2", "removeStopMark");//Remove stop mark
setDownloadsPaused(false);
}
}
}
And one example for credits:
Code:
// Check for enough credits (captcha service 9kw.eu)
// Trigger Required: Interval
var newInterval = 30000;
if(interval == newInterval){
check9kw_credits();
}else{
interval = newInterval;
}
function check9kw_credits (){
var settings_9kw = "org.jdownloader.captcha.v2.solver.solver9kw.Captcha9kwSettings";
var apikey = callAPI("config", "get", settings_9kw, null, "ApiKey");
var prio = callAPI("config", "get", settings_9kw, null, "prio");
var confirm = callAPI("config", "get", settings_9kw, null, "confirm");
var https = callAPI("config", "get", settings_9kw, null, "https");
var credits_page = '://www.9kw.eu/index.cgi?action=usercaptchaguthaben&apikey=' + apikey;
var credits;
if (https == 1) {
credits = getPage("https" + credits_page);
} else {
credits = getPage("http" + credits_page);
}
if (credits.match(/^\d+$/)) {
var min_credits = 30;
if (confirm) {
min_credits += 6;
}
if (prio) {
min_credits += parseInt(prio);
}
if (parseInt(credits) < min_credits) {
setDownloadsPaused(true);
//alert("Not enough credits. " + "(" + credits + ")");
}else{
setDownloadsPaused(false);
}
}
}
|
Hi mgpai
I need your help for the queue script again.
The script shows errors in the 23 line.
Syntax Error: Unterminated objekt literal
Error Report
net.sourceforge.htmlunit.corejs.javascript.EcmaError: SyntaxError: Unterminated object literal (#23)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3629)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3613)
at net.sourceforge.htmlunit.corejs.javascript.NativeJSON.parse(NativeJSON.java:125)
at net.sourceforge.htmlunit.corejs.javascript.NativeJSON.execIdCall(NativeJSON.java:97)
at net.sourceforge.htmlunit.corejs.javascript.IdFunctionObject.call(IdFunctionObject.java:89)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
at script.check9kw_queue(:23)
at script(:6)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitP ermissionRestricter.java:119)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)