JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #2681  
Old 25.10.2023, 15:35
Magi Magi is offline
Super Loader
 
Join Date: Aug 2018
Posts: 29
Default

Hi!

Has anyone made scripts to automatically add a list of proxies from url or local file to the connection manager and automatically remove problematic proxies from it?

Thanks.
Reply With Quote
  #2682  
Old 25.10.2023, 16:58
MLi MLi is offline
Mega Loader
 
Join Date: Oct 2010
Posts: 68
Default

Hi!
I'm a little overwhelmed by the length of this thread, so I apologize if what I'm looking for is hiding in one of the 135 pages...

I'm trying to remove downloads that are already downloaded. My download list is getting a little out of hand, and some hosters (e.g. mountfile) don't handle the way JD does it out of the box well (i.e. they charge for download, even if it's not actually downloaded, just accessing the download page for the filename triggers the charge).

Is there an EventScripter script that goes through the downloads list and checks if the target file exists, and if so removes the download? If not is there anything somewhat similar that I can base a new script on?

Thanks for your help!
Reply With Quote
  #2683  
Old 26.10.2023, 10:32
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 71,088
Default

Hi MLi,
I'm not helping with custom scripts but:
Quote:
Originally Posted by MLi View Post
some hosters (e.g. mountfile) don't handle the way JD does it out of the box well
JDownloader is not logged in during linkcheck of mountfile.net links so this can't be happening.
Whatever is taking away your traffic it's not JDownloader.

If you want me to investigate this further please report it in a dedicated thread in the hoster plugins subforum.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #2684  
Old 27.10.2023, 16:36
hackmonker hackmonker is offline
Modem User
 
Join Date: Mar 2023
Posts: 4
Default Script to move files from source to a different folder

Can someone help me to create a script that will move the download completed and unarchived files from source to destination keeping the structure intact. But package wise, meaning move the files after the entire package has completed downloading and not per file.

I did get a script from here
Code:
/*
    Move downloaded non-archive files to user-specified folder for each package
    Trigger: A Download Stopped
*/

// Iterate through all packages
for (var i = 0; i < link.getPackage().size(); i++) {
    var thisPackage = link.getPackage().get(i);

    if (link.finished && !link.archive) {
        var downloadFolder = thisPackage.downloadFolder;
        var newFolder = downloadFolder.split("E:\\Download\\Temp\\").join("E:\\Download\\Completed\\");

        if (newFolder != downloadFolder) {
            getPath(link.downloadPath).moveTo(newFolder);
        }
    }
but this moves after each file has been completed and not per package. any ideas? thanks a lot
Reply With Quote
  #2685  
Old 28.10.2023, 10:52
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,614
Default

@hackmonker
either two ways? or both ways
run the trigger on the event scripter, to run on is package finished?
or according to the help, use var myBoolean = myFilePackage.isFinished();
you only check that the link has finished
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #2686  
Old 30.10.2023, 23:59
mr_n0x mr_n0x is offline
Modem User
 
Join Date: Oct 2023
Posts: 1
Default Move finished package

Hi folks,

could anyone provide me a snippet, which moves an extracted package

from /output/finished/$PACKAGENAME
to
from /output/extracted/$PACKAGENAME

I was trying hard - but failing with getting the packageName

Last edited by mr_n0x; 10.11.2023 at 01:22.
Reply With Quote
  #2687  
Old 15.11.2023, 21:11
pepe333 pepe333 is offline
Baby Loader
 
Join Date: Oct 2023
Posts: 7
Default

Hello!

Could you please help me with advanced links grabber filtering.
I want to filter grabbed links from prnhub by video tags/category. For example don't grab links which have "BJ" tag.

pspzockerscene has suggested to do that via Packagizer rule by adding tags to the file name and then applying LinkGrabber filter. But I don't see it as ideal solution because it will produce unreasonably long file names with all those tags and category names included.

So I thought about using [Event Scripter]. Something like this:
Code:
def filter_tags(my_tag, tags_list):
   return my_tag in tags_list #False: reject URL, don't add to LinkGrabber list

Unfortunately Event Scripter Knowledgebase doesn't provide any knowledge about available API (classes) so I have no idea where to start. Would be much appreciated for any help.
Reply With Quote
  #2688  
Old 16.11.2023, 05:23
reaper2895 reaper2895 is offline
Modem User
 
Join Date: Oct 2021
Posts: 1
Default

Hey everyone. I'm trying to write a script that detects when the download speed is below a certain threshold (in this case, 90kb/s), and then launches a batch file that connects to a random VPN network. The batch file is working perfectly, but this event script is not. It ignores the wait time, and launches the batch file even if there are no files downloading, and when there are multiple files downloading that don't match the criteria.

Here's the code so far:
Code:
// Function to wait for a download to start
function waitForDownloadStart(downloadLink, timeoutMs) {
    var startTime = new Date().getTime();
    
    while (!downloadLink.isStarted() && (new Date().getTime() - startTime) < timeoutMs) {
        // Wait for the download to start
    }
    
    return downloadLink.isStarted();
}

// Flag to indicate whether there is any download over 90kb/s
var anyDownloadOver90KBps = false;

// 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++) {
        var downloadLink = running[i];
        
        // Wait for the download to start (timeout of 30 seconds)
        var downloadStarted = waitForDownloadStart(downloadLink, 30000);
        
        if (downloadStarted && downloadLink.getDownloadDuration() > 30000) {
            // Check if the current speed is below 90kb/s
            if (downloadLink.getSpeed() >= 90 * 1024) {
                // Set the flag to indicate there's a download over 90kb/s
                anyDownloadOver90KBps = true;
                break; // No need to check further, we found one.
            }
        }
    }
}

// Only proceed if there are no downloads over 90kb/s
if (!anyDownloadOver90KBps) {
    var vpnreset = "C:/Program Files/NordVPN/nordvpn_reconnect.bat";
    callSync(vpnreset);
}
Reply With Quote
  #2689  
Old 19.11.2023, 21:27
MCorgano MCorgano is offline
Modem User
 
Join Date: Oct 2023
Posts: 1
Default

1 request 1 question
First, I am bulk downloading files where site page -> 3-5 download host links -> same files, BUT when I add them to jdownloader it evaluates a different name for the different hosts. For instance mega, 1fitcher, etc will call the file <filename with id q#######>. Other hosts might call it just <q######> with the same ID number, resulting in 2 packages, that are both downloading the same duplicate file. What I am looking for is a way that when a package is moved to the download list, run a regular expression on it and all other downloads to get the ID number, and if there are 2 packages with the same ID number merge them taking the package name and download location of whichever matched item has the longer package name.

Second, I'm trying to figure out where I find documentation for like, what the event names are, what variables I can reference in what event, etc. I could probably make this myself but I don't know what anything is called when programming an event script to reference it.
Reply With Quote
  #2690  
Old 21.11.2023, 15:32
DerChrimtess DerChrimtess is offline
Baby Loader
 
Join Date: May 2011
Posts: 7
Default

Hi I am looking for an JDownloader EventScripter script that reads a list of filenames from a text file
(or a gui input Text Area where you can paste the content in)
One Filename per line.

An example input would be:
file1.mp4
file with whitespace.mp3
Arcive1_part1.rar
Arcive1_part2.rar

And then it compares the input files that were read from the input text file with the files in the Jdownloader LinkGrabber / Downloads and removes the files that are found with an exact filename.



Can someone provide me with a template or give me some hints how to start
Reply With Quote
  #2691  
Old 21.11.2023, 15:35
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by MCorgano View Post
First, I am bulk downloading files where site page -> 3-5 download host links -> same files, BUT when I add them to jdownloader it evaluates a different name for the different hosts.....[snip]
This is easily done with some regular expressions in the Packagizer, click the Wiki/FAQ link at the top here and check out the Knowledgebase pages for the Packagizer - or come to the support chat and i'll able to help you out with it.

Quote:
Originally Posted by MCorgano View Post
Second, I'm trying to figure out where I find documentation for like, what the event names are, what variables I can reference in what event, etc. I could probably make this myself but I don't know what anything is called when programming an event script to reference it.
When you create a new script in the Event Scripter or edit an existing script, you can click on the "Show/Hide Help" menu item at the top which will give you a complete list of all functions and features available to the event script. The variables are named very descriptive and mostly self-explanatory. Also the Event Scripter forum thread here will also give you tons of working scripts you can use and edit yourself.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2692  
Old 21.11.2023, 17:13
DerChrimtess DerChrimtess is offline
Baby Loader
 
Join Date: May 2011
Posts: 7
Default

when I do a log("Test") in the EventScripter in which File should this appear ?

In the advanced Settings "Log.debugmode" is enabled

The folder "logs\1700582573928_Tue, Nov 21, 2023 17.02 +0100" contains 39files but if I search all files I cannot find the string "Test"
Reply With Quote
  #2693  
Old 22.11.2023, 01:01
pepe333 pepe333 is offline
Baby Loader
 
Join Date: Oct 2023
Posts: 7
Default

Hello!

Is there any API reference for Event Scripter?
How do I know what classes, methods, properties and class instances are available for scripting?
Reply With Quote
  #2694  
Old 22.11.2023, 02:47
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by pepe333 View Post
Is there any API reference for Event Scripter?
How do I know what classes, methods, properties and class instances are available for scripting?
See my previous response:

Quote:
Originally Posted by FBD View Post
When you create a new script in the Event Scripter or edit an existing script, you can click on the "Show/Hide Help" menu item at the top which will give you a complete list of all functions and features available to the event script. The variables are named very descriptive and mostly self-explanatory. Also the Event Scripter forum thread here will also give you tons of working scripts you can use and edit yourself.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2695  
Old 23.11.2023, 15:00
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 670
Default Play sound when Internet connection is interrupted, e.g. when (automatically) “reconn

A script would be good that played a sound when the Internet connection is interrupted, for example when (automatically) "reconnecting"?
__________________
Aktuelles Windows
Reply With Quote
  #2696  
Old 23.11.2023, 18:48
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by Dockel View Post
A script would be good that played a sound when the Internet connection is interrupted, for example when (automatically) "reconnecting"?
The Event Scripter has two events that can trigger scripts,
  • Before a Reconnect
  • After a Reconnect

so if you want to play a sound, just create a script with the appropriate trigger that plays the sound file like this:

Code:
playWavAudio(JD_HOME+"/themes/standard/org/jdownloader/sounds/captcha.wav");
Adjust the path to the audio file to any wav file you have on your pc.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2697  
Old 23.11.2023, 20:18
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 670
Default

Thank you very much!

How could I use this file (instead of captcha.wav):
"I:/Eigene Dateien/Sounds - Audio/Nanu (erste) - Mr. (s01e01) - kann sprechen (1961-01-05, 1961.mp3"

I guess, there is something wrong:
Code:
playWavAudio("I:/Eigene Dateien/Sounds - Audio/Nanu (erste) - Mr. (s01e01) - kann sprechen (1961-01-05, 1961.mp3"
);
Could the playing of the sound be delayed by 3 or 4 or 5 minutes?



Quote:
The Event Scripter has two events that can trigger scripts,

Before a Reconnect
After a Reconnect
This does not include another cause as of the connection than a reconnect, I assume.
__________________
Aktuelles Windows
Reply With Quote
  #2698  
Old 23.11.2023, 21:28
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by Dockel View Post
How could I use this file (instead of captcha.wav):
"I:/Eigene Dateien/Sounds - Audio/Nanu (erste) - Mr. (s01e01) - kann sprechen (1961-01-05, 1961.mp3"
Correct so far but notice that the function is called playWAVAudio, so you need a .wav file.

Quote:
Originally Posted by Dockel View Post
Could the playing of the sound be delayed by 3 or 4 or 5 minutes?
you can add this before the playWavAudio command:

Code:
sleep(180000);
Which will delay the play of the wav file by 180 seconds (number is in milliseconds)

Quote:
Originally Posted by Dockel View Post
This does not include another cause as of the connection than a reconnect, I assume.
Correct. A connection problem/interruption is hard to detect from within jdownloader but you could do a script like this:

Code:
var myDownloadLink = link;
if (!myDownloadLink.isFinished() && myDownloadLink.getBytesLoaded() > 0) {
    playWavAudio(JD_HOME+"/themes/standard/org/jdownloader/sounds/captcha.wav");
}
When you create a script like that ^^ and activate it with the trigger "A download stopped" it will check if the download has been started, then stopped but it wasn't finished yet.Then the audio will be played.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2699  
Old 23.11.2023, 22:05
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 670
Default

OK, everything done / corrected, many thanks!

Quote:
When you create a script like that ^^ and activate it with the trigger "A download stopped" it will check if the download has been started, then stopped but it wasn't finished yet.Then the audio will be played.
Okey, done / added, many thanks!

It only now occurs to me: would it have been possible to create a script that would play a sound if the Internet connection had not been re-established after 4 minutes when reconnecting?
__________________
Aktuelles Windows
Reply With Quote
  #2700  
Old 23.11.2023, 22:45
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by Dockel View Post
It only now occurs to me: would it have been possible to create a script that would play a sound if the Internet connection had not been re-established after 4 minutes when reconnecting?
Yes, you could add a delay again and then try to fetch a webpage like this:

Code:
sleep(240000);
var myhtmlSourceString = getPage("http :// ifconfig .me/mime"); // remove spaces in url!
if (!myhtmlSourceString.includes("text/html")) {
    alert("We're still offline'");
    playWavAudio("alert_alert_alert.wav");
}
You can test any website for an existing string to check if you're back online.

Note: considered to use ping to check online status, but ping needs different parameters and returns different output depending on the platform so i went with the webpage instead...
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader

Last edited by FBD; 23.11.2023 at 22:46. Reason: url-fix
Reply With Quote
  #2701  
Old 23.11.2023, 23:05
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 670
Default

Great, thank you!

Is the URL added correctly(?):


Code:
//play a sound if the Internet connection had not been re-established after 4 minutes when reconnecting

sleep(240000);
var myhtmlSourceString = getPage("https://jdownloader.org/");
if (!myhtmlSourceString.includes("text/html")) {
    alert("We're still offline'");
    playWavAudio("I:/Eigene Dateien/Sounds - Audio/Mr.(s01e01) - kann sprechen (1961-01-05, 1961.wav");

What trigger do I have to use? One of them?

Before a Reconnect
After a Reconnect
__________________
Aktuelles Windows
Reply With Quote
  #2702  
Old 23.11.2023, 23:28
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by Dockel View Post
Is the URL added correctly(?):
No, i used "http :// ifconfig .me/mime" (without the spaces of course, have to add them otherwise the forum will remove the url). You can use any website to test, you just have to adjust the test string "text/html" to match the url you use. If the test-string is *not* found on the page - because the webpage could not be loaded - it will play the alert sound.

Quote:
Originally Posted by Dockel View Post
What trigger do I have to use? One of them?
If you want the test to be executed after jdownloader executed a reconnect, you'd use the "After a Reconnect" trigger. To run the test after a download failed, you add it to the other code i posted with the trigger "A download stopped":

Code:
var myDownloadLink = link;
if (!myDownloadLink.isFinished() && myDownloadLink.getBytesLoaded() > 0) {
    playWavAudio(JD_HOME+"/themes/standard/org/jdownloader/sounds/captcha.wav");

    sleep(240000);
    var myhtmlSourceString = getPage("http :// ifconfig .me/mime"); // remove spaces in url!
    if (!myhtmlSourceString.includes("text/html")) {
        alert("We're still offline'");
        playWavAudio("alert_alert_alert.wav");
    }
}
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2703  
Old 23.11.2023, 23:56
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 670
Default

This should happen: play a sound if the Internet connection had not been re-established after 4 minutes when reconnecting

Quote:
If you want the test to be executed after jdownloader executed a reconnect, you'd use the "After a Reconnect" trigger.
So JD starts a reconnect, but the Inernet connection cannot be established. So the reconnect failed. To achieve that, I have this script / settings now:

__________________
Aktuelles Windows
Reply With Quote
  #2704  
Old 24.11.2023, 00:06
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by Dockel View Post
This should happen: play a sound if the Internet connection had not been re-established after 4 minutes when reconnecting
You mixed those up, sorry if i wasn't clear enough, so for clarity;

Script that waits 4 minutes after a reconnect triggered by jDownloader and alerts you if the internet connection was not re-established:

Code:
// Activate trigger: After a reconnect
// Remove spaces in test-url!
sleep(240000);
var myhtmlSourceString = getPage("http :// ifconfig .me/mime"); // remove spaces in url!
if (!myhtmlSourceString.includes("text/html")) {
    alert("We're still offline after a reconnect");
    playWavAudio("alert_alert_alert.wav");
}


Script that detects if the internet connection randomly goes down during downloading:

Code:
// Activate trigger: A download stopped
var myDownloadLink = link;
if (!myDownloadLink.isFinished() && myDownloadLink.getBytesLoaded() > 0) {
    alert("Internet connection lost");
    playWavAudio(JD_HOME+"/themes/standard/org/jdownloader/sounds/captcha.wav");
}
Note: Detecting if the internet connection is down is not a perfect absolute test... it would also be triggered if just the host you're downloading from is suddenly/temporarily unreachable.

You can have both scripts activated and running at the same time
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader

Last edited by FBD; 24.11.2023 at 00:25. Reason: Added note
Reply With Quote
  #2705  
Old 24.11.2023, 00:26
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 670
Default

Very sorry for my confusion.

Now I seem to have made it. Both scripts running. I'll see if I've really done everything right on the next failed reconnects / interrupted connection.

Thank you very much for your help and scripts!
__________________
Aktuelles Windows
Reply With Quote
  #2706  
Old 24.11.2023, 20:26
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Post Event Scripter Script: check if file in download list already exists

Another script i quickly put together for a user request, may be useful to others too:

What this script does:
- by clicking on a toolbar-button...
- without actually having to start downloads...
- it will check all links in your download list...
- and disable all links where the file already exists on your disk...
- (additionally checking more folders for existing files)...
- and finally shows you a report of disabled links - or if none found

Code:
// Check if file in download list already exists and disable or remove link without starting downloads (FBD)
// Trigger : "Toolbar Button Pressed"
// Toolbar Button Name: "FileCheck"

// Uncomment if you know what you're doing
// disablePermissionChecks();

if (name == "FileCheck") {
    var myFilePackage = getAllFilePackages();
    var folders = [];
    var report = [];

    // Uncomment to ADDITIONALLY check if file exists in these folders
    // folders.push("/media/store0/download","D:/Downloads","C:Downloads2");

    var myDownloadLinks = getAllDownloadLinks();
    for (a = 0; a < myDownloadLinks.length; a++) {

        var link = myDownloadLinks[a];
        var myFilePackage = link.getPackage();
        var linkName = link.getName();
        
        var allfolders = folders;
        allfolders.push(myFilePackage.getDownloadFolder()); // regular download folder

        allfolders.forEach(function(folder) {
            // uncomment to ignore disabled links
            //if (!link.isEnabled()) return;

            var file = getPath(folder + "/" + linkName);
            if (!file.exists()) return;
        
            report.push("Package \"" + myFilePackage.getName()
                        + "\" Folder: \"" + folder + "\""
                        + "\" File: \"" + linkName + "\""
                        );

            // Deactivate Link
            link.setEnabled(false);
        
            // Uncomment to also remove link from download list
            // link.remove();
        });
    }
    
    // comment this if you don't want to see a report
    if (report.length > 0) {
        setAdvancedAlert(true);
        alert("The following links have been disabled because the files already exist:\n\n" + report.join("\n"));
    } else {
        alert("Check completed. No existing files found.");
    }
}
Note: The filename check may fail in rare cases when the final filename changes as the download actually starts. In that case the standard file-exists check of jDownloader will kick in.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2707  
Old 25.11.2023, 14:54
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

I have a request: i need a script that automatically runs the reconnect command when my internet connection has been offline for like... 3 minutes.

My internet connection can glitch out and a reconnect can permanently take it offline unless the reconnect command is run again, which it doesnt do without such a script.

Any help would be greatly appreciated! Thank you so much in advance!
Reply With Quote
  #2708  
Old 25.11.2023, 17:22
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by JKA View Post
I have a request: i need a script that automatically runs the reconnect command when my internet connection has been offline for like... 3 minutes.

My internet connection can glitch out and a reconnect can permanently take it offline unless the reconnect command is run again, which it doesnt do without such a script.
You can use a slightly modified version of a script i posted before:

Code:
// Try another reconnect if internet connection is not back up after 180 seconds (FBD)
// Activate trigger: After a reconnect
// Remove spaces in test-url!

sleep(180000); // Waiting time after a reconnect in milliseconds

var myhtmlSourceString = getPage("http :// ifconfig .me/mime"); // <- remove spaces in url!

if (!myhtmlSourceString.includes("text/html")) {
    // trigger reconnect
    doReconnect();   
}
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2709  
Old 25.11.2023, 17:26
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

Quote:
Originally Posted by FBD View Post
You can use a slightly modified version of a script i posted before:

Code:
// Try another reconnect if internet connection is not back up after 180 seconds (FBD)
// Activate trigger: After a reconnect
// Remove spaces in test-url!

sleep(180000); // Waiting time after a reconnect in milliseconds

var myhtmlSourceString = getPage("http :// ifconfig .me/mime"); // <- remove spaces in url!

if (!myhtmlSourceString.includes("text/html")) {
    // trigger reconnect
    doReconnect();   
}
i will test it out tonight!
Thank you so much, you really made my day!
Reply With Quote
  #2710  
Old 25.11.2023, 17:52
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

FBD? i still got issues with the reconnect not reconnecting despite 40 minute wait times.

is there perhaps some way to send a reconnect command when jdownloader 2 hasnt downloaded anything for 3 minutes?

or is that impossible?
Reply With Quote
  #2711  
Old 25.11.2023, 18:31
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by JKA View Post
FBD? i still got issues with the reconnect not reconnecting despite 40 minute wait times.

is there perhaps some way to send a reconnect command when jdownloader 2 hasnt downloaded anything for 3 minutes?

or is that impossible?
That's possible but probably not a good idea. Eventually all your downloads are finished or all downloads are waiting for slots - you would not want to trigger a reconnect then. The script should do the job, did you set trigger for the script "After a reconnect"?

Maybe the reconnect fails and the event will not be triggered at all, changing it to "Before a reconnect" could fix that, but you should increase the waiting time by the time a reconnect usually takes for you.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2712  
Old 25.11.2023, 18:37
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

Quote:
Originally Posted by FBD View Post
That's possible but probably not a good idea. Eventually all your downloads are finished or all downloads are waiting for slots - you would not want to trigger a reconnect then. The script should do the job, did you set trigger for the script "After a reconnect"?

Maybe the reconnect fails and the event will not be triggered at all, changing it to "Before a reconnect" could fix that, but you should increase the waiting time by the time a reconnect usually takes for you.
i did and i wouldnt mind if the script kept reconnecting endlessly.
running it in several VMs, each equipped with one instance of jdownloader2 and nordvpn to get around geo-restrictions. (the re-connect is triggered via a batch script to make nordvpn chose a random server and then connect)
Reply With Quote
  #2713  
Old 25.11.2023, 19:01
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by JKA View Post
i did and i wouldnt mind if the script kept reconnecting endlessly.
running it in several VMs, each equipped with one instance of jdownloader2 and nordvpn to get around geo-restrictions. (the re-connect is triggered via a batch script to make nordvpn chose a random server and then connect)
In that case it would be much more reliable if your script just waits a few minutes after a reconnect and checks if the connection has been established again - and if not to try again.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2714  
Old 25.11.2023, 19:04
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

Quote:
Originally Posted by FBD View Post
In that case it would be much more reliable if your script just waits a few minutes after a reconnect and checks if the connection has been established again - and if not to try again.
true, problem is that wait times by hosters can trip-up the reconnect. one singular download beginning, 40 minute wait time, reconnect just isnt happening.

that and that after a reconnect, at times, downloads just dont start up again either. the "Play" button up top is greyed out, downloads are ready to go, no wait time and its not downloading any of them.

see why i thought that reconnect upon a certain time of no download may kill three birds with one stone?

EDIT:

also keep getting this error:



this is the script as ive used it:



trigger after reconnect

Last edited by JKA; 25.11.2023 at 19:21.
Reply With Quote
  #2715  
Old 25.11.2023, 19:30
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by JKA View Post
see why i thought that reconnect upon a certain time of no download may kill three birds with one stone?
Ok, at your own risc. But if you have a setup with mutiple virtual machines and vpns you probably know about that.

Script checks 3 times over 3 minutes, if average download speed is 0 three times in a row, triggers reconnect.

Code:
// Force reconnect if no downloads for 3 minutes (FBD)
// Activate trigger: Interval -> 300000 (should be > 3 minutes)
// DISABLE Synchronous execution

var trigger = 0;

for (var i = 0; i < 3; i++) {
    var avgSpeed = getAverageSpeed();
    if (avgSpeed > 0) { 
        trigger = 0;
        break;
    }
    trigger++;
    sleep(60000)
}

if (trigger == 3) {
    // 3 minutes without average download speed - trigger reconnect
    doReconnect();   
}
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2716  
Old 25.11.2023, 19:31
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

Quote:
Originally Posted by FBD View Post
Ok, at your own risc. But if you have a setup with mutiple virtual machines and vpns you probably know about that.

Script checks 3 times over 3 minutes, if average download speed is 0 three times in a row, triggers reconnect.

Code:
// Force reconnect if no downloads for 3 minutes (FBD)
// Activate trigger: Interval -> 300000 (should be > 3 minutes)
// DISABLE Synchronous execution

var trigger = 0;

for (var i = 0; i < 3; i++) {
    var avgSpeed = getAverageSpeed();
    if (avgSpeed > 0) { 
        trigger = 0;
        break;
    }
    trigger++;
    sleep(60000)
}

if (trigger == 3) {
    // 3 minutes without average download speed - trigger reconnect
    doReconnect();   
}
cant wait to give this a whirl!
Thanks so much, wish me luck!

EDIT: HOT DAMN! <3
it genuinely works now!
Also set the scheduler to do "Start Downloads" every minute, just to be on the safe side and it not stopping with "PLAY"-button greyed out anymore. Maybe not the most elegant solution, but... Hey, it works, thats all that matters!

THANKS FBD!

Last edited by JKA; 25.11.2023 at 20:34.
Reply With Quote
  #2717  
Old 26.11.2023, 15:04
JustARandomDude JustARandomDude is offline
Modem User
 
Join Date: Nov 2023
Posts: 2
Default How to fix "missing ; before statement (#2)" in my script

I want to move every extracted file after the whole archive has been extracted to a different directory. But the run and the testcompile fail with:
Quote:
missing ; before statement (#2)
Code:
disablePermissionChecks();
var extractedFilePaths[] = myArchive.getExtractedFilePaths();
var destinationFolder = "/output/EXTRACTED_FINISHED/";
for (i = 0; i < extractedFilePaths.length; i++) {
    var extractedFilePath = extractedFilePaths[i];
    extractedFilePath.moveTo(destinationFolder);
}
Could you please have a look and show me my noob mistake?
Thank you in advance!
Reply With Quote
  #2718  
Old 26.11.2023, 17:51
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by JustARandomDude View Post
Could you please have a look and show me my noob mistake?
Thank you in advance!
Code:
var extractedFilePaths = myArchive.getExtractedFilePaths();
The [ ] in the script help screen are just to indicate that the return value is an array, you're not supposed to have them in your program.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
  #2719  
Old 26.11.2023, 18:26
JKA JKA is offline
Junior Loader
 
Join Date: Nov 2023
Posts: 12
Default

FBD? Könnte man das oben-angegebene reconnect script vielleicht auch irgendwie auf 2 minuten kürzen?
so das, weiß nicht, vielleicht zweimal misst ob die durchschnitts downloadgeschwindigkeit 0 ist innerhalb von 2 minuten und wenn ja dann reconnect?
Glaube 3 minuten könnte vielleicht doch etwas großzügig bemessen gewesen sein meinerseits
Reply With Quote
  #2720  
Old 26.11.2023, 18:31
FBD's Avatar
FBD FBD is offline
Mega Loader
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 65
Default

Quote:
Originally Posted by JKA View Post
FBD? Könnte man das oben-angegebene reconnect script vielleicht auch irgendwie auf 2 minuten kürzen?
so das, weiß nicht, vielleicht zweimal misst ob die durchschnitts downloadgeschwindigkeit 0 ist innerhalb von 2 minuten und wenn ja dann reconnect?
Glaube 3 minuten könnte vielleicht doch etwas großzügig bemessen gewesen sein meinerseits
Ändere
Code:
for (var i = 0; i < 3; i++) {
zu
Code:
for (var i = 0; i < 2; i++) {
und
Code:
if (trigger == 3) {
zu
Code:
if (trigger == 2) {
Dazu könnte man dann das Interval fürs script auch etwas herabsetzen, das aber nicht zu knapp machen, der reconnect dauert ja auch noch etwas.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
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 11:42.
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 - 2024, Jelsoft Enterprises Ltd.