|
#1
|
|||
|
|||
Minimum speed?
I use 2 max chunks per download and very often when the first one finishes the speed drops a lot since one of the connections isn't working anymore. However if I press stop and start again I get maximum speed even with only 1 connection. So my question is, is there any way to tell jd to restart once the speed drops below a certain value?
|
#2
|
||||
|
||||
settings > event scripter > Reset a Download if the speed is low
raztoki
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#3
|
|||
|
|||
Thank you. What about restart instead of reset?
I changed the code to Code:
if (running[i].getSpeed() < 1400 * 1024) { //reset the download stopDownloads(); startDownloads(); } The code that is there resets the download which is not what I want. Code:
if (running[i].getSpeed() < 50 * 1024) { //reset the download running[i].reset(); } Code:
if (running[i].getSpeed() < 50 * 1024) { //reset the download stopDownloads(); startDownloads(); } Last edited by Lram32; 17.10.2015 at 15:34. Reason: merged multiple posts, please use edit. |
#4
|
||||
|
||||
please wait for coalado to respond
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#5
|
||||
|
||||
Please wait, we need to add this method first stop/start does not work, because those are async methods. stop tells controller to stop. start does only work when controller is stopped!
__________________
JD-Dev & Server-Admin |
#6
|
|||
|
|||
You can use this workaround in the meanwhile. Insert the following code between the "stop" and "start" commands.
Code:
do {} while (!isDownloadControllerIdle()); Also, the example script is meant to query and control individual links, "disable" and "enable" commands are perhaps a better fit for the script. In its current form, the script will stop and restart the downloads, even if a single link in the list of running downloads falls below the specified threshold. If you wish to use "start" and "stop" commands, it is better to base your script on total download speed using getTotalSpeed(). |
#7
|
|||
|
|||
Thanks. The do {} while () trick made the difference
What are the consequences of having this script run every single second? Doesn't it use more processing power or make jd or the pc any slower? |
#8
|
||||
|
||||
No real disadvantage Only when you script calculates the answer to all questions :p
__________________
JD-Dev & Server-Admin |
#9
|
|||
|
|||
I modified it to this but I have noticed that a lot of times it restarts even though the speed is over 1mb.
Code:
//check if downloads are running at all if (isDownloadControllerRunning() && !isDownloadControllerStopping()) { var running = getRunningDownloadLinks(); //loop through all running Downloads for (var i = 0; i < running.length; i++) { if (running[i].getDownloadDuration() > 20000) { if (getTotalSpeed() < (1000 * 1024)) { stopDownloads(); do {} while (!isDownloadControllerIdle()); startDownloads(); } } } } |
#10
|
||||
|
||||
there is new method for Download.abort() that will stop download and DowloadController will start it again when possible and resume
__________________
JD-Dev & Server-Admin |
#11
|
|||
|
|||
Fluctuations in download speed can sometimes cause a momentary drop in speed. If such a drop occurs at the exact time the event scripter is making the query, it will trigger a restart of the download. Setting short intervals as trigger can increase the chances of such restarts. Experiment with longer intervals and/or decrease the miniumum total speed limit.
You do not need to query individual links if you use getTotalSpeed(). Code:
//Check running status and speed if (isDownloadControllerRunning() && !isDownloadControllerStopping() && getTotalSpeed() < (1000 * 1024)) { // Stop and Start all Downloads stopDownloads(); do {} while (!isDownloadControllerIdle()); startDownloads(); } Here is a script using the new method jiaz mentioned earlier. It queries the current speed of individual links. Set (modify) the minimum speed limit in the script accordingly. Trigger required : Interval Code:
//check if downloads are running at all if (isDownloadControllerRunning() && !isDownloadControllerStopping()) { var running = getRunningDownloadLinks(); //loop through all running Downloads for (var i = 0; i < running.length; i++) { //check if the download has been running at least 60 seconds if (running[i].getDownloadDuration() > 60000) { //check if the current speed is below 64kb/s if (running[i].getSpeed() < 64 * 1024) { //Stop and resume the download when possible running[i].abort(); } } } } |
#12
|
|||
|
|||
Thank you I ended up using the second method with getTotalSpeed() since I still wanna check if the running downloads have been running for a while.
|
Thread Tools | |
Display Modes | |
|
|