#1
|
|||
|
|||
![]()
Tried searching the forums but I haven't found a solution.
I was wondering if someone could help me with a script for the following problem: Whenever any given download stops for one of following 3 reasons (or any reason for that matter, other than some kind of an user input), that particular download would get disabled by the script. What I mean is it needs to be actually greyed out. So when the download stops at any time during it's progress and the 'status' field says one of the following: -try restarting this link -host problem -temporarily unavailable - ETA 30 mins That particular download would be disabled by the script and JD would move on to the next one. This way when I go back to my PC I could see which files didn't finish in one go and are problematic. Basically I need to be able to finish the files in one go, without it ever stopping. If it stops during the download, I would delete the incomplete files and try again later, to see if I can hopefully finish them in one go, perhaps even on a different day. Thanks ever so much if someone could create such a script for me. (I've never used scripts before, didn't even know JD has such a feature.) Last edited by Alhague; 23.03.2025 at 13:22. Reason: added a prefix |
#2
|
||||
|
||||
![]()
This slightly modified script from the old Event Scripter Thread does what you want.
You just need to enter the *exact* status messages of the links that need to be disabled and set an Interval for how often the script should run. Enable the last line for a Test Run to get a list of current status messages for your downloads. To see how the Event Scripter works, look at this support article: https://support.jdownloader.org/en/k...event-scripter Code:
// Disable links on specific status (FBD) // Trigger Required: Interval disablePermissionChecks(); setAdvancedAlert(true); var links = getAllDownloadLinks(); var statusList = []; // Edit these lines with the *exact* status message of links to disable var disableStatus = [ "Skipped - Captcha is required", "Download limit has been reached", "Your daily download limit has been reached"]; for (i = 0; i < links.length; i++) { var link = links[i]; statusList.push(link.getFinalName() + " -> " + link.getStatus()); if (link.isEnabled() && disableStatus.indexOf(link.getStatus()) != -1) { // Disable the link link.setEnabled(false); } } // if you want a list of files and their *exact* status for a test-run // where you can copy and paste the current status enable this line: // alert(statusList.join("\r\n"));
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#3
|
|||
|
|||
![]()
That's lovely, thanks heaps for that.
![]() Looks very promising. Will try it and report back. ![]() ...my first ever script, wish me luck! ![]() |
#4
|
|||
|
|||
![]()
Works beautifully, thanks very much for this.
![]() What do you suggest a reasonable interval setting would be for this? |
#5
|
||||
|
||||
![]()
Depends on what actually caused the problem, but 5 to 10 minutes seems like a good idea. That way you're unlikely to trigger website protections for connection too fast. Note that interval settings are in milliseconds, so five minutes would be an interval of 300000 ms.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#6
|
|||
|
|||
![]()
I see, cheers for that.
During my tests, I've come across yet another status message (these are on odysee.com by the way, that's where I'm using the script): Segment:167 not loaded I have a feeling the number '167' in that message is not constant. I could be wrong though. In any case, for this 4th message, would it be possible to put just 'segment' and some wildcard between to quotes in the 'var disableStatus' section? To ensure the message is captured and acted upon, if that number happens to be random. |
#7
|
||||
|
||||
![]() Quote:
Code:
// Disable links on specific status (FBD) // Trigger Required: Interval disablePermissionChecks(); var links = getAllDownloadLinks(); var statusList = []; // Edit these lines with the status message of links to disable // Each entry is handled as a case INsensitive regular expression! var disableStatus = [ "^Skipped", "limit.*reached", "reached.*limit", "Segment:[0-9]+" ]; for (i = 0; i < links.length; i++) { var link = links[i]; if (!link.isEnabled()) continue; var disableThis = 0; for (statusNo = 0; statusNo < disableStatus.length; statusNo++) { var disableReg = new RegExp(disableStatus[statusNo],"i"); if (disableReg.test(link.getStatus())) { disableThis = 1; break; } } statusList.push(link.getFinalName() + " -> " + link.getStatus() + " -> disabled=" + disableThis); if (disableThis) link.setEnabled(false); } // if you want a list of files and their *exact* status for a test-run // where you can copy and paste the current status enable this line: // alert(statusList.join("\r\n"));
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#8
|
|||
|
|||
![]()
Brilliant, thanks.
Was wondering, regarding the regular expressions method we now have: If I do enter the exact status messages and use question marks or brackets in them between the quotes, do those need to be escaped somehow? This is what I have at the moment in that section, haven't tested it yet: Code:
var disableStatus = [ "Host problem?", "Try restarting this link (plugin outdated?)", "Segment:[0-9]+", "Temporarily unavailable" ]; (those 4 are the specific status messages I've come across so far) |
#9
|
||||
|
||||
![]() Quote:
Code:
"Try restarting this link \(plugin outdated\?\)" But as you don't have to match the *exact* status anymore, you can just as well use Code:
"Try restarting this link"
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#10
|
|||
|
|||
![]()
Sounds fab.
![]() In that case, could simply "Segment" also be used? Without specifying in the regex that there would be a colon and some unknown numbers after it. |
#11
|
||||
|
||||
![]() Quote:
So you would want to be specific enough not to get false positives on the check. In that case, just "Segment" will be fine. Every status that contains the word "segment" will trigger the script and have it disable the link.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#12
|
||||
|
||||
![]()
@Alhague
I suggest the following webtool for playing around & testing regular expressions: regex101.com
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#13
|
|||
|
|||
![]() Quote:
I see, cheers for that. Since then, I have encountered that 'segment' problem with several different numbers after it by the way. Do you think 'synchronous execution' should be enabled for this script? I'm not too sure either way, even after reading that setting's description. @pspzockerscene Thanks for that webtool recommendation. |
#14
|
||||
|
||||
![]() Quote:
This setting is more relevant when you have other triggers, like A-Download-Finished, those events can be triggered several times at the same moment, then you have to consider if you want several instances of your script running at the same time. For this script, it does not matter.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#15
|
|||
|
|||
![]()
I see, it makes sense now. Because this script finishes lightning fast, it doesn't matter either way.
I've been testing and observing, and the script works very well - thanks ever so much for your kind help with this. There's one more phenomenon that's happening, I was wondering if we could add one more feature to this scipt - or perhaps if you could point me to one that does this. I noticed that quite a few downloads get stuck, they hang at a random point during their progress. In these cases, none of those four status messages from above are shown. I just notice that there's no progress, several seconds pass, perhaps even 15-20 secs or more, and then it continues and finishes. However, the resulting files from such downloads end up being also corrupt. When this unwanted 'pause' happens during a download, if it's stuck for say 2 seconds, could that link also be disabled? Could perhaps the percentage value in the progress bar be observed, and if it doesn't increase for like 2 seconds, then action that and disable the download? |
#16
|
||||
|
||||
![]() Quote:
When this happens, it would be better to create a log and file the log-id with a support ticket explaining the problem so the developers can look into it. How to create a log see -> https://support.jdownloader.org/en/k...d-session-logs
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader |
#17
|
||||
|
||||
![]() Quote:
Quote:
Wait for when this happens /is happening right now and then create a log. Open the log dialog and close it several times. That way the log will contain several "point of time" records that are showing what is happening in that moment. then create log and post logID here
__________________
JD-Dev & Server-Admin |
![]() |
Thread Tools | |
Display Modes | |
|
|