#181
|
|||
|
|||
![]()
Thank goodness mgpai brought everything back to work in the chat.
And thank you also for your help!
__________________
Aktuelles Windows Last edited by Dockel; 31.03.2021 at 15:47. |
#182
|
|||
|
|||
![]()
could you plz update any new solution or script here?
|
#183
|
|||
|
|||
![]()
After clicking "Move to history" this is shown:
![]() Those error messages sometimes occur. Is there anything one could do to avoid them?
__________________
Aktuelles Windows |
#184
|
||||
|
||||
![]()
@Dockel:
can you export all scripts and send them to support@jdownloader.org then I can check them and fix this issue. most likely there is access to non existing field/item
__________________
JD-Dev & Server-Admin |
#185
|
|||
|
|||
![]()
Yes, of course, thank you very much! Just done.
__________________
Aktuelles Windows |
#186
|
||||
|
||||
![]()
Play a Sound(Wav), Interval, the script doesn't check if the link is still in list/available
Quote:
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 23.04.2021 at 16:10. |
#187
|
|||
|
|||
![]()
Alright. I have replaced the old one. Thank you very much!
__________________
Aktuelles Windows |
#188
|
||||
|
||||
![]()
You're welcome. In future the window will inform about what script/trigger is causing the issue
![]()
__________________
JD-Dev & Server-Admin |
#189
|
|||
|
|||
![]()
Hi all
SOLVED BY UNCHECKING "Synchronous Execution of script" in each script that has this option in top of it Thank you Solution: Disable "Synchronous Execution of script" checkbox in the top panel of the script editor. I used these scripts to skip links that was finished in the past, https://board.jdownloader.org/showpo...4&postcount=18 https://board.jdownloader.org/showpo...3&postcount=24 but when I test adding several .craw files to folderwatch folder that have all old links to check if this work, jd2 freezes for long time Only the first .craw job appear and then freeze with no any activity jd2 cpu use gives 0 activity Note" my history file has huge link number more than 30,000 and it may reach much much more Notice\ I commented this line in the scripts, // alert("Download Skipped: "" + url + "" is present in history file."); I have to kill jd process via taskmanger I tied to add a package manualy and it also freeze becuase it has old links, Tried a package without old links goes ok Thanks SOLVED BY UNCHECKING "Synchronous Execution of script" in each script that has this option in top of it Thank you Can I remove dup links instead of disabling them via "link.enabled = false;????" Last edited by georgegalily; 07.10.2022 at 10:44. |
#190
|
||||
|
||||
![]()
@georgegalily: Please create a log, see https://support.jdownloader.org/Know...d-session-logs
in case you cannot create log in that session, restart JDownloader and make sure to have the previous session/time range selected when creating the log. and then post logID here
__________________
JD-Dev & Server-Admin |
#191
|
|||
|
|||
![]() Quote:
UNCHECKING "Synchronous Execution of script" in each script that has this option in top of it But, can I remove dup links instead of disabling them via "link.enabled = false;????" in this script, code: Code:
//Add your script here. Feel free to use the available api properties and methods // If download link is present in history file, mark it as duplicae (add "#duplicatelink" to comment) // Trigger required: Packagizer Hook if (state == "AFTER") { var url = link.getURL(); var historyFile = getPath(JD_HOME + "/cfg/history.txt"); var history = historyFile.exists() ? readFile(historyFile) : ""; if (history.indexOf(url) > -1) { var text = "#duplicatelink"; var comment = link.getComment(); comment = comment ? text + " " + comment : text; link.setComment(comment); link.enabled = false; } } Last edited by georgegalily; 07.10.2022 at 12:26. |
#192
|
||||
|
||||
![]()
@georgegalily: Thanks for the feedback!
__________________
JD-Dev & Server-Admin |
#193
|
||||
|
||||
![]() Quote:
Code:
sleep(1000); link.remove();
__________________
JD-Dev & Server-Admin |
#194
|
|||
|
|||
![]() Quote:
first one: Java heap space java.lang.OutOfMemoryError: Java heap space second one: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot find function remove in object org.jdownloader.extensions.eventscripter.sandboxobjects.PackagizerLinkSandbox@1aea5885. (#17) 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.ScriptRuntime.typeError(ScriptRuntime.java:3634) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3650) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3714) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime. java:2233) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2 215) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1333) at script(:17) 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:134) 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:322) at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:182) at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:162) |
#195
|
||||
|
||||
![]()
@georgegalily: can you show the complete script?
__________________
JD-Dev & Server-Admin |
#196
|
|||
|
|||
![]()
This is the targeted script mentioned above:
Code:
//Add your script here. Feel free to use the available api properties and methods // If download link is present in history file, mark it as duplicae (add "#duplicatelink" to comment) // Trigger required: Packagizer Hook if (state == "AFTER") { var url = link.getURL(); var historyFile = getPath(JD_HOME + "/cfg/history.txt"); var history = historyFile.exists() ? readFile(historyFile) : ""; if (history.indexOf(url) > -1) { var text = "#duplicatelink"; var comment = link.getComment(); comment = comment ? text + " " + comment : text; link.setComment(comment); // link.enabled = false; sleep(1000) link.remove(); } } Code:
[ { "eventTrigger" : "ON_ARCHIVE_EXTRACTED", "eventTriggerSettings" : {}, "id" : 1636093853265, "name" : "", "script" : null, "enabled" : false }, { "eventTrigger" : "ON_NEW_LINK", "eventTriggerSettings" : { "isSynchronous" : false }, "id" : 1665130121066, "name" : "Disable duplicate link in Lingrabber", "script" : "/* \n Disable duplicate link in Lingrabber list\n Trigger required: A new link has been added\n*/\n\nvar link = crawledLink;\n\nif (link.availableState == \"ONLINE\") {\n var file = getPath(JD_HOME + \"/cfg/history.txt\");\n\n var lock = getModifyLock(file.name);\n lock.writeLock();\n\n var urls = getProperty(file.name, true);\n\n if (urls == null) {\n urls = file.exists() && readFile(file) || \"\";\n setProperty(file.name, urls, true);\n }\n\n lock.writeUnlock();\n\n if (urls) {\n var url = link.contentURL || link.pluginURL;\n\n if (link.host == \"youtube.com\") {\n url = link.containerURL;\n }\n\n if (urls.indexOf(url) > -1) {\n var text = \"#duplicatelink\";\n var comment = link.comment;\n\n if (comment) {\n text = text + \" \" + comment;\n }\n\n link.comment = text;\n link.enabled = false;\n }\n }\n}\n", "enabled" : false }, { "eventTrigger" : "ON_PACKAGIZER", "eventTriggerSettings" : { "isSynchronous" : false }, "id" : 1665128070287, "name" : "mark it as duplicae", "script" : "//Add your script here. Feel free to use the available api properties and methods\n// If download link is present in history file, mark it as duplicae (add \"#duplicatelink\" to comment)\n// Trigger required: Packagizer Hook\n\nif (state == \"AFTER\") {\n var url = link.getURL();\n var historyFile = getPath(JD_HOME + \"/cfg/history.txt\");\n var history = historyFile.exists() ? readFile(historyFile) : \"\";\n\n if (history.indexOf(url) > -1) {\n var text = \"#duplicatelink\";\n var comment = link.getComment();\n comment = comment ? text + \" \" + comment : text;\n link.setComment(comment);\n // link.enabled = false;\n sleep(1000)\n link.remove();\n }\n}", "enabled" : false }, { "eventTrigger" : "DOWNLOAD_TABLE_CONTEXT_MENU_BUTTON", "eventTriggerSettings" : {}, "id" : 1665128070283, "name" : "Move to history", "script" : "// Add finished download links from selection to history, and remove them from the list\n// Tirgger required: Downloadlist Contextmenu Button Pressed\n// Customize downloadlist context menu > Add new \"Eventscripter Trigger\" button > Rename it to \"Move to history\" (without quotes) > Change Icon (optional)\n\nif (name == \"Move to history\") {\n var file = getPath(JD_HOME + \"/cfg/history.txt\"),\n urls = file.exists() ? readFile(file) : \"\",\n newUrls = \"\",\n url, data, text, comment;\n\n dlSelection.links.forEach(function(link) {\n if (link.finished) {\n url = link.contentURL || link.pluginURL;\n\n if (urls.indexOf(url) == -1) {\n newUrls += url + \"\\r\\n\";\n link.remove();\n }\n }\n });\n\n if (newUrls.length) {\n data = \"Added from the downloadlist list on \" + Date().toString().substring(4, 24) + \"\\r\\n\";\n data += newUrls + \"\\r\\n\";\n writeFile(file, data, true);\n\n getAllCrawledLinks().forEach(function(link) {\n if (link.availableState == \"ONLINE\") {\n url = link.contentURL || link.pluginURL;\n text = \"#duplicatelink\";\n comment = link.comment || \"\";\n \n if (comment.indexOf(text) == -1 && (urls + newUrls).indexOf(url) > -1) {\n link.comment = comment ? text + \" \" + comment : text;\n }\n }\n });\n }\n}\n", "enabled" : true }, { "eventTrigger" : "ON_DOWNLOAD_CONTROLLER_START", "eventTriggerSettings" : { "isSynchronous" : false }, "id" : 1665128070289, "name" : "duplicatelinkch", "script" : "//Add your script here. Feel free to use the available api properties and methods\n// Skip link if it present in download history (has \"#duplicatelink\" in comment)\n// To download the file (prevent skipping), remove \"#duplicatelink\" from comment\n// Trigger required: A Download Started\n\nvar comment = link.getComment() || \"\";\n\nif (comment.indexOf(\"#duplicatelink\") > -1) {\n var url = link.getContentURL() || link.getPluginURL();\n link.setSkipped(true);\n // alert(\"Download Skipped: \\\"\" + url + \"\\\" is present in history file.\");\n}", "enabled" : true }, { "eventTrigger" : "LINKGRABBER_TABLE_CONTEXT_MENU_BUTTON", "eventTriggerSettings" : {}, "id" : 1665128070285, "name" : "Move to historyLG", "script" : "// Add selected linkgrabber links to history, and remove them from the list\n// Tirgger required: Linkgrabber Contextmenu Button Pressed\n// Customize linkgrabber context menu > Add new \"Eventscripter Trigger\" button > Rename it to \"Move to history\" (without \nquotes) > Change Icon (optional)\n\nif (name == \"Move to history\") {\n var historyFile = getPath(JD_HOME + \"/cfg/history.txt\");\n if (!historyFile.exists()) writeFile(historyFile, \"\", true);\n var history = readFile(historyFile);\n\n var linkUrls = [];\n var linkIds = [];\n\n var removeLinks = function(linkIds) {\n callAPI(\"linkgrabberv2\", \"removeLinks\", linkIds, []);\n }\n\n lgSelection.getLinks().forEach(function(link) {\n var url = link.getUrl();\n var id = link.getUUID();\n\n if (history.indexOf(url) == -1) linkUrls.push(url);\n linkIds.push(id);\n })\n\n if (linkUrls.length) {\n data = \"Added from the lingkrabber list on \" + Date().toString().substring(4, 24) + \"\\r\\n\";\n data += linkUrls.join(\"\\r\\n\") + \"\\r\\n\\r\\n\";\n writeFile(historyFile, data, true);\n }\n\n if (linkIds.length) removeLinks(linkIds);\n}", "enabled" : true } ] Last edited by georgegalily; 07.10.2022 at 17:54. |
#197
|
||||
|
||||
![]()
@georgegalily
Please try this one Code:
if (state == "AFTER") { var url = link.getURL(); var historyFile = getPath(JD_HOME + "/cfg/history.txt"); var lock = getModifyLock("history"); var isDuplicate = false; lock.writeLock(); try { var history = historyFile.exists() ? readFile(historyFile) : ""; isDuplicate = history.indexOf(url) > -1; history = null; } finally { lock.writeUnlock(); } if (isDuplicate) { var text = "#duplicatelink"; var comment = link.getComment(); comment = comment ? text + " " + comment : text; link.setComment(comment); sleep(1000); link.getCrawledLink().remove(); } }
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 07.10.2022 at 17:57. |
#198
|
|||
|
|||
![]()
This shows "java.lang.OutOfMemoryError: Java heap space"
Last edited by georgegalily; 07.10.2022 at 18:03. |
#199
|
||||
|
||||
![]()
@georgegalily: please see updated script, had to update it multiple times
__________________
JD-Dev & Server-Admin |
#200
|
||||
|
||||
![]()
how large is your history.txt file?
__________________
JD-Dev & Server-Admin |
![]() |
Thread Tools | |
Display Modes | |
|
|