#1721
|
|||
|
|||
It seems that due to this script, links aren't always automatically transfered to the downloads tab but have to be added manually. Link crawler is set to transfer and start downloads by default, yet it fails to do so on occasion.
|
#1722
|
|||
|
|||
Hello,
Sorry to bother you, but wonder if there is a way to rename the filename to be the same as the directory when I provide the save path? Thanks. |
#1723
|
|||
|
|||
Quote:
If however there is common logic/pattern in genrating the save path, for e.g. based on file name, download url, source url, etc., you can use packagizer rule or script to set them both at the same time. If you provide some working examples I can look into it. |
#1724
|
|||
|
|||
Quote:
Please wait for feedback from @Jiaz. In the meanwhile, you can try increasing the following advanced setting: Code:
LinkgrabberSettings.autoconfirmdelay |
#1725
|
|||
|
|||
Hi there,
id like a modification of this script https://board.jdownloader.org/showpo...&postcount=881 The script restart JD just when JD is in idle, but my JD is never in idle Is it possible that when a new update is availible, JD doesn´t start new downloads but finish current running downloads and then do the restart? |
#1726
|
||||
|
||||
Quote:
downloadsV2/setStopMark(long linkId, long packageId)
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 04.06.2021 at 15:50. |
#1727
|
|||
|
|||
New downloads can still start till the link/package with stop mark is finished.
|
#1728
|
||||
|
||||
set stopmark on disabled link and no further downloads will start, else further downloads will stop once the stopmark link is finished/failed or at least tried once
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 04.06.2021 at 16:31. |
#1729
|
|||
|
|||
Still a bit complicated since the trigger is interval. The stopmark will be set on each run. Also disabling a link just to set the stopmark is not an elegant solution. Will think of something.
|
#1730
|
|||
|
|||
Quote:
Code:
/* if update is avaialble, finish running downloads and restart and update when JD is Idle Trigger Required: Interval Set Interval to 600000 or more */ var updateAvailable = callAPI("update", "isUpdateAvailable"); if ( updateAvailable && isDownloadControllerRunning() && !getProperty("skipped", false) ) { getAllDownloadLinks().forEach(function(link) { if (!link.running && !link.finished) { link.skipped = true; } }); setProperty("skipped", true, false); } if ( updateAvailable && !callAPI("linkcrawler", "isCrawling") && !callAPI("linkgrabberv2", "isCollecting") && !callAPI("extraction", "getQueue").length && isDownloadControllerIdle() ) { callAPI("update", "restartAndUpdate"); } Code:
/* if update is avaialble, finish running downloads and restart and update when JD is Idle Trigger Required: Interval Set Interval to 600000 or more */ var updateAvailable = callAPI("update", "isUpdateAvailable"); if ( updateAvailable && isDownloadControllerRunning() && callAPI("downloadsV2", "getStopMark") == -1 ) { callAPI("downloadsV2", "setStopMark", 0, 0); } if ( updateAvailable && !callAPI("linkcrawler", "isCrawling") && !callAPI("linkgrabberv2", "isCollecting") && !callAPI("extraction", "getQueue").length && isDownloadControllerIdle() ) { callAPI("update", "restartAndUpdate"); } Last edited by mgpai; 04.06.2021 at 18:40. Reason: Replaced script with one which uses new method. |
#1731
|
|||
|
|||
Quote:
Code:
/toolbar/toggleStopAfterCurrentDownload |
#1732
|
||||
|
||||
@mgai: just set stopmark on any running download. I don't think that it's that impotant and the script will work fine again
I can also add new method to specifically set stopmark to stop new downloads instant, if you prefer that
__________________
JD-Dev & Server-Admin |
#1733
|
|||
|
|||
Quote:
Quote:
|
#1734
|
||||
|
||||
@mgpai:I can add new set stopmark method that also supports the *don'T start any new downloads* handling.
after next core update new logic for setStopMark linkID and packageID = -1 = NONE, same as removeStopMark linkID and packageID = 0 = HIDDEN, special mode to instant stop new downloads and just finish running ones
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 04.06.2021 at 18:00. |
#1735
|
|||
|
|||
Nice. Thanks Jiaz.
|
#1736
|
||||
|
||||
__________________
JD-Dev & Server-Admin |
#1737
|
|||
|
|||
Updated the script with new method. Working fine. Thanks Jiaz.
|
#1738
|
||||
|
||||
@mgpai: Thanks for the feedback
__________________
JD-Dev & Server-Admin |
#1739
|
|||
|
|||
Big thanks to mgpai and Jiaz!
I added the script (the first one for my JD ) and note the startup time. Im realy happy now, my JD will be up to date and i don´t have to manually set stopmarks and trigger the restart |
#1740
|
||||
|
||||
@A-Dude: All thanks goes to mgpai
__________________
JD-Dev & Server-Admin |
#1741
|
|||
|
|||
So today there was an update and the script works fine.
There where two downloads running, first with 25 minutes left and second with 5h 20 min. After the first download was completed, no more download started. The second download was resumable, i stoped it manualy and after some minutes jdownloader did the restart. How i understand the script, it starts every 10 minutes and if there an update it remove stopmarks and set new once. And there is my new modification wish. Is it possible after setting stopmarks, to check if the running downloads are resumable, when yes -> stop downloads do the restart? |
#1742
|
||||
|
||||
Quote:
Quote:
to update itself and ask again for a new captcha in my opinion I would just let the running downloads finish and then update JD
__________________
JD-Dev & Server-Admin |
#1743
|
|||
|
|||
How to make it so that when downloading from e-hentai fails, a reconnection is automatically started, and then the download of files is restarted?
|
#1744
|
||||
|
||||
@VanTuz: Why does the download fail? Can you provide a log? Sounds more like we should check/fix the plugin
__________________
JD-Dev & Server-Admin |
#1745
|
||||
|
||||
@VanTuz
This is probably not related to our EventScripter feature. Please post your request via separate thread in this subforum or use older threads related to e(x)hentai e.g. this one. -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1746
|
|||
|
|||
Goodmorning everyone.
1) I am using the script to automatically rename the files suggested to me in this topic at the time, and I have noticed that every now and then a file is "skipped"; [I solved it by creating a duplicate of the script commanded by "button"] , but, on a curiosity level, you can write a command inside the script to tell it like "run me N times in a row" ? 2) is feasible a script (perhaps better by button) which: -set interrupted - unfinished downloads to "resume" -start the download (and do it N times , at each time interval at the end of the download ?) or a script that at the end of the download of the links of all the packages (not file by file) : - find if there are interrupted / unfinished downloads - If Yes --> set then to "resume" -start the download. rereading it seems a bit strange speech, but I hope you can understand what I meant. |
#1747
|
|||
|
|||
Quote:
Quote:
What kind of status messages are displayed for the failed/interrupted downloads? |
#1748
|
|||
|
|||
1) the script is based on this :
https://board.jdownloader.org/showpo...postcount=1155 (page 58 , post n #1155) but with: - trigger "Hook packaging" - change both by name of individual files and by packages and it's something similar to this:
Spoiler:
Code:
/-------------------------------------------------------- // <Clean Names> ( file + package) // Trigger: packaged Hook // // For Name Of the Package (PACKAGENAME) // disablePermissionChecks(); if (name = CupPH = "Clean-up packagenames Hook") { getAllCrawledPackages().forEach(function(package) { var curName = package.getName(); var newName = curName; var replace = function(find, replace) { newName = newName.replace(find, replace); } replace("-Vol ","-V0"); replace("Ch ","Ch"); replace("-Chapter ","-Ch"); replace("Ch_","Ch"); replace("chapter ","Ch"); replace("&","e"); //... omiss.. replace("–","-"); replace("I Can’t","I Can't"); //... omiss... replace("Won’t","Won t"); replace("Didn’t","Didn t"); replace("I’m ","I m "); replace("King’s","King s"); //.....omisss.... replace("Chapter_Chapter","Ch"); replace("ChCh","Ch"); replace("--","-"); //.....omisss..... replace("☆ ",""); replace("【","["); replace("】","]"); replace("①",""); replace(/[~]/g,"-"); replace(/["]/g," "); replace(/[❤:/\*%^°]/g," "); replace(""",""); replace("《","["); replace("》","]"); replace("「","["); replace("」","]"); if (curName != newName) package.setName(newName); }) } // // For the name of the file (FILENAME) // if (name = CupFH = "Clean-up filenames Hook") { getAllCrawledLinks().forEach(function(fileName) { var curName = fileName.getName(); var newName = curName; var replace = function(find, replace) { newName = newName.replace(find, replace); } replace("Ch_","Ch"); //.....omisss.... replace("chapter ","Ch"); replace("Chapter ","Ch"); replace(" -Page_","-Page_"); replace(" -Page_h","-Page_"); replace("☆ ",""); replace("&","e"); replace("I Can’t","I Can't"); replace("I’m ","I m "); replace("King’s","King s"); replace("Chapter_Chapter","Ch"); //....omiss example .... replace("【","["); replace("】","]"); replace("①",""); replace(/[~]/g, "-"); replace(/["]/g, " "); replace(/[❤:/\*%^?<>°]/g, ""); replace(""", ""); replace("《","["); replace("》","]"); replace("「","["); replace("」","]"); if (curName != newName) fileName.setName(newName); }) } as I said, I solved the "problem" by creating a copy of the scipt combined with "pressed toolbar button" trigger , and clicking on the associated button, the files that are "skipped" from time to time are renamed. I imagine that if I write a command N times in the script this order is executed N times, but since the "lines" << replace ("AAA", "aaa"); >> are many, the script would become very long , and I would end up getting lost in it to insert other voices. But could there be some simple lines to add at the end of the script to "double" the effect? Code:
disablePermissionChecks(); if (name = CupPH = "Clean-up packagenames Hook") { getAllCrawledPackages().forEach(function(package) { var curName = package.getName(); var newName = curName; var replace = function(find, replace) { newName = newName.replace(find, replace); } replace("-Vol ","-V0"); //..omiss other replace if (curName != newName) package.setName(newName); }) } if (name = CupFH = "Clean-up filenames Hook") { getAllCrawledLinks().forEach(function(fileName) { var curName = fileName.getName(); var newName = curName; var replace = function(find, replace) { newName = newName.replace(find, replace); } replace("Ch_","Ch"); //.....omisss.... if (curName != newName) fileName.setName(newName); }) } *** repeat "N" times, or *** execute function "CupFH", execute function "CupPH" 2) yes , after the skipped the dowload stop/end and we have the message of error for the file skipped . I recently had some skipped files with "file not found" error ; the files actually exist, but Cloudflare (without captcha) has a hand in it. But I found that if I set "resume" and restart the dl they are downloaded (with "restart" the filename changes, it doesn't go through the above script ... and it bothers me). So I wonder if you can write a script that (at time intervals (e.g. 1 minute)), If detects skipped files : -set then to "resume" -start the download. (a defined number of times (otherwise you risk an infinite loop)) -it there aren't skipped file --> do nothing |
#1749
|
|||
|
|||
Quote:
Your rename skipping can be most likely solved with a single script with some modifications. I will need more info on your current scripts/triggers. Find me in JD Chat when you are free: Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader Quote:
Code:
/* Resume offline links Trigger: Download Controller Stopped */ var started = false; getAllDownloadLinks().forEach(function(link) { if (link.finalLinkStatus == "OFFLINE") { if (!started) { startDownloads(); started = true; } link.resume(); } }) An interval trigger might not be suitable for this use case. While this script runs only when download controller is stopped, it can result in a loop if the files are permanently offline. Can avoid it by using additional check for only those hosts which are affected by the problem described by you. Last edited by mgpai; 19.06.2021 at 20:24. Reason: Variable was inside the loop. Moved it outside. |
#1750
|
|||
|
|||
Quote:
Code:
/* Cleanup names Trigger : Toolbar button pressed */ if (name == "Cleanup packagenames") { getAllCrawledPackages().forEach(function(i) { var replace = function(a, b) { i.name = i.name.split(a).join(b); } replace("-Vol ", "-V0"); }) } if (name == "Cleanup filenames") { getAllCrawledLinks().forEach(function(i) { var replace = function(a, b) { i.name = i.name.split(a).join(b); } replace("Ch_", "Ch"); }) } |
#1751
|
|||
|
|||
Great scripts here, very useful, thanks to all contributors!
|
#1752
|
|||
|
|||
@ mgpai
sorry for the late answer , I had unforeseen commitments and didn't have time to try to contact you. 1) x Resume offline links script : for now I used the code you indicated but with trigger "toolbar button pressed" (I added a button in the toolbar)
Spoiler:
Code:
//Resume offline links and start DL //trigger: toolbar button pressed //name scipt =Resume Skipped And DL //add button "event script" in toolbar and select this script var started = false; getAllDownloadLinks().forEach(function(link) { if (link.finalLinkStatus == "OFFLINE") { if (!started) { startDownloads(); started = true; } link.resume(); } }) I tried it and it works. (For what I have to do I have seen that it is enough for now). thanks. For the trigger "Download Controller Stopped" you have to using additional check for specific hosts , but I don't know how to set them up and probably would be overkill for now. 2) <<...script to automatically rename the files ... every now and then a file is "skipped">> I try to explain the "phenomenon" I noticed: - copy link - JD find the file and hook package - Now the script "Autorename bla bla" with trigger "packagezer hook" do is job . So , the package and file they should all be renamed according to the written rules of the script, like : Code:
original file --------------------------------renamed file bla bla bla Vol 1 chapter 55 -----> bla bla bla V01-Ch55 -fileExample chapter 55 01.jpg--->-fileExample ch-55_01.jpg -fileExample chapter 55 02.jpg--->-fileExample ch-55_02.jpg -fileExample chapter 55 03.jpg--->-fileExample ch-55_03.jpg -fileExample chapter 55 XX.jpg--->-fileExample ch-55_XX.jpg Code:
bla bla bla Vol 1 chapter 55 -----> bla bla bla V01-Ch55 -fileExample chapter 55 01.jpg--->-fileExample ch-55_01.jpg -fileExample chapter 55 02.jpg--->-fileExample ch-55_02.jpg -fileExample chapter 55 03.jpg--->-fileExample chapter 55 03.jpg -fileExample chapter 55 XX.jpg--->-fileExample ch-55_XX.jpg I would have thought about duplicating the script in order to have a "double" check of the names, but it seemed exaggerated ... but if I wanted to do this test, is it possible to insert a delay in the execution of the second script? |
#1753
|
|||
|
|||
As mentioned before, the original script was written for toolbar button. The 'packagizer hook' is triggered twice. The script has to be modified to run only once. Also, skipping may occur if 'synchronous execution' is disabled when you are using it with 'packagizer hook'.
|
#1754
|
|||
|
|||
@mgpai
hi, i have updates: I have made some attempts to fix the script that renames files trying to fix "==" and the like ... but I have not had noticeable results . (most likely the corrections I should make exceed my knowledge on the subject ) BUT ... Quote:
... and problem solved ! no files are skipped. So if everything continues to work, I'd say I've solved it for now. p.s = Quote:
I have only one script containing the 2 functions (file name + package name) so it should only run 1 time, or am I wrong / ignoring something I don't know? |
#1755
|
||||
|
||||
@BJN01: The packagizer has two stages. One before the linkcheck, one after the linkcheck.
this event has two additional variables, "linkcheckDone" can be true/false and "state" can be "AFTER" and "BEFORE"
__________________
JD-Dev & Server-Admin |
#1756
|
|||
|
|||
Before and after linkcheck or before and after packagizer rules are applied? I was of the understanding that it was the latter, since linkcheckDone returns the same value (true) for both BEFORE and AFTER states, while if a package name is set/modified via packagizer rule, it is reflected only in the AFTER state and not in BEFORE state.
|
#1757
|
|||
|
|||
@Jiaz / @mgpai : thanks for the clarifications .
rereading the topic from the beginning in search of "inspiration" I found something interesting: https://board.jdownloader.org/showpo...&postcount=191
Spoiler:
Code:
Code: // Run external program if package contains 'pdf' file // Trigger: "Package finished" var pdf = package.getDownloadLinks().some(function(link) { return getPath(link.getDownloadPath()).getExtension() == "pdf"; }); if (pdf) { var downloadFolder = package.getDownloadFolder(); var converter = "f:/downloads/files/pdfConverter.exe"; callAsync(function() {}, converter, downloadFolder, downloadFolder, "-c", "PNG", "-p", "1", "-pd", "4x5"); } the script started the conversion of the pdf file after the download took place using specific software indicated by the user of the time. I would like to modify it so that when DL finished it would open the php file in notepade, and I came up with something like this: Code:
//trigger = packaged finisched disablePermissionChecks();/*disable permission checks*/ var php = package.getDownloadLinks().some(function(link) { return getPath(link.getDownloadPath()).getExtension() == "php"; // ex "pdf" }); if (php) { var downloadFolder = package.getDownloadFolder(); //var converter = "f:/downloads/files/pdfConverter.exe"; var textEditor = "notepad.exe"; //callAsync(function() {}, converter, downloadFolder, downloadFolder, "-c", "PNG", "-p", "1", "-pd", "4x5"); callAsync( textEditor , "????"); // how do i indicate the file to open if the name changes every time? } <<error : Can't find method org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callAsync(string,string,st ring). >> how do i indicate the file to open if the name changes every time? I guess I should create a variable like "phpFile" and have something like: Code:
var phpFile = /* how to find php file */ callAsync( textEditor , phpFile ); 2) in the drop-down menu of the linkgrabber there is the command "open link in browser", would it be possible to open a link with notepad without downloading the file? [ like << Open link in Notepad>> or << Open as Txt> ] I have made some attempts but I cannot indicate "the link" that notepade has to open. (p.s = I did some tests and if in notepade in the window open / file name you paste the link + enter it opens the linked file, so it should be possible ... or not? ) Code:
// trigger =linkgrabber contextmenu button pressed disablePermissionChecks(); if (name == "Open as txt"){ var textEditor = "notepad.exe"; var links = lgSelection.getLinks(); var urls = []; for (i = 0; i < links.length; i++) { var link = links[i];} callAsync(textEditor ,/* ???? */ ); // how do i indicate the link of the file to open ?? //alert (/***/); //how do i indicate the link of the file to open ?? } |
#1758
|
|||
|
|||
Code:
/* Open php file in text editor Trigger : A download stopped */ if (link.finished) { var file = getPath(link.downloadPath); if (file.extension == "php") { var editor = "notepad.exe"; callAsync(null, editor, file); } } What do you mean by "without downloading"? Can you give an example? |
#1759
|
|||
|
|||
@mgpai : thanks x the script, it works perfectly.
Quote:
- copy "link / url " - JD "find" the file - now the file are in the linkgrabber windows (in packages, with names etc.) -1 left mouse click on a file -pop-up menu appears -in there is a command: "open in browser" this command opens a browser page with the selected link (this link remains in the linkgrabber page and the file is not downloaded to the hd) so I was wondering if it was possible to do a similar thing but open the file in notepad (or something similar). ...but I'm afraid I understand that you need to have a physical file on the hd to open it as txt. as an "alternative" I would also have thought to work around I would have to download a temporary copy (to be deleted) and open it after DL ... but in doing so I would "use" the link in the linkgrabber window (which would then "disappear")... then after selecting the file and "pressing" the command in the drop-down menu (eg "Open As Txt") , the script should: - create a copy of the link in the linkgrabber window (assuming it is possible) - start download the "copy link" as temporary file ( in a specific directory like " temp" os similar) - open the file as txt in notepade ( or similar , {alert(filetemp)} ?? it's possible ? ) . -... and finally delete the "temporary" file. .... .. ...I admit that re-reading it makes less and less sense ... .... Last edited by BJN01; 05.07.2021 at 12:10. |
#1760
|
|||
|
|||
Are they direct links?
|
Thread Tools | |
Display Modes | |
|
|