JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 24.01.2017, 00:37
joker950 joker950 is offline
Modem User
 
Join Date: Jan 2017
Posts: 3
Default Script Reset doesn't work

Hi all!
Sometimes it happens that some downloads of easybytez are slow so i created a script to reset a download if the speed is slower than 2mb/s (obviously because I usually go to 6mb /s).
The problem is that when the script is activated, the download is not reset but only stopped and restarted from the same point.
Here's the code:
HTML 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 30 seconds
        if (running[i].getDownloadDuration() > 10000) {
            //check if the current speed is below 50kb/s
            if (running[i].getSpeed() < 2500 * 1024) {
                //reset the download
                //running[i].reset();
                //stop the download and restart it
                running[i].abort();
Reply With Quote
  #2  
Old 24.01.2017, 09:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 67,320
Default

And what is wrong about that? Stop/Resume is okay as it restarts the download. In case speed does not increase, it won't help to do it again. Reset the link will only make you lose all data that got already loaded.

uncomment the .reset line if you really want to reset the download
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 24.01.2017, 15:33
joker950 joker950 is offline
Modem User
 
Join Date: Jan 2017
Posts: 3
Default

Quote:
Originally Posted by Jiaz View Post
And what is wrong about that? Stop/Resume is okay as it restarts the download. In case speed does not increase, it won't help to do it again. Reset the link will only make you lose all data that got already loaded.

uncomment the .reset line if you really want to reset the download
I know that, I've already tried several times, when a part goes slow if i stop it and restart manually nothing changes, but if I reset completely the part when it restart from zero the speed back to the maximum. I don't know why, but it's true.
So, to reset the part I have to delete .reset? Sorry if i don't understand very well english, is not my native language...
Reply With Quote
  #4  
Old 24.01.2017, 17:32
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 67,320
Default

Quote:
//reset the download
running[i].reset();
//stop the download and restart it
//running[i].abort();
modify like shown
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 25.01.2017, 16:42
joker950 joker950 is offline
Modem User
 
Join Date: Jan 2017
Posts: 3
Default

Works great! Thanks so much!!!
Reply With Quote
  #6  
Old 25.01.2017, 16:44
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 67,320
Default

You're welcome
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 01:34.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.