#1201
|
|||
|
|||
![]() Quote:
Quote:
Code:
// Save linkgrabber urls to text file // Trigger: Toolbar Button Pressed if (name == "Export linkgrabber links") { var myFolder = JD_HOME; // Set any existing folder to save files (Default location: <JDownloader> install folder) var date = new Date().toString().substr(4, 17).replace(":", "."); var myFile = getPath(myFolder + "/linkgrabber urls - " + date + ".txt"); var urls = getAllCrawledLinks().map(function(link) { return link.getUrl(); }) if (urls.length) writeFile(myFile, urls.join("\r\n") + "\r\n", true); } |
#1202
|
|||
|
|||
![]()
many thanks again
|
#1203
|
|||
|
|||
![]()
Hi,
my JDownloader is running headless on my raspberry pi. i want to automaticcally restart jdownloader when new updates are available and no download is runnung. There is a script to realize that here: https://board.jdownloader.org/showpo...&postcount=881 In an other thread i've got the information that i can create this script with jdownloader on my desktop running the gui version and then copy all to the raspberry pi. Here is a description how to create a new button and run a script; https://support.jdownloader.org/Know...rticle/View/46. What trigger do i need to run the script when new updates are available and jdownloader is in idle? |
#1204
|
|||
|
|||
![]() Quote:
You can install the eventscripter in JD GUI and setup/test the script in in it and copy the 'EventScripter.scripts' JSON data from its 'value' column and paste it in the headless JD using WebUI. Alternatively, after installing the script in JD GUI, you can copy the "org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json" file from JD GUI to the headless version. This is the script in JSON format, which can be added (using WebuI) in 'EventScripter.scripts' advanced setting of headless JD. Code:
[ { "eventTrigger" : "INTERVAL", "enabled" : true, "name" : "Update JD when idle", "script" : "// Update when JD is Idle\n// Trigger Required: \"Interval\"\n// Set interval to 600000 (10 mins.) or more.\n\ndisablePermissionChecks();\n\n(function() {\n if (callAPI(\"update\", \"isUpdateAvailable\") == false) return;\n if (callAPI(\"linkcrawler\", \"isCrawling\")) return;\n if (callAPI(\"linkgrabberv2\", \"isCollecting\")) return;\n if (callAPI(\"extraction\", \"getQueue\").length > 0) return;\n if (callAPI(\"downloadcontroller\", \"getCurrentState\") != \"IDLE\") return;\n callAPI(\"update\", \"restartAndUpdate\");\n})();", "eventTriggerSettings" : { "lastFire" : 1583942603250, "interval" : 600000, "isSynchronous" : false }, "id" : 1583942586078 } ] Please note, Eventscripter extension must be installed/enabled for it to work. |
#1205
|
|||
|
|||
![]()
@mgpai so I have a weird problem with the auto link checker script. So youtube videos work fine but I'm trying to add another websites links but for some reason, it says there are no links (when I only have that link(s) in the text file). If I add the link manually it finds everything fine. Could it be because I have a special link crawler rule for this site?
|
#1206
|
|||
|
|||
![]()
I'm trying to set a command that takes the links of the linkgrabber, opens the notepad and pastes it inside the links leaving it open [so as to save the txt with name and destinations as needed] ...
The script from which I took inspiration opens notepad ( but starts from an existing file ) , so I too had to use existing files: Code:
// Save Linkgrabber to txt and open Notepad (to "save" the txt with name and destinations as needed) // Trigger: Toolbar Button Pressed if (name == "Save Linkgrabber to txt") { var SaveLinkFile = getPath(JD_HOME + "/tmp/SaveLinkFile.txt"); var textEditor = "notepad.exe"; var urls = getAllCrawledLinks().map(function(link) { return link.getUrl(); }) if (SaveLinkFile.exists()) SaveLinkFile.delete();//.deleteRecursive();??? if (urls.length) writeFile(SaveLinkFile, urls.join("\r\n"), true); //if (urls.length) writeFile(myFile, urls.join("\r\n") + "\r\n", true); // ?? what they mean urls.join("\r\n") + "\r\n" callSync(textEditor, SaveLinkFile); } ( what they mean << urls.join("\r\n") + "\r\n" >> r & n what do they indicate? ) a) what should I correct to say "replace the contest of the txt "? [ no add ] [now i delete the txt (I think)...] b) what difference do delete and deleteRecursive have? c) Am I forced to work on real files? [can't links be sent directly to the notepad without first writing them to a file?] In this script , if i have the links in a txt is there a way to make them read / add in the addpattern? Code:
// Remove crawledlinks which match user-specified pattern var patterns = []; var addPattern = function(pattern) { patterns[patterns.length] = pattern; } addPattern(/microsoft.com\/.+/i); addPattern(/apple.com\/robots.txt/i); addPattern(/google.com/i); addPattern(/robots.txt$/i); getAllCrawledLinks().forEach(function(link) { patterns.forEach(function(pattern) { var url = link.getUrl(); if (pattern.test(url)) link.remove(); }) }) I've tried something like this, but I'm definitely missing something Code:
var textEditor = "notepad.exe"; var patternFile = getPath(JD_HOME + "/tmp/ks.txt"); callSync(textEditor, patternFile); addPattern = readFile(patternFile); |
#1207
|
|||
|
|||
![]() Quote:
When you added the link manually, did you add a single link or multiple links? If you add a single link manually, JD automatically deep anaylses it to find any downloaded content from that link, even if there is not dedicated plugin or crawler rule. |
#1208
|
|||
|
|||
![]() Quote:
I'm thinking you might need to call vbs or shell script to do this for you. Code:
var urls = getAllCrawledLinks().map(function(link) { return link.getUrl(); }) Quote:
Code:
urls.join("\r\n") + "\r\n" Last edited by zreenmkr; 12.03.2020 at 11:54. |
#1209
|
|||
|
|||
![]() Quote:
Code:
// Remove linkgrabber links which are present in user-specified text file var textfile = JD_HOME + "/tmp/linklist.txt"; var linklist = readFile(getPath(textfile)).trim(); getAllCrawledLinks().forEach(function(link) { if (linklist.indexOf(link.getUrl()) > -1) link.remove(); }) |
#1210
|
|||
|
|||
![]()
I tried to enable it but it doesn't work. when i pressed "install" it runs and runs and runs. after 45 minutes i cancled. There are available updates and i didn't restart because i wanted to try the script. Do i need to restart before i enable the extention?
|
#1211
|
|||
|
|||
![]()
Yes. A restart is required after installing the Eventscripter extension.
|
#1212
|
|||
|
|||
![]()
a) show/hide help window resize able? sometime it takes 1/3 of the window real estate other time 2/3.
b) possible to set alert window custom size? c) duplicated crawledlinks is highlited in red in linkgrabber that's already been added in downloads. is there a way to return the isHighlitedRed files? e.g (isFinished, isEnabled in downloads) |
#1213
|
|||
|
|||
![]() Quote:
Alternatively, you can replace the existing content with zero length string, before adding new content. Code:
writeFile(myFile, "", true); // clear old content writeFile(myFile, newContent, true); // add new content Quote:
Quote:
Code:
www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm |
#1214
|
|||
|
|||
![]() Quote:
b) No. c) There aren't any methods which can return hightlighted links. But, since they are dupes, you can use a function to compare crawled link urls with download link urls and return crawled link objects which contain duplicate urls. |
#1215
|
|||
|
|||
![]()
good pointer. thanks.
could toolbar button or contextmenu action be intercepted? I accidentally right click on a packagename and open hundreds of tabs in the browser. Open in Browser. If there is a possibility, then I'm thinking get length of crawled in package if it greater than say 20 crawled then terminate the action. |
#1216
|
|||
|
|||
![]()
regex to match last occurrence. Looked into backtracking but still confused
Code:
var file = 'Stay healthy by walking everyday by John Doe'; //workaround var regex = /(.*?)by\s(.*?)/i; var authorName = file.replace(regex, '$2'); var authorName = authorName.replace(regex, '$2'); alert(file + '\r\n' + 'authorName: ' + authorName); |
#1217
|
|||
|
|||
![]() Quote:
Quote:
Code:
var file = 'Stay healthy by walking everyday aby John Doe'; var regex = /.*by\s(.*)/i; var authorName = file.replace(regex, '$1'); alert(file + '\r\n' + 'authorName: ' + authorName); |
#1218
|
|||
|
|||
![]()
thanks
Quote:
|
#1219
|
|||
|
|||
![]()
It can be disabled and replaced by a script based one.
|
#1220
|
|||||
|
|||||
![]()
@mgpai , @zreenmkr = thanks for the answers and advice
Quote:
the examples of scripts that saved data (link, file name, etc) that I found created txt type: dd-mmm-yyyy TEXT.txt in a specific dir on the hd [or they showed me the data in an alert window ([data])]. so for saving the data I had to: -> select link i need and "save" -> go and look for the dir -> look for the txt file -> open or rename the txt -> save it and / or move it where I needed it ... = __ = too "tiring and noisy" therefore the purpose of the scrip is to shorten everything, namely: --> select link i need --> run the script ( the script "copy" the link and open the txt in notepad) --> now i can modify the notepad ad "save as " where i want Quote:
Quote:
Quote:
edit: I did some tests but the command <<writeFile(myFile, "", true);>> does not delete the contents of the txt but adds a space ("") Quote:
I think I will modify with the above code and keep the use of real files (in the end they are light weight txt) I guess the answer is "doesn't exist" / "isn't there yet" but I try to ask it anyway: having combined a shortcut to a command (of JD) (eg F2 or chtrl + F3 etc) is there any string that tells jd something like: at "download started" run the command combined with "F2"? Last edited by BJN01; 13.03.2020 at 14:08. |
![]() |
Thread Tools | |
Display Modes | |
|
|