#1441
|
|||
|
|||
Quote:
Code:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "link" is not defined. (#4) 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.notFoundError(ScriptRuntime.java:3683) at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.name(ScriptRuntime.java:1690) at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1622) at script(:4) 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: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:288) at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:180) at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:155) |
#1442
|
|||
|
|||
Hi. Anyone else using Linux?
I'm trying to create a very simple script after file extraction in order to upload the content to the cloud using a software called Rclone, that can be executed using the terminal (command line) with the following command: Code:
rclone move /home/user/Downloads/extracted/ gdrive: I already tried to create a bash script.sh like this... Code:
#!/bin/bash /usr/bin/rclone move /home/user/Downloads/extracted/ gdrive: Then, I tried to do a test run from Jdownloader using the following*lines: Code:
var myScript = "/home/thiago/script.sh"; callSync(myScript); But it didn't work. It works just fine using "/home/thiago/script.sh" on the terminal command prompt, but not running inside Jdownloader doing a test run. I already gave an execute permission on my bash script using "chmod +x script.sh". And it's still not working. I also made a really simple script like: Code:
callSync("/home/thiago/makemkv.sh"); Which will only launch a software called makemkv and it's not working. It works using the command line outside Jdownloader, though. Actually, it seems even the example scripts are not working on Linux (Ubuntu 20.04). Anyone could please help me? Last edited by tisurame; 04.07.2020 at 07:21. |
#1443
|
|||
|
|||
Quote:
Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader |
#1444
|
|||
|
|||
Quote:
Example: Code:
var result = callSync("/home/thiago/makemkv.sh"); alert(result); |
#1445
|
|||
|
|||
Hey guys, I don't know Java at all so I'd like some help.
I need a script that stops downloading and then resumes (NOT RESETS) links from a certain website every 5 minutes. I'm having a major issue with this website, where it constantly says the files are unavailable when they actually are (can confirm this cause I can hit resume and then they will resume downloading.) currently I'm doing this manually but this is just gonna take forever. Thanks in advance if anyone can help me. |
#1446
|
|||
|
|||
Better to see if it can be fixed at the plugin level. If you provide a log the developers might be able to check/fix it.
|
#1447
|
|||
|
|||
Quote:
|
#1448
|
|||
|
|||
Please reset such existing links manually by using GUI filter/sort feature. You will need to do it only once since such links will be automatically reset by the script in future.
|
#1449
|
|||
|
|||
Hi all,
First of all, huge thanks to the devs and mgpai for your software and effort helping with the scripts! I'm trying to write a simple script that goes through the links in the download list and just starts them and after at least a single byte has been downloaded, it disables it, deletes what's been downloaded and jumps to the next link. I've tried using the following script but since the download start is inconsistent, I would need a really long "sleep" in order to make sure the download has started and the conditions are met. Maybe I'm completely wrong in my approach, so any help would be greatly appreciated! Last edited by JimmyRompeolas; 05.07.2020 at 15:27. Reason: Removed code due to potential abuse |
#1450
|
|||
|
|||
Quote:
Feel free to find me in JD Chat if you need any help with it. Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader |
#1451
|
|||
|
|||
Would it be possible to make a script that adds the comment "zero bytes" (or anything really) to any link where the size = 0 bytes? That would make manually resetting them much easier as I have hundreds of 0 byte links scattered across thousands of downloads among hundreds of packages. I could just use the search for all the links with that comment and then CTLR+A and reset them. If not thanks again and I'll just get to work manually resetting them all lol
|
#1452
|
|||
|
|||
Quote:
Code:
// Reset finished link, if size is zero bytes // Trigger: JDownloader Started getAllDownloadLinks().forEach(function(link) { if (link.finished && !link.bytesTotal) { link.reset(); } }) Unlike the other script which queries a single link, this queries all links, which will use more system resources each time it is executed, especially if you lot of links in the list. So disable it once the existing links in the list are reset. |
#1453
|
|||
|
|||
Hi folks
I use a program called MKVToolNix to REMUX .mp4 files to .mkv that I would like to automate, this is the code of the app it supports CMD but for some reason the CMD window always stays open instead of closing automatically Code:
"C:\mkvtoolnix\mkvmerge.exe" --ui-language en --output ^"C:\outputfilename.mkv^" --language 0:und --language 1:eng ^"^(^" ^"C:\inputfilename.mp4^" ^"^)^" --track-order 0:0,0:1 if after the download is successful if it's .mp4 extension and executes the commands to remux whilst properly keeping the original name of the file? thank youuu |
#1454
|
|||
|
|||
Quote:
Code:
// Remux 'mp4' to 'mkv' // Trigger: A Download Stopped if (link.finished) { var file = link.downloadPath, type = getPath(file).extension, out = file.replace(type, "mkv"), mkvmerge = "c:\\mkvtoolnix\\mkvmerge.exe"; if (type == "mp4") { callSync(mkvmerge, "-o", out, file); } } |
#1455
|
|||
|
|||
thank you so much Mgpai, worked flawlessly!
I noticed the original .mp4 file remained, my guess is that I would have to run a second separate script to delete it right? what would be the script to move the file to recycle bin OR delete if recycle bin isn't possible if .mp4 after interval 1200 seconds whilst keeping it inside Downloads Tab for historical purposes, I need it to remain inside the downloads tab to avoid downloading it twice, so It will be deleted only externally thanks in advance |
#1456
|
|||
|
|||
Why would it not be? You OP does not include any explicit request for deletion of the source file.
You can use the program options (add it to the existing program parameters in script) to delete it. If you need any help adding it the script, find me in JD Chat. |
#1457
|
|||
|
|||
you're right I forgot to mention the deletion of original file after 1200 seconds in the OP. I'll enter the chat. thanks so much!!!!
|
#1458
|
||||
|
||||
@mgpai
I'm currently in the process of finally adding some helpful help articles to our knowledge database / fixing / deleting older ones. I know that this thread contains a script that basically does "Auto-Update JD when it is not in use/downloading". Can you please point me to the right direction? I would like to add a hint to this script to the basic headless installation instructions: https://support.jdownloader.org/Know...bedded-devices Also, if you want to, maybe you can modify the script so it has the following features: - Auto-Update every X hours regardless whether or not downloads are running - Only update if no downloads are running I think this will be helpful for a lot of users (including me lol) running JD on a server where it is running permanently. If you got more ideas regarding useful help articles, just let me know -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1459
|
|||
|
|||
@psp: Have included an option to restart after 'x' hours (Disabled by default).
For GUI: Code:
// Restart & Update when JD is idle, or after 'x' hours. // Trigger: Interval (Recommended 600000 or more). var hours = 0; // Update after 'x' hours, even if JD is not idle. (0 = Disabled) if (callAPI("update", "isUpdateAvailable")) { var updateNow = false; if (hours > 0) { if (!getProperty("date", false)) { setProperty("date", new Date(Date.now() + hours * 60 * 60 * 1000), false); } if (Date.now() > getProperty("date", false)) { updateNow = true; } } if (!updateNow) { var idle = isDownloadControllerIdle() && !callAPI("linkcrawler", "isCrawling") && !callAPI("linkgrabberv2", "isCollecting") && !callAPI("extraction", "getQueue").length > 0; if (idle) { updateNow = true; } } if (updateNow) { callAPI("update", "restartAndUpdate"); } } For Headless: 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 } ] If I have something useful to add to the articles, will definitely share my thoughts. |
#1460
|
||||
|
||||
Thanks!
Soon after I will have posted this post, your auto-update script will be added to our knowledgebase! From now on we also have a separate Event Scripter category in our Knowledge-Base. It is primarily there to link existing scripts but as scripts are usually made by users, we will still mainly use our forum for them. We will put some popular/useful scripts directly into our knowledgebase. -psp- EDIT I got it linked HERE.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download Last edited by pspzockerscene; 15.07.2020 at 15:41. |
#1461
|
|||
|
|||
Quote:
|
#1462
|
|||
|
|||
Hi.
So I got Event Scripter installed now and I would like JD to do a few things after finished downloads but only to certain files. I want to cut out the first 7 seconds of any video downloaded from saidwebsite I have the ffmpeg command line in a .bat file now that I run inside the folder with the videos. I also use the packagizer in JD for saidwebsite so files are grabbed and downloaded into specific folder - <jd:prop:username> I would be very happy if I could automatize some of all this manual work. After download what i specifically want to happen is 7 first seconds cut out of the video & the new file must overwrite the old file in the folder Then I only have the renaming of files to do manually afterwards - but if possible I would like to have that automated too I use bulk rename utility right now and I have a template that: removing chars: Code:
///#,_-¦¡/¿'.;()// Code:
480p 4k 720p 1080p 1440p 2160p I would also like to have the file prefix to be the performers name & I would like to have the performers username at the end of the title removed. It sounds like a lot - I know - and it is a lot of manual work right now. Any help getting this more automatic is really appreciated. Last edited by raztoki; 16.07.2020 at 23:44. |
#1463
|
|||
|
|||
Quote:
i make so: var links = archive.getDownloadLinks() || []; And then if links.length > 0 I take it for automatical extract otherwise I take it for manual extract. Is safe? Or better idea? Because your code must only run when manual extract. Last edited by sherbee; 24.07.2020 at 09:36. |
#1464
|
|||
|
|||
Quote:
Code:
var getArchiveFiles = function() { return archive.getExtractionLog().match(/\((DownloadLink|File)ArchiveFile\)File:[^|]+/g).map(function(string) { return string.replace(/.+?:(.+)/, "$1"); }); } Or use it with existing archive methods: Code:
var getArchiveFiles = function() { var archiveLinks = archive.getDownloadLinks(); if (archiveLinks) { return archiveLinks.map(function(link) { return link.getDownloadPath(); }) } else { return archive.getExtractionLog().match(/\(FileArchiveFile\)File:[^|]+/g).map(function(string) { return string.replace(/.+?:(.+)/, "$1"); }); } } Common usage for both functions: Code:
getArchiveFiles().forEach(function(file) { // Do something with each archive file // alert(file); }); |
#1465
|
|||
|
|||
Quote:
Code:
return archive.getExtractionLog().match(/\((DownloadLink|File)ArchiveFile\)File:[^|]+/g).map(function(string) { I don't know what is wrong for automatic extraction after download no such error. Last edited by sherbee; 25.07.2020 at 09:09. |
#1466
|
|||
|
|||
I am unable to reproduce the error. Open the extraction log to check if it matches the regex pattern used in the script (just in case if it is language dependent), and modify if necessary.
|
#1467
|
|||
|
|||
Quote:
But still 'TypeError: Cannot call method "match" of null'' So I look in log folder. Interesting: 1s time manual extract => Error. When retry same file => No error. Other error happen: Wrapped org.appwork.exceptions.WTFException: java.io.FileNotFoundException: Now I see there is /open folder in log folder. When extracting log goes in open folder then moved in extracting folder. So I think null-error happen when log is still in 'open' folder so it cannot find it? Maybe this is reason? Or it wants find it in 'open' folder and it already in 'extracting' folder? |
#1468
|
|||
|
|||
Quote:
Code:
var getArchiveFiles = function() { var log = archive.getExtractionLog(); var count = 60; // max. seconds to wait for log while (!log && count) { log = archive.getExtractionLog(); count--; sleep(1000); } if (log) { return archive.getExtractionLog().match(/\((DownloadLink|File)ArchiveFile\)File:[^|]+/g).map(function(string) { return string.replace(/.+?:(.+)/, "$1"); }); } else { alert("Log file for archive \"" + archive.getName() + "\" not found."); return []; } } getArchiveFiles().forEach(function(archiveFile) { // Do something with each archive file // alert(archiveFile); }) |
#1469
|
|||
|
|||
Quote:
Still geting error like: 'Wrapped org.appwork.exceptions.WTFException: java.io.FileNotFoundException: \jdownloader\logs\extracting\*.txt' But it should report error message: 'Log file for archive "" + archive.getName() + "" not found.' Right? So log check not works? |
#1470
|
|||
|
|||
Quote:
Alternatively, you can use while loop to check the folder contents of 'open', and execute the script only after it is empty. It might then even work even without 'log = null' check. Unfortunately I cannot test it since I am unable to reproduce the error. Feel free to find me in JD Chat if need any help with the script/troubleshooting. Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader |
#1471
|
|||
|
|||
Quote:
Code:
getArchiveFiles().forEach(function(archiveFile) { // Do something with each archive file alert(archiveFile); }) In single cases for example I manual extract file xyz.7z. But 'alert(archiveFile)' gives filename: xyz_2.7z. When check I see file package name xyz with file name xyz_2.7z alrready in download list from earlier time. So function not gives name from actual extract, but from some extraction earlier. I can see in log from actual extract, that correct file xyz.7z i have select. That is not good. I see 3 times now. Always same: Extract file filename.7z manual. but name shows filename_2.7z and after check I see file with filename_2.7z already in download list from time ago. Actual log but show filename.7z. Maybe it same reasen that makes bug I have report: https://board.jdownloader.org/showpo...54&postcount=8 It's problem because I take 'archiveFile' for move file automaticall after extract. So when it gives wrong filename, file cannot find to move. Last edited by sherbee; 26.07.2020 at 06:58. |
#1472
|
|||
|
|||
Looks like it is related to the issue you reported. If the API method returns the wrong log, nothing can be done in the script to verify/rectify it.
If you can run a local file server, you can load the archive files to JD and generate 'local' download links which can be automatically extracted. While it may not solve the wrong 'log' or 'status' problem, you should be able to move the links using a script, without any issues. |
#1473
|
|||
|
|||
Quote:
So must take correct extraction log and use instead. So idea is to make manual: 1. Get extraction log 2. Open extraction log 3. And use 'Archive Path:'-value Is there not API to extract values from log? I think would be useful if simply could make like: getLogValue(logfile).archivepath or getLogValue('Archive Path') and result would be archive path like: 'c:\user\sherbee\downloads\xyz.7z' So this could work? And how? |
#1474
|
|||
|
|||
Quote:
Code:
var match = readFile(getPath(path_to_correct_log_file)).match(/Archive Path\: (.+)/); if (match) { var archivePath = match[1]; alert(archivePath); } |
#1475
|
|||
|
|||
I try thanks. But you have idea how to get correct path to log file and name? I see no method for it. And not written in any logs to extract? Take last log by date i think not reliable.
|
#1476
|
|||
|
|||
You don't need to get the correct log file, or even any other data from the 'extraction finished' trigger. You can use any trigger (For e.g. JD started, interval) and loop through the log files of last 'x' hours present in the 'extracting' folder. Parse the content of each file to check if the extraction was 'successful', and if so get a list of 'archive files' and move them. If the log has not already been processed before, the 'archive files' will still be present in the folder and can be moved by the script.
|
#1477
|
|||
|
|||
Hello fellow programmiers I have no clue about programming nor do i understand all those scripts, but i am searching for a function to change linkgrabber a little bit:
I would like to sometimes shutdown the linkgrabber organisation: Like if i enter 1 link, it will be shown under "verschiedene dateien" (dunno the english name for it), if i than enter 2 more links with part 1 and part 2, they won't be inside the "verschiedene dateien", they get a new folder with the name of these files. Anyone has an idea how to change that? That ALL Links/Files being in one folder no matter if there are lonely links or links with part 1-x? Ideally with a button for on/off ... Thx Mydgard PS: If Possible must be a ready script as i don't understand this scripting sry :D |
#1478
|
||||
|
||||
@Mydgard
verschiedene dateien = various files in english the title is just various, you can disable various in advanced settings settings > advanced settings > LinkgrabberSettings.variouspackageenabled you can also edit a threshold which links are no longer in various LinkgrabberSettings.variouspackagelimit
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#1479
|
|||
|
|||
Quote:
I need: 1. Open archive 2. Extract archive 3. Move archive 4. Open next archive Must move archive after extraction immediately. |
#1480
|
|||
|
|||
It effectively does the same thing. The files will be moved as soon as the log file is available in the 'extracting' folder and queried. How fast you want it to be processed will depend on the the trigger you use.
|
|
|