Warning: session_start(): open(/var/lib/php/sessions/sess_apmcg0ujn3tnt450jneeogt5ik, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
static long attnTimeout = 10000;
sS denkmodulID = #1013938;
sS friendlySound = #1009564; //#1013870
sS angrySound = #1013884;
sS startUpSound = #1013982;
sS calculatingSound = #1013998;
sS defaultText = "Sorry";
sS reKatze = "Katze|Katze|Katja|Qatar|Cookson|Captain|Cat|Kettle|Cut|Kurt|Computer";
static JTextArea ta;
static IVar text;
static Class recognizer;
static Class denkmodul;
static long attention, skipTill;
sbool fullAttention;
p-subst {
loadLibrary(#1013975);
autoRestart(10.0);
recognizer = hotwire(#1009816);
//denkmodul = run(denkmodulID);
runInMCVarWithAutoRestart('denkmodul, denkmodulID);
//autoRestartModule('denkmodul, denkmodulID, true);
text = persistentVar("Text");
ta = bindTextAreaToVar(text, jwordwraptextarea());
showFrame(fontSize(20, ta));
moveCaretToEnd(ta);
set(recognizer, onFirstWebSocket := r {
playMP3Snippet(startUpSound);
});
set(recognizer, onUtterance := voidfunc(S utterance) {
if (match("turn off", utterance))
call(recognizer, 'stopRecognition);
appendToTextAreaAndMoveCaret(ta, utterance + "\n");
callAnswerMethodVerbose(utterance);
});
//set(recognizer, startRecognition := true);
callMain(recognizer);
call(recognizer, 'switchToGerman);
}
sS answer(fS s) {
if (sysNow() < skipTill) null;
if (sysNow() >= attention+attnTimeout) attnOff();
if (attention != 0) {
attnOff();
if "nichts|nix|vergiss es|nothing|forget it" {
playWAVSnippet(#1013870);
}
try answer denk(s);
}
if (regexpICFind(reKatze, s)) {
fullAttention = true;
S rest = regexpICLastGroup("(" + reKatze + ")(.*)", s);
if (startsWithLetter(rest)) rest = trim(substring(rest, lastIndexOf(rest, ' ')));
if (nempty(rest))
try answer denk(rest);
else {
if (isShit(s))
playMP3Snippet(angrySound);
else
playMP3Snippet(friendlySound);
attention = sysNow();
fullAttention = true;
print("attn");
ret "Yo";
}
}
L g = regexpGetGroups("(-?\\d+) x (-?\\d+)$", s);
if (g != null)
ret gudrun_withBlip(str(parseLong(first(g))*parseLong(second(g))));
null;
}
sbool isShit(S s) {
ret regexpICFind("scheiß", s);
}
sS denk(S s) {
print(">> " + s);
S a = "Fehler";
try {
a = denk2(s);
} catch e {
if (eqic(getInnerMessage(e), "command stopped")) null;
else printStackTrace(e);
}
if (empty(a)) {
if (!fullAttention) null;
a = defaultText;
} else {
attention = sysNow(); fullAttention = false;
print("half attn");
}
skipTill = sysNow()+60000;
try {
gudrun_withBlip(a);
} finally {
skipTill = sysNow()+1000;
}
ret a;
}
sS denk2(S s) {
if "neu" {
upgradeModuleVar('denkmodul, denkmodulID, true);
ret "OK";
}
ret callAnswerFunction(denkmodul, s);
}
svoid attnOff {
if (attention == 0) ret;
attention = 0;
print("attn off");
}
sS gudrun_withBlip(S s) {
if (!gudrun_isCached(s))
thread { playMP3Snippet(calculatingSound); }
ret gudrun(s);
}