JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #21  
Old 04.01.2017, 19:03
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,318
Default

@Tyler: either wait for response here or write him a pm
__________________
JD-Dev & Server-Admin
Reply With Quote
  #22  
Old 05.01.2017, 22:07
Wicküler Wicküler is offline
Modem User
 
Join Date: Jul 2011
Posts: 2
Default

Don't know if this should be posted since it's so simple, but I wanted a way of getting notifications on my phone via pushover when a package had finished. It was quite easy and using the code
Code:
postPage("**External links are only visible to Supporters**,
"token=appToken&user=userKey&message="
+ package.getName() +
" finished.");
with the Trigger "Package finished" is all that was needed. The userKey is located in your pushover-profile-page and the appToken can be generated there as well via "Create an API token" (somewhere near the bottom under "Your applications").

Works like a charm but if this thread is meant for more elaborate scripts, feel free to move or delete this post. Since I didn't find any other hints or tutorials for using pushover for jdownloader-notifications, I thought I'd just leave it here.
Reply With Quote
  #23  
Old 06.01.2017, 09:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,318
Default

@Wicküler: your script is perfectly fine and I'm sure it will be useful for others as well
__________________
JD-Dev & Server-Admin
Reply With Quote
  #24  
Old 06.01.2017, 13:23
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

Quote:
Originally Posted by Tyler View Post
I need a script that will stop downloads if my download speed drops below say 100kb\s for x amount of minutes and then restart after that time has passed.
Code:
// Auto stop/restart downloads if the current average speed is below limit.
// Trigger Required: "Interval"

var minSpeed = 128; // (KiB/s) <- minimum average download Speed.
var minDuration = 1; // (minutes) <- minimum download duration per link.
var waitTime = 1; // (minutes) <- wait time before restart.

if (running() && getAverageSpeed() < minSpeed * 1024) {
    stopDownloads();
    sleep(waitTime * 60 * 1000);
    startDownloads();
}

// Check if all downloads have been running for atleast the minimum duration.
function running() {
    var links = getRunningDownloadLinks();
    if (links.length > 0) {
        for (i = 0; i < links.length; i++) {
            var link = links[i];
            if (link.getDownloadDuration() < minDuration * 60 * 1000) {
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}
Reply With Quote
  #25  
Old 06.01.2017, 21:30
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

thank you mgpai, that works perfectly.
Reply With Quote
  #26  
Old 07.01.2017, 21:09
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 575
Default

is there any documentation i can look at for the event scripter?
Reply With Quote
  #27  
Old 07.01.2017, 23:28
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 15,928
Default

@Tyler
check the editor, it has doco on each method which is available.

raztoki
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #28  
Old 23.01.2017, 06:25
mrstimpy mrstimpy is offline
Modem User
 
Join Date: Mar 2010
Posts: 1
Default

Hi mgpai, can you help me with a script to move completed downloads to a new folder? This way I can pick them up with filebot to get subtitles and place them in their proper folder.

BTW, I know packagizer can do this for compressed files but I want a solution for compressed and uncompressed files.

Thanks in advance!
__________________
-=MrSTiMPy=-

Last edited by mrstimpy; 23.01.2017 at 06:28. Reason: Explained packagizer is not good enough
Reply With Quote
  #29  
Old 25.01.2017, 06:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

Quote:
Originally Posted by mrstimpy View Post
... script to move completed downloads to a new folder?
Code:
// Move finished non-archive files, to user defined folder
// Trigger required: "A Download Stopped"

var destFolder = "c:/myFolder/movedFiles"; // <- Set destination folder.

if (link.isFinished() && !link.getArchive()) {
    getPath(link.getDownloadPath()).moveTo(destFolder);
}
Reply With Quote
  #30  
Old 04.02.2017, 11:49
jdorg jdorg is offline
Baby Loader
 
Join Date: Feb 2017
Posts: 7
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Auto stop/restart downloads if the current average speed is below limit.
// Trigger Required: "Interval"

var minSpeed = 128; // (KiB/s) <- minimum average download Speed.
var minDuration = 1; // (minutes) <- minimum download duration per link.
var waitTime = 1; // (minutes) <- wait time before restart.

if (running() && getAverageSpeed() < minSpeed * 1024) {
    stopDownloads();
    sleep(waitTime * 60 * 1000);
    startDownloads();
}

// Check if all downloads have been running for atleast the minimum duration.
function running() {
    var links = getRunningDownloadLinks();
    if (links.length > 0) {
        for (i = 0; i < links.length; i++) {
            var link = links[i];
            if (link.getDownloadDuration() < minDuration * 60 * 1000) {
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}
Hi,

is it possible to also reconnect and not just stop and restart?

while testing, i realized that if i activate the speed limit in jdownloader and the speed is below the limit in your script, than it also activates the script.
could you maybe add an "suspend the script code" if "speed limit" in jdownloader is active?

and is there a way to make buttons for the toolbar, that actives/deactivates an specific script from the event scripter list?

i tried the "activate/deactivate Event Scripter Button", but it doesn't seem to work.
even if i deactivate the Event Scripter the activated scripts still run.
and i have to deactivate them in the Event Scripter List in the settings tab.
i think to get the "activate/deactivate Event Scripter Button" to work it needs a restart and thats not practical.

thank you for your work/help
:)

Last edited by jdorg; 04.02.2017 at 11:51.
Reply With Quote
  #31  
Old 04.02.2017, 18:40
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

Quote:
Originally Posted by jdorg View Post
is it possible to also reconnect and not just stop and restart?
Code:
// Request reconnect if the current average speed is below limit.
// Trigger Required: "Interval"

var minSpeed = 128; // (KiB/s) <- minimum average download Speed.
var minDuration = 1; // (minutes) <- minimum download duration per link.

if (running() && !limitEnabled() && getAverageSpeed() < minSpeed * 1024) {
    requestReconnect();
}

// Check if all downloads are resumeable and have been running for atleast the minimum duration.
function running() {
    var links = getRunningDownloadLinks();
    if (links.length > 0) {
        for (i = 0; i < links.length; i++) {
            var link = links[i];
            if (!link.isResumeable() || link.getDownloadDuration() < minDuration * 60 * 1000) {
                return false;
            }
        }
        return true;
    }
    return false;
}

// Check if Speed limit or pause is currently enabled
function limitEnabled() {
    if (callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "downloadspeedlimitenabled") || isDownloadControllerPaused()) {
        return true;
    }
    return false;
}
Quote:
Originally Posted by jdorg View Post
...is there a way to make buttons for the toolbar, that actives/deactivates an specific script from the event scripter list?
Not that I know of. And yes, just disabling the event scripter does not seem to terminate running scripts. Seems it needs to be disabled in the list.

Quote:
Originally Posted by jdorg View Post
thank you for your work/help
:)
You are welcome

Last edited by mgpai; 06.02.2017 at 13:13. Reason: Added check for non-resumeable downloads before reconnect
Reply With Quote
  #32  
Old 05.02.2017, 10:58
jdorg jdorg is offline
Baby Loader
 
Join Date: Feb 2017
Posts: 7
Default

thank you for the script, but i forgot to ask if its possible to check if one or more (active/downloading) files in the download list are NOT resumable.

when there are some of them, than suspend the script and/or give a warning alert/popup that there are NOT resumable links in the list.

EDIT:
i just had a case that my download limit on mega filehoster was reached and the download speed was 0/nothing but there was no reconnect.
what could be the reason?

Last edited by jdorg; 05.02.2017 at 12:40.
Reply With Quote
  #33  
Old 06.02.2017, 13:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

Quote:
Originally Posted by jdorg View Post
... if one or more (active/downloading) files in the download list are NOT resumable.
... than suspend the scripta
Modified the script to check for non-resumeable downloads.

Quote:
Originally Posted by jdorg View Post
... download limit on mega filehoster was reached and the download speed was 0/nothing but there was no reconnect.
In this case, I think the script will not be triggered at all. Instead, a reconnect (if enabled) would be performed by JD automatically. Jiaz should be able to provide more information in this regard.
Reply With Quote
  #34  
Old 06.02.2017, 16:07
jdorg jdorg is offline
Baby Loader
 
Join Date: Feb 2017
Posts: 7
Default

thank you for the modification with non-resumables.

for the mega filehoster limit with no reconnect, the built-in auto reconnect of jdownloader was not activated.

i thought your script would reconnect, but i will try it with the built-in auto reconnect and see if it reconnects.

EDIT:

built-in auto reconnect works after i have reached the download limit.

but it waits until all active downloads end and get decrypted.
(even with active setting to be allowed to interrupt resumable downloads for reconnect)

the problem is, that most of the time the last active downloads fall down to extreme low speed and it takes hours to end the downloads.

so i lose a lot of time in that jdownloader could have downloaded with max speed and it just needed one reconnect.

Last edited by jdorg; 07.02.2017 at 15:22.
Reply With Quote
  #35  
Old 07.02.2017, 18:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

After activating 'Auto reconnect' in JD, have you disabled the script?

If there are no active downloads, and new downloads do not start due to download limit being reached, JD should perform a reconnect automatically. On the other hand, if the downloads are running and speed drops below the specified limit, the script should request a reconnect, irrespective of whether the download limit has reached or not.
Reply With Quote
  #36  
Old 10.02.2017, 17:23
jdorg jdorg is offline
Baby Loader
 
Join Date: Feb 2017
Posts: 7
Default

sorry for late reply.

i tested with built-in auto reconnect only.
now i tested with both activated: built-in + your script and it works.
when i get limit reached "error" and download speed falls below the limit i set in your script, then it reconnects.

thank you for your help and script.
Reply With Quote
  #37  
Old 12.02.2017, 14:12
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

Check for new update logs at user defined intervals and open them in notepad.
Code:
// View Update Log
// Trigger Required: "Interval"
// OS: Windows

var int = 10; // (minutes) <- Interval between checks.

if (interval == int * 60 * 1000) {
    var logFiles = getPath(JD_HOME + "/logs/updatehistory").getChildren();
    for (i = 0; i < logFiles.length; i++) {
        var logFile = logFiles[i];
        var age = new Date() - getPath(logFile).getModifiedDate();
        if (!/self/.test(logFile) && age < int * 60 * 1000) callAsync(function() {}, "notepad.exe", logFile);
    }
} else {
    interval = int * 60 * 1000;
}
Reply With Quote
  #38  
Old 23.02.2017, 02:28
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 634
Default

Any chance to get UUID or packagename with only "archive" (method/class) and trigger "Archive extraction finished" ?
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.
Reply With Quote
  #39  
Old 23.02.2017, 04:22
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 305
Default

Quote:
Originally Posted by thecoder2012 View Post
Any chance to get UUID or packagename with only "archive" (method/class) and trigger "Archive extraction finished" ?
Does this help ?

Code:
var packageName = archive.getDownloadLinks()[0].getPackage().getName();
Reply With Quote
  #40  
Old 23.02.2017, 08:25
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 58,318
Default

Quote:
Originally Posted by mgpai View Post
Does this help ?

Code:
var packageName = archive.getDownloadLinks()[0].getPackage().getName();
this of course will only work in case there are download links
__________________
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 07:05.
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 - 2018, Jelsoft Enterprises Ltd.