#3001
|
||||
|
||||
@dataDyne: Your script is missing closing
Quote:
__________________
JD-Dev & Server-Admin |
#3002
|
||||
|
||||
Yes, work and without errors, but I want with the option automatically delete all original files...any help for this?
This is a working script for convert all audio files to MP3 320Kbps, but I want with erase the original files: EDIT: 100% working script for convert all audio files (YouTube, etc...) to MP3 320Kbps and automatically delete all original files: Code:
/* Convert aac/m4a/ogg/opus files to 320 kbps mp3. Trigger required: "A Download Stopped". */ if (link.finished) { var input = link.downloadPath; var output = link.downloadPath.replace(/(.+\.)(aac|m4a|ogg|opus)$/i, "$1mp3"); if (input != output) { var interfaceName = "org.jdownloader.controlling.ffmpeg.FFmpegSetup"; var ffmpeg = callAPI("config", "get", interfaceName, null, "binarypath"); callSync(ffmpeg, "-n", "-i", input, "-b:a", "320k", output); getPath(output).size && getPath(input).delete(); } } Last edited by dataDyne; 07.07.2024 at 03:52. |
#3003
|
||||
|
||||
@dataDyne: the script already has the deleting part in it
Quote:
__________________
JD-Dev & Server-Admin |
#3004
|
||||
|
||||
YES! Now work correctly...and delete all original audio files.
Thank you so much!...have a nice day! |
#3005
|
||||
|
||||
Worked fine, now I get "Security Violation errors"
Quote:
When it appeared for the first time, I could click on error details (see below) and I could click on OK, so that JD continued grabbing. Today it appeared again, but this time I had to end the JD process in TaskManager. No reaction on any mouse clicks. It must have something to do with the files I'm grabbing, because when I add a block of links to "Analyze and add links"-window and click on continue, a couple of links are being grabbed and then the error message pops up. Reproducible, as often as I like... Maybe a JD update could (also) have something to do with it. Because for two weeks of intensive use, this error never occurred. Any ideas? Thanks for any help provided in advance! Code:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: Security Violation: Security Violation java.lang.Short (#8) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3935) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3919) at org.jdownloader.extensions.eventscripter.ScriptThread.isClassVisibleToScript(ScriptThread.java:505) at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory$2.visibleToScripts(JSHtmlUnitPermissionRestricter.java:180) at net.sourceforge.htmlunit.corejs.javascript.JavaMembers.<init>(JavaMembers.java:31) at net.sourceforge.htmlunit.corejs.javascript.JavaMembers.lookupClass(JavaMembers.java:785) at net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject.initMembers(NativeJavaObject.java:53) at net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject.<init>(NativeJavaObject.java:43) at net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject.<init>(NativeJavaObject.java:34) at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxNativeJavaObject.<init>(JSHtmlUnitPermissionRestricter.java:295) at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxWrapFactory.wrapAsJavaObject(JSHtmlUnitPermissionRestricter.java:287) at net.sourceforge.htmlunit.corejs.javascript.WrapFactory.wrap(WrapFactory.java:72) at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxWrapFactory.wrap(JSHtmlUnitPermissionRestricter.java:266) at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:222) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1536) at script(:8) 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(JSHtmlUnitPermissionRestricter.java:134) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3286) at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115) at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1361) at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:346) at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:194) at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:169) Last edited by StefanM; 21.07.2024 at 11:36. |
#3006
|
||||
|
||||
@StefanM: Thanks for the report, will be fixed with next update later today
optimization of json parser that reduces memory consumption is causing this
__________________
JD-Dev & Server-Admin |
#3007
|
||||
|
||||
Thanks for the prompt reply and reaction.
|
#3008
|
|||
|
|||
Parse comments for links
Hello!
I am trying to create a little script that adds the entire content of a comment to the linkgrabber function: my hope is that the links within the comment will be automatically parsed and added to the hit list while conserving the save folder parameters of the link that had the comment. Would it be possible for me to get help with this? I have asked copilot but the script is not working... Would there be a way to enable this only for certain domains/hosters? Code:
for (var i = 0; i < package.getChildren().length; i++) { var hit = package.getChildren()[i]; if (hit.getComment() && hit.getComment().length > 0) { var comment = hit.getComment(); linkCollector.addURL(url); } } } |
#3009
|
||||
|
||||
Context regarding the post of user "senormal":
https://board.jdownloader.org/showthread.php?t=96066
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#3010
|
||||
|
||||
Update is released
__________________
JD-Dev & Server-Admin |
#3011
|
||||
|
||||
Fehler! Tja, jetzt werden bei mir Links gar nicht mehr gefunden. Getestet mit k2s und mit wetransfer. Wohl aber mit der vorherigen Version, die ich als BAK gesichert hatte. EDIT Should have written in English: Error! JD doesn't find links anymore! Tested with k2s and wetransfer. Previous JD version (from Sunday), however, restored from a backup, still finds those links. Last edited by StefanM; 22.07.2024 at 18:35. |
#3012
|
||||
|
||||
Das Problem wurde hier bereits gemeldet.
Bitte abonniere den verlinkten Thread, um über einen Bugfix informiert zu werden.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#3013
|
||||
|
||||
Quote:
Four tests with a larger number of links and the script enabled could not provoke the error (freezing,...) anymore. But as I will continue using that script on a daily basis, there will be more reliable test results pretty soon. |
#3014
|
|||
|
|||
Hi, I'm trying to add the following auto-update script from the Knowledge Base to my headless JDownloader2 configuration through MyJDownloader, and it completely refuses to save. It always ends up reverting to the default blank "[]" entry. What can I do about it?
Code:
[ { "eventTrigger" : "INTERVAL", "enabled" : true, "name" : "Auto-update JD", "script" : "// Restart & Update when JD is idle, or after 'x' hours.\n// Trigger: Interval (Recommended 600000 or more).\n\nvar hours = 0; // Update after 'x' hours, even if JD is not idle. (0 = Disabled)\n\nif (callAPI(\"update\", \"isUpdateAvailable\")) {\n\n var updateNow = false;\n\n if (hours > 0) {\n \n if (!getProperty(\"date\", false)) {\n setProperty(\"date\", new Date(Date.now() + hours * 60 * 60 * 1000), false);\n }\n\n if (Date.now() > getProperty(\"date\", false)) {\n updateNow = true;\n }\n }\n\n if (!updateNow) {\n \n var idle = isDownloadControllerIdle() &&\n !callAPI(\"linkcrawler\", \"isCrawling\") &&\n !callAPI(\"linkgrabberv2\", \"isCollecting\") &&\n !callAPI(\"extraction\", \"getQueue\").length > 0;\n\n if (idle) {\n updateNow = true;\n }\n }\n\n if (updateNow) {\n callAPI(\"update\", \"restartAndUpdate\");\n }\n}", "eventTriggerSettings" : { "lastFire" : 1594799412187, "interval" : 600000, "isSynchronous" : false }, "id" : 1594796988140 } ] |
#3015
|
||||
|
||||
@mrbigmouth502: what browser are you using? what os? I'm asking because on MacOS chrome and safari might cause issues
__________________
JD-Dev & Server-Admin |
#3016
|
|||
|
|||
@Jiaz: I'm using Firefox on EndeavourOS; basically Arch Linux. If it makes any difference I'm using KDE Plasma 6 as my DE, and I'm running under Wayland.
|
#3017
|
||||
|
||||
@mrbigmouth502: how do you do it? do you click on the save button or how exactly? I can reproduce the issue but only on enter or clicking somewhere else, when hitting save button, it works
__________________
JD-Dev & Server-Admin |
#3018
|
|||
|
|||
@Jiaz: I have been hitting the save button. I highlight the script, right click, click "copy", delete the brackets in the box where you're supposed to paste the script, right click the box, click "paste", hit the save button, and then it just vanishes.
Could it be because I use a dedicated browser profile for MyJDownloader? UPDATE: I think I finally figured out a solution. I had to go into the Advanced Settings and add my script there. I also deleted the last line of whitespace after the last "]". When I did that, it asked if I wanted to grant my script the Interval permission, which I did. UPDATE2: OK, new problem. When I open up MyJdownloader, I get this error, sometimes multiple times: Quote:
Last edited by mrbigmouth502; 26.07.2024 at 03:02. |
#3019
|
||||
|
||||
@mrbigmouth502: Thanks for the followup, I will test again what happens when I have spaces at the end of ] as I always just copied the *exact/correct* json part in my testing.
Quote:
1.) hit *don't show this again* and okay, so JDownloader remembers your decision 2.) add Quote:
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 26.07.2024 at 10:11. |
#3020
|
|||
|
|||
Quote:
Last edited by mrbigmouth502; 01.08.2024 at 11:27. |
#3021
|
|||
|
|||
Quote:
Code:
getAllCrawledPackages().forEach(function(package) { var links = []; package.downloadLinks.forEach(function(link) { if (link.host == "myhost.com" && link.comment) { links.push(link.comment); } }) if (links.length) { callAPI("linkgrabberv2", "addLinks", { links: links.join("<br>"), destinationFolder: package.downloadFolder }) } }) |
#3022
|
|||
|
|||
Is there a way to use one event script to move completed downloads, but let the archive extractor finish first?
I have an event script set up that works, in that it checks isFinished and uses moveTo to move the files. But if the JD has detected that there are archives in it, the archive extractor doesn't get a chance to extract them before the isFinished event script fires. Code:
var packageFinished = link.getPackage().isFinished(); if (packageFinished) { var curFolder = link.package.downloadFolder; var destFolder = getPath("E:\\moved\\somehost\"); var pathString = curFolder.valueOf(); var needsMoving = pathString.indexOf('somehost'); if (needsMoving > -1){ getPath(curFolder).moveTo(destFolder); } } Is there something I should put in my event script that waits on the Archive Extractor to finish? |
#3023
|
||||
|
||||
@wkearney99: when I remember right, there already is such a script, somewhere in this thread. try to use "search this thread" or ask mgpai, he might know better if/where it can be found
__________________
JD-Dev & Server-Admin |
#3024
|
|||
|
|||
Code:
package.downloadLinks.forEach(function(link) { while ( ["IDLE", "RUNNING"].indexOf(link.extractionStatus) > -1 ) sleep(1000); }) //your code goes here If you are running the script on packag finished trigger, additional package.isFinished check within the script is not required. |
#3025
|
|||
|
|||
Quote:
Thank you so much! |
#3026
|
|||
|
|||
Quote:
Code:
// Function to detect duplicate entries in the download list based on RyuuIDs and archive names. function detectDuplicateEntries() { // Define the regex pattern to match the RyuuID in the package name. var regexPattern = /(r[a-z]{0,3}-?[a-z]{0,3}\d{4,10})\b/i; // Paths for cache and log files. var cacheFilePath = getPath(JD_HOME + "/ryuuID_cache.json"); var logFilePath = getPath(JD_HOME + "/Ryuu.log"); // Function to load cache data. function loadCache() { if (cacheFilePath.exists()) { try { var cacheData = readFile(cacheFilePath); return JSON.parse(cacheData); } catch (error) { log("Error reading cache: " + error); } } return null; } // Function to save cache data. function saveCache(data) { try { writeFile(cacheFilePath.toString(), JSON.stringify(data, null, 2), true); } catch (error) { log("Error saving cache: " + error); } } // Function to get a list of archive names for a package. function getArchiveNames(package) { var archiveNames = []; var archives = package.getArchives(); for (var i = 0; i < archives.length; i++) { archiveNames.push(archives[i].getName()); } return archiveNames; } // Function to log messages to the log file. function log(message) { try { writeFile(logFilePath.toString(), message + "\n", true); } catch (error) { alert("Error writing to log file: " + error); } } // Delete the log file if it exists. if (logFilePath.exists()) { logFilePath.delete(); } // Get the list of all file packages. var downloadPackages = getAllFilePackages(); var currentPackageCount = downloadPackages.length; // Log the start of the script. log("Script started with " + currentPackageCount + " packages"); // Load cache data. var cache = loadCache(); // Check if we need to re-scan the download list. var uuidRyuuMap = {}; var archiveMap = {}; if (cache && cache.packageCount === currentPackageCount) { uuidRyuuMap = cache.uuidRyuuMap; archiveMap = cache.archiveMap; log("Loaded lists from cache"); } else { log("Deriving Cache..."); var logMessages = ""; // Re-scan the download list to build the UUID:RyuuID map and archive names. for (var i = 0; i < downloadPackages.length; i++) { var package = downloadPackages[i]; var packageName = package.getName(); var uuid = package.getUUID(); var match = regexPattern.exec(packageName); if (match && match[0]) { var ryuuID = match[0]; uuidRyuuMap[uuid] = ryuuID; // Store archive names. archiveMap[uuid] = getArchiveNames(package); logMessages += " Adding " + uuid + " with RyuuID " + ryuuID + " and archives " + archiveMap[uuid].join(", ") + "\n"; // Write to file if batch size is reached. if ((i + 1) % 300 === 0) { log(logMessages.replace(/\n$/, '')); logMessages = ""; // Clear log messages after writing. } } } // Write any remaining log messages after the loop. if (logMessages) { log(logMessages); } // Save the new cache data. saveCache({ packageCount: currentPackageCount, uuidRyuuMap: uuidRyuuMap, archiveMap: archiveMap }); } // Detect duplicates. var duplicates = {}; // Object to store duplicate RyuuID with list of UUIDs. var matches = {}; // Object to store all UUIDs with the same RyuuID. var ryuuIdMap = {}; // Map to track RyuuIDs and their associated UUIDs. for (var uuid in uuidRyuuMap) { // Iterate through each UUID in the UUID:RyuuID map. var ryuuID = uuidRyuuMap[uuid]; // Get the RyuuID associated with the current UUID. var archives = archiveMap[uuid]; // Get the list of archives for the current UUID. // Log the comparison. // log("Comparing " + uuid + ": " + ryuuID + " with archives: " + JSON.stringify(archives)); // Check if this RyuuID has been seen before. if (ryuuIdMap[ryuuID]) { var duplicateUUID = ryuuIdMap[ryuuID]; // Get the UUID of the previously seen RyuuID. var duplicateArchives = archiveMap[duplicateUUID]; // Get the list of archives for the duplicate UUID. log(" Checking " + uuid + ": " + ryuuID + " with archives: " + JSON.stringify(archives)); log(" Match to " + duplicateUUID + ": " + ryuuID + " with archives: " + JSON.stringify(duplicateArchives)); // Track all UUIDs with the same RyuuID. if (!matches[ryuuID]) { matches[ryuuID] = []; } matches[ryuuID].push(uuid); matches[ryuuID].push(duplicateUUID); // Check if all archives in the current package exist in the duplicate package. var isDuplicate = archives.every(function(archive) { return duplicateArchives.indexOf(archive) !== -1; }); if (isDuplicate) { // If all archives match, the packages are considered duplicates. log(" Duplicate found! " + duplicateUUID + " and " + uuid + " with archives: " + JSON.stringify(duplicateArchives)); if (!duplicates[ryuuID]) { duplicates[ryuuID] = []; } duplicates[ryuuID].push(uuid); duplicates[ryuuID].push(duplicateUUID); // } else { // log("No match found between UUID: " + uuid + " and duplicate UUID: " + duplicateUUID); } } else { // If the RyuuID is not in the map, add it with the current UUID. ryuuIdMap[ryuuID] = uuid; } } // Format the duplicates message var duplicateMessage = "Duplicates:\n"; for (var ryuuID in duplicates) { duplicateMessage += ryuuID + "\n"; for (var i = 0; i < duplicates[ryuuID].length; i++) { var uuid = duplicates[ryuuID][i]; duplicateMessage += "\t" + uuid + ": " + JSON.stringify(archiveMap[uuid]) + "\n"; } duplicateMessage += "\n"; // Add extra lines of space between different RyuuIDs } duplicateMessage += "\n\n\n\n"; // Add extra lines of space between different RyuuIDs // Format the matches message duplicateMessage += "Matches:\n"; for (var ryuuID in matches) { duplicateMessage += ryuuID + "\n"; for (var i = 0; i < matches[ryuuID].length; i++) { var uuid = matches[ryuuID][i]; duplicateMessage += "\t" + uuid + ": " + JSON.stringify(archiveMap[uuid]) + "\n"; } duplicateMessage += "\n"; // Add extra lines of space between different RyuuIDs } if (duplicateMessage) { alert(duplicateMessage); log(duplicateMessage); // Log the final results. } else { alert("No duplicate entries found."); log("No duplicate entries found."); } } // Call the function to detect duplicate entries. detectDuplicateEntries(); |
#3027
|
||||
|
||||
Quote:
__________________
JD-Dev & Server-Admin |
#3028
|
|||
|
|||
Is there a script to have Kaspersky (or other antivirus) scan the downloads once the download is done?
FDM has this feature. I would love it for JDM and was told event script might help. |
#3029
|
||||
|
||||
Can't you go the other way and setup your dedicated AV application to actively monitor certain directories?
Apart from that: Yes this is definitely possible using EventScripter scripts.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#3030
|
|||
|
|||
how do I do the first option?
And how can I get a script for the second option? |
#3031
|
||||
|
||||
Pose this question to the manufacturer of your AV software.
Ask other users for help in this thread or pay a freelancer to code a script for you (e.g. on fiverr.com).
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#3032
|
||||
|
||||
@John19234
Usually AV software scan everything by default and you need to opt out of locations it wont scan. Maybe with the exception of network paths.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#3033
|
||||
|
||||
I had the same thought but at the same time I knew that FDM has that feature and I never understood the purpose.
Maybe this is for users who have their AV disabled but wnat to proactvely only scan items downloaded by FDM.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#3034
|
|||
|
|||
Quote:
Also periodic av scans take time and might scan files that have already been scanned. I want a selective scan of one file. Last edited by John19234; 05.09.2024 at 14:49. |
#3035
|
|||
|
|||
I cannot execute a .cmd script with Eventscripter.
With callSync(“D:\\Test.cmd”) nothing happens, .exe files work without problems Does Jdownloader have no permission for scripts? Start as admin doesn't work. |
#3036
|
|||
|
|||
Quote:
Code:
callSync("cmd", "/c", "D:\\Test.cmd"); |
#3037
|
|||
|
|||
ChatGPT has already suggested the same thing, but it doesn't work either.
Edit: callSync("cmd", "/c", "start", "D:\\test.cmd"); This works when I add “start”, but it only starts the old cmd window and not Windows Terminal :( Is there any way to change this? Edit2: Fixed callSync("wt", "cmd", "/c", "D:\\test.cmd"); Last edited by FiskX; 07.09.2024 at 19:29. |
#3038
|
|||
|
|||
Hello friends,
I know that we can use the "variables" to customize the "downloaded file's name" eg. *DATE_UPLOAD[yyyy.MM.dd]* (up) - *VIDEO_NAME*.*EXT* but there are 260 characters limitation on the file's name. so, I would like to put that information into the "comment" part of the file instead using the variables shown in "Filename & Packagename" on the YouTube plugin I did a search, and found this topic, scripted and written by "mgpai" refer to this topic https://board.jdownloader.org/showthread.php?t=87352 but as of now, in September 2024, the script does not seem to work, or maybe I did something wrong, please help me further with this. btw, that script only provides only 5 variables, could it be customized to provide ALL the variable above that is shown in "Filename & Packagename" on YouTube plugin for example in the file's "comments" (on the "Details" tab") can be like the following Thank you so much in advanced Last edited by jDX007; 10.09.2024 at 00:24. |
#3039
|
|||
|
|||
Could one make a script that does a reconnect after a reconnect if there is no internet connection within 4 minutes of the first reconnect? And only then?
__________________
Aktuelles Windows |
#3040
|
||||
|
||||
This should already happen automatically, even by default.
Check Settings -> Advanced Settings -> Search for "Reconnect" and check all entries starting with "Reconnect:" to adjus the timings.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
Thread Tools | |
Display Modes | |
|
|