JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #841  
Old 07.07.2019, 13:06
dankmemer dankmemer is offline
Modem User
 
Join Date: Jun 2019
Posts: 3
Default

Quote:
Originally Posted by mgpai View Post
Looks like the user's requirement is similar to the one in **External links are only visible to Support Staff**... thread.
Yup that's exactly it. Did that ever get resolved? Or would a script be able to do that?

Right now I've been running an independent duplication search on the folders, but, but I often have to rescrape the same pages for updates, and in its current state it will redownload eveyrthing again since it doesn't know if there are new files or dupes in JDownloader, which ends up causing wear to the HDD after a while of doing this. (I have a ~12 million files so also imagine the time it takes to run that duplication software)
Reply With Quote
  #842  
Old 08.07.2019, 11:01
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,369
Default

@dankmemer: you could create a history/textfile with all downloaded files and use a script that checks that history/file if the file already got downloaded in the past and then remove it.
is not available yet but I will try to find some time for it
__________________
JD-Dev & Server-Admin
Reply With Quote
  #843  
Old 12.07.2019, 02:52
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 948
Default

1. Support for nzblnk links with JDownloader + Eventscripter:
Spoiler:
Code:
//Scan for NZB urls and grab all data
//Trigger: New Crawler Job (Neuer Sammel-Job)
//
//Uncheck the advanced setting: LinkgrabberSettings.addlinksdialogcheck

var myCrawlerJob = job;
var myNewLinks = myCrawlerJob.getText();

if (myNewLinks.match(/nzblnk:\?/i)) {
    var newlines = myNewLinks.split(/\r\n|\r|\n/g);
    newlines.forEach(function(listentry) {
        if (listentry.match(/^nzblnk:\?/i)) {
            var linksplit = listentry.split(/\?/, 2);
            var valuesplit = linksplit[1].split(/\&/);

            var newname = "";
            var newhash = "";
            var newpass = "";
            valuesplit.forEach(function(value) {
                var lastsplit = value.split(/=/, 2);
                if (lastsplit[0] == "t") { //title
                    newname = lastsplit[1];
                }
                if (lastsplit[0] == "h") { //header
                    newhash = lastsplit[1];
                }
                if (lastsplit[0] == "p") { //password
                    newpass = lastsplit[1];
                }
            });

            if (newhash) {
                var html = "";
                var html2 = "";
                for (var i = 0; i < 3; ++i) {
                    try {
                        html = getPage("https" + "://www.nzbindex.com/search/rss?q=" + newhash);
                        html2 = getPage("https" + "://www.nzbking.com/search/?q=" + newhash);
                    } catch (e) {}
                    if (html != null && html != "" && html2 != null && html2 != "") {
                        break;
                    } else {
                        sleep(1000);
                    }
                }
                if (html != null && html != "" && html2 != null && html2 != "") {
                    var nzburl = html.match(/url="([^"]+)"/);
                    var nzburl2 = html2.match(/href="([^"]+)" class/);
                    var nzblink = "";
                    if (nzburl) {
                        nzblink = nzburl[1] + ".nzb";
                    }
                    if (nzburl2) {
                        nzblink = "https" + "://www.nzbking.com" + nzburl2[1] + "#.nzb";
                    }

                    if (nzblink) {
                        callAPI("linkgrabberv2", "addLinks", {
                            "deepDecrypt": false,
                            "packageName": newname,
                            "extractPassword": newpass,
                            "links": nzblink
                        });
                    } else {
                        //alert("Kein Ergebnis gefunden.");
                    }
                } else {
                    //alert("Kein erreichbares Ergebnis gefunden.");
                }
            }
        }
    });
}



2. Usenet password remover (passwordlist)
Spoiler:
Code:
// Usenet password remover (passwordlist)
// Trigger: Interval (e.g. 150000)
var links = getAllDownloadLinks();
var doublecheck = {};

for (var i = 0; i < links.length; i++) {
    var link = links[i];
    var usenet = link.getProperty("useNetFile");

    if (usenet != null) {
        var myArchive = link.getArchive();
        var passwords = "";
        var finalPassword = "";
        if (link.getArchive()) {
            if (myArchive.getInfo().hasOwnProperty("passwords")) {
                passwords = myArchive.getInfo().passwords;
            }
            if (myArchive.getInfo().hasOwnProperty("finalPassword")) {
                finalPassword = myArchive.getInfo().finalPassword;
            }
        }
        if (finalPassword == null) {
            finalPassword = ""
        }
        if (passwords == null) {
            passwords = ""
        }
        if (passwords != "" || finalPassword != "") {
            if (passwords != "") {
                doublecheck[passwords] = 1;
            }
            if (finalPassword != "") {
                doublecheck[finalPassword] = 1;
            }
        }
    }
}
var newpw = [];
var pwjson = callAPI("config", "get", "org.jdownloader.extensions.extraction.ExtractionConfig", "cfg/org.jdownloader.extensions.extraction.ExtractionExtension", "PasswordList");

for (var i = 0; i < pwjson.length; i++) {
    if (doublecheck[pwjson[i]] != 1) {
        newpw.push(pwjson[i]);
    }
}
callAPI("config", "set", "org.jdownloader.extensions.extraction.ExtractionConfig", "cfg/org.jdownloader.extensions.extraction.ExtractionExtension", "PasswordList", newpw);



3. Use NZB data (with prompt) and grab all data (prompt.js is required)
Spoiler:
Code:
// Use NZB data and grab all data
// Trigger: Toolbar Button Pressed
// Triggername: NZB
// System: Windows
// Required: prompt.js, board.jdownloader.org/showpost.php?p=446222&postcount=851
require(JD_HOME + "/eventscripter/system/prompt.js");

if (name == "NZB") {
    var newname = "";
    var newhash = "";
    var newpass = "";
    newname = prompt("Name", "Package name");
    if (newname != null) {
        newhash = prompt("Header/Hash", "Header/Hash data");
    }
    if (newname != null && newhash != null) {
        newpass = prompt("Passwort", "NZB file passwort");
    }

    if (newhash != null && newname != null) {
        if (newhash) {
            var html = "";
            var html2 = "";
            for (var i = 0; i < 3; ++i) {
                try {
                    html = getPage("https" + "://www.nzbindex.com/search/rss?q=" + newhash);
                    html2 = getPage("https" + "://www.nzbking.com/search/?q=" + newhash);
                } catch (e) {}
                if (html != null && html != "" && html2 != null && html2 != "") {
                    break;
                } else {
                    sleep(1000);
                }
            }
            if (html != null && html != "" && html2 != null && html2 != "") {
                var nzburl = html.match(/url="([^"]+)"/);
                var nzburl2 = html2.match(/href="([^"]+)" class/);
                var nzblink = "";
                if (nzburl) {
                    nzblink = nzburl[1] + ".nzb";
                }
                if (nzburl2) {
                    nzblink = "https" + "://www.nzbking.com" + nzburl2[1] + "#.nzb";
                }

                if (nzblink) {
                    callAPI("linkgrabberv2", "addLinks", {
                        "deepDecrypt": false,
                        "packageName": newname,
                        "extractPassword": newpass,
                        "links": nzblink
                    });
                } else {
                    //alert("Kein Ergebnis gefunden.");
                }
            } else {
                //alert("Kein erreichbares Ergebnis gefunden.");
            }
        }
    }
}



4. And for ftps/ftpes links (JD can ftps as ftp in most cases):
Spoiler:
Code:
//Scan for FTPs urls
//Trigger: New Crawler Job (Neuer Sammel-Job)
//
//Uncheck the advanced setting: LinkgrabberSettings.addlinksdialogcheck

var myCrawlerJob = job;
var myNewLinks = myCrawlerJob.getText();

var addlinks = "";
var newlines = myNewLinks.split(/\r\n|\r|\n/g);
newlines.forEach(function(listentry) {
    if (listentry.match(/^ftps:|^ftpes/i)) {
        listentry = listentry.replace(/^ftps/i, "ftp"); //as workaround
        listentry = listentry.replace(/^ftpes/i, "ftp"); //as workaround
        addlinks += listentry + "\n";
    }
});
if (addlinks != "") {
    callAPI("linkgrabberv2", "addLinks", {
        "deepDecrypt": false,
        "links": addlinks
    });
}



5. Use yt-dl if possible (and if JDownloader has no plugin)
Spoiler:
Code:
// Use yt-dl if possible
// Trigger: New Crawler Job (Neuer Sammel-Job)
// Required: Synchronous execution of script
// Uncheck the advanced setting: LinkgrabberSettings.addlinksdialogcheck

// Config
var all_links = false; //true/false - Use ytdl for all supported links (and not JD)

// Script
var downloadfolder = callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "defaultdownloadfolder");
setAdvancedAlert(true);

var myCrawlerJob = job;
var myNewLinks = myCrawlerJob.getText();
var errors = "";

var ytdl = JD_HOME + getEnvironment().getPathSeparator() + "you" + "tube-dl";
if (getEnvironment().isWindows()) {
    ytdl += ".exe";
}
if (!getPath(ytdl).exists() && getEnvironment().isWindows()) {
    var br = getBrowser();
    br.setFollowRedirects(true);
    br.getDownload(ytdl, "https" + "://yt-dl.org/latest/you" + "tube-dl.exe"); //ffmpeg.zeranoe.com/builds/
    sleep(1000);
}
if (getPath(ytdl).exists()) {
    var ytdl_output = callSync(ytdl);
    if (ytdl_output.match("You must provide at least one URL")) {
        var new_ytdl_extractors = callSync(ytdl, "--list-extractors");

        var checklinks = 0;
        var hosts = callAPI("plugins", "getAllPluginRegex");
        var newlines = myNewLinks.split(/\r\n|\r|\n/g);
        newlines.forEach(function(listentry) {
            if (getCheck(listentry.toLowerCase(), hosts) && getCheckDL(getHost(listentry.toLowerCase()), new_ytdl_extractors)) {
                checklinks = 1;
                downloadfolder = downloadfolder.replace("<jd:packagename>", getHost(listentry.toLowerCase()));
                var new_ytdl_output = callSync(ytdl, "--no-check-certificate", "--no-progress", "--no-call-home", "-i", "-o", downloadfolder + getEnvironment().getPathSeparator() + "%(title)s-%(id)s.%(ext)s", listentry);
                if (!new_ytdl_output.match("Download completed")) {
                    errors += "ERROR:\n" + listentry + "\n" + downloadfolder + getEnvironment().getPathSeparator() + "\n" + new_ytdl_output + "\n";
                }
            }
        });
        if (errors != "") {
            if (getEnvironment().isHeadless() == true) {
                log(errors);
            } else {
                alert(errors);
            }
        }
    } else {
        if (getEnvironment().isHeadless() == true) {
            log("Software yt-dl under " + ytdl + " not ready:\n" + ytdl_output + "\n");
        } else {
            alert("Software yt-dl under " + ytdl + " not ready:\n" + ytdl_output + "\n");
        }
    }
    if (checklinks != "" && errors == "") {
        myCrawlerJob.setDeepAnalysisEnabled(false);
        myCrawlerJob.setText("");
    }
}

function getCheckDL(url, extractors) {
    var newextractors = extractors.split(/\r\n|\r|\n/g);

    var found = 0;
    newextractors.forEach(function(extractorentry) {
        var extractorentry_good = "";
        if ((extractorentry.split(/:/))[0].length > 5) {
            extractorentry_good = (extractorentry.split(/:/))[0];
        } else {
            extractorentry_good = extractorentry;
        }
        if (url.match(extractorentry_good.toLowerCase()) && extractorentry_good.length > 3) {
            found = 1;
        }
    });
    if (found == 1) {
        return true;
    } else {
        return false;
    }
}

function getCheck(url, obj) {
    if (all_links == true) {
        return true;
    }
    for (var prop in obj) { //prop=host,obj[prop]=regex
        if (url.match(prop.toLowerCase())) {
            return false;
        }
    }
    return true;
}

function getHost(url) {
    var hostname;
    if (url.indexOf("//") > -1) {
        hostname = url.split('/')[2];
    } else {
        hostname = url.split('/')[0];
    }
    hostname = hostname.split(':')[0];
    hostname = hostname.split('?')[0];

    return hostname;
}
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 05.08.2019 at 13:56.
Reply With Quote
  #844  
Old 14.07.2019, 10:06
SMS SMS is offline
Vacuum Cleaner
 
Join Date: Jun 2019
Posts: 15
Default

Quote:
Originally Posted by mgpai View Post
Which directory should be compared? Download directory or extraction directory? Please give a working example.
If file to be downloaded is called foo.zip, but the download directory already contains a subdirectory called foo, then foo.zip shouldn't be downloaded (for example by using link.setEnabled(false);).
Reply With Quote
  #845  
Old 14.07.2019, 11:39
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by SMS View Post
If file to be downloaded is called foo.zip, but the download directory already contains a subdirectory called foo, then foo.zip shouldn't be downloaded (for example by using link.setEnabled(false);).
Code:
// Disable all download link(s) of an archive, if the download folder contains a sub-folder with archive name
// Trigger: A Download Started

var archive = link.getArchive();
var archiveLinks = archive && getPath(link.getPackage().getDownloadFolder() + "/" + archive.getName()).exists() ? archive.getDownloadLinks() : [];

archiveLinks.forEach(function(link) {
    link.setEnabled(false);
    // var partFile = getPath(link.getDownloadPath() + ".part");
    // if (partFile.exists()) partFile.delete();
})
Reply With Quote
  #846  
Old 18.07.2019, 13:31
animus animus is offline
DSL User
 
Join Date: Jan 2010
Posts: 39
Lightbulb

hi @magpai

I download lot of movies etc

most of them are in multiple archives and renamed to keep it away from DMCA etc.I rename the archive back to original based on the page.

this is 3 part question.

#01-

I asked as a feature but jiaz directed me to you so here it is.

I want jdownloader to extract the archive to a folder named after the archives name (which is possible through jdownload extractor) without the folder structure inside the archive

For example Underworld 2.rar--->underworld 2 cd1 , underworld cd2 , covers , subtitles (these are all folders)

i want jdownloader to download the archive and extract the archive to folder thats set but not in a structure on the archive.i just want to see the avi/mp4/mkv files ,cover pictures and the subtitle files.
I think there is a setting in winrar that dismisses the folder structure.
is it possible?if possible how to manuplate the script (remove or add file extensions like jpeg txt etc to remove afterwards)

Addendum here: Is it possible to scripts triggering other scripts or do you need to do it in one script?

#02-

After the first thing happened a second script (or part) could be triggered (?) to rename the files that have been extracted, to the folder name (so basicly the archives name)

#03
after the second script (or part) happened a third script (or part) to get rid of the redundant subfolder like

D:/Media/TV/Stranger Things/Stranger Things S03e03.../Stranger Things S03e03...mp4

to

D:/Media/TV/Stranger Things/Stranger Things S03e03...mp4

I know that #2 is possible i asked something similar before you but it didnt really worked as well as i thought it would.#3 should be possible i think.

And a quick question does these scripts work with other jdownloader 2 installations.diffirent os - I have a rpi (uses debian based os) which i use as a download station with remote interface uses jdownloader.jar a portable kind of installation.

I know its a lot but i gotta ask.#01 is the part i am after but all three could be nice

Keep up the good work

Last edited by animus; 18.07.2019 at 13:48.
Reply With Quote
  #847  
Old 18.07.2019, 14:56
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by animus View Post
i want jdownloader to download the archive and extract the archive to folder thats set but not in a structure on the archive.i just want to see the avi/mp4/mkv files ,cover pictures and the subtitle files.
Will be done by the script

Quote:
Originally Posted by animus View Post
is it possible?if possible how to manuplate the script (remove or add file extensions like jpeg txt etc to remove afterwards)
In Archive Extractor 'filter' section, match unwanted files using regular expression to remove them.

Quote:
Originally Posted by animus View Post
After the first thing happened a second script (or part) could be triggered (?) to rename the files that have been extracted, to the folder name (so basicly the archives name)
Use packagzier to rename extracted files. This may fail if renaming results in duplicate files.

Quote:
Originally Posted by animus View Post
after the second script (or part) happened a third script (or part) to get rid of the redundant subfolder like
If I have understood your question correclty, this should also be done by the script.

Quote:
Originally Posted by animus View Post
And a quick question does these scripts work with other jdownloader 2 installations.diffirent os - I have a rpi (uses debian based os) which i use as a download station with remote interface uses jdownloader.jar a portable kind of installation.
Yes.

Script:
Code:
// Move extracted files to base folder and remove empty sub-folders.
// Trigger: Archive Extraction Finished

var filePaths = archive.getExtractedFilePaths();

filePaths.forEach(function(filePath) {
    filePath.moveTo(archive.getExtractToFolder());
})

filePaths.concat(filePaths.reverse()).forEach(function(filePath) {
    var subFolder = getPath(filePath.toString().replace(filePath.getName(), ""));
    subFolder.delete();
})

Please test the script with non-critical files and make sure it is working correctly.
Reply With Quote
  #848  
Old 24.07.2019, 19:52
hokagai hokagai is offline
Modem User
 
Join Date: Jul 2019
Posts: 3
Default

Help please, to donwload each file in a different folder path

please how to assign each file to download in a specific folder and import it to jdownloader . i can't do it manually because it's thousand files.

for exemple:

file1 to c:\1
file2 to c:\2
file3 to c:\3
....

thanks alot
Reply With Quote
  #849  
Old 24.07.2019, 20:09
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by hokagai View Post
... how to assign each file to download in a specific folder and import it to jdownloader ...
Have replied to your email.
Reply With Quote
  #850  
Old 28.07.2019, 13:29
maze maze is offline
Modem User
 
Join Date: Apr 2019
Posts: 2
Default

Hello everyone,
Is there any way to move files from default directory to another directory after completed download (each link)?
I have readed few posts on this forum (but mostly about extraction to separate directory).

Situaltion:
Device got small ammount of internal memory, so I mounted network drive (not NAS). One disavantage - You can't download directly on that network drive (Some Error, all files got 0 bytes).

Thanks for any help.

@edit:
Found script on forum, but trigger is 'Download Stopped'. I got whole package of ~500GB, is possible to move each single completed download to another directory? How to do that?

// Move finished non-archive files, to user defined folder
// Trigger required: "A Download Stopped"

var destFolder = "/var/www/mydir"; // <- Set destination folder.

if (link.isFinished() && !link.getArchive()) {
getPath(link.getDownloadPath()).moveTo(destFolder);
}

Last edited by maze; 29.07.2019 at 16:55.
Reply With Quote
  #851  
Old 31.07.2019, 12:04
Agita Agita is offline
Baby Loader
 
Join Date: May 2013
Location: Hannover
Posts: 6
Default Util Functions

Code:
setTimeout(function f [, number delay = 0 [, object ...]])
Spoiler:

JD_HOME/eventscripter/system/setTimeout.js
Code:
/*jslint browser */
/*global callAsync, sleep, JD_HOME */
function setTimeout() {
    "use strict";

    var args = [];
    Array.prototype.push.apply(args, arguments); // (...args) not working in jd2

    if (args.length === 0) {
        return;
    }

    var func = args.shift();
    var time = args.shift() || 0;

    callAsync(function() {
        sleep(time);
        func.apply(null, args);
    }, JD_HOME + "/eventscripter/system/bin/dummy.bat");
}
JD_HOME/eventscripter/system/bin/dummy.bat
Code:
@echo off
setlocal
set hmmm=hmmmmmm
Example
Code:
// Trigger Required: "Interval"
// Options recommended: 10000ms, synchronous

require(JD_HOME + "/eventscripter/system/setTimeout.js");

function f(arr) {
    alert(arr.join(" "));
}

setTimeout(f, 5000, ["hello", "world"]);
alert("setTimeout() is not blocking!");


Code:
confirm(string message) : bool
Spoiler:

JD_HOME/eventscripter/system/confirm.js
Code:
/*jslint browser, long */
/*global getEnvironment, callSync, JD_HOME, alert */
function confirm(message) {
    "use strict";

    message = message.replace("\r", "\\r");
    message = message.replace("\n", "\\n");
    var env = getEnvironment();
    switch (env.getOSFamily()) {
    case "WINDOWS":
        return !(!callSync(JD_HOME + "/eventscripter/system/bin/confirm.bat", "JD2 - EventScripter", message));
    default:
        alert("Soryy, your OS is yet not supported for confirm()");
    }
}
JD_HOME/eventscripter/system/bin/confirm.bat
Code:
@echo off
SETLOCAL EnableDelayedExpansion

SET _title=%~1
SET _text=%~2

set _text=%_text:\r="&vbCr&"%
set _text=%_text:\n="&vbLf&"%

:uniqueTempVbs
set "vbsFileName=%TEMP%\~%RANDOM%.vbs"
if exist "%vbsFileName%" goto :uniqueTempVbs

ECHO Wscript.Echo MsgBox("!_text!",1,"!_title!")>%vbsFileName%
FOR /f "delims=/" %%G IN ('cscript //nologo %vbsFileName%') DO set _input=%%G
DEL %vbsFileName%

if "%_input%" EQU "1" (
    ECHO 1
)

ENDLOCAL
Example
Code:
// Trigger Required: "Interval"
// Options recommended: 3000ms, synchronous

require(JD_HOME + "/eventscripter/system/confirm.js");

var ret = confirm("Confirm?");
alert(ret);


Code:
prompt(string title, string text) : string
Spoiler:

JD_HOME/eventscripter/system/prompt.js
Code:
/*jslint browser, long */
/*global getEnvironment, callSync, JD_HOME, alert */
function prompt(text, defaultText) {
    "use strict";

    text = text.replace("\r", "\\r");
    text = text.replace("\n", "\\n");
    var env = getEnvironment();
    var ret = null;
    switch (env.getOSFamily()) {
    case "WINDOWS":
        ret = callSync(JD_HOME + "/eventscripter/system/bin/prompt.bat", "JD2 - EventScripter", text, defaultText);
        ret = (
            (ret)
            ? ret.substring(1, ret.length - 2)
            : null
        ); // remove the leading "1". Its just a dummy to catch the null return
        break;
    default:
        alert("Sorry, your OS is yet not supported for ExDialog-prompt()");
    }
    return ret;
}
JD_HOME/eventscripter/system/bin/prompt.bat
Code:
@echo off
SETLOCAL EnableDelayedExpansion

SET _title=%~1
SET _text=%~2
SET _default=%~3

set _text=%_text:\r="&vbCr&"%
set _text=%_text:\n="&vbLf&"%

:uniqueTempVbs
set "vbsFileName=%TEMP%\~%RANDOM%.vbs"
if exist "%vbsFileName%" goto :uniqueTempVbs

ECHO Wscript.Echo Inputbox("!_text!","!_title!","!_default!")>%vbsFileName%
FOR /f "delims=/" %%G IN ('cscript //nologo %vbsFileName%') DO set _input=%%G
DEL %vbsFileName%

if "%_input%" NEQ "" (
    echo 1%_input%
)

ENDLOCAL
Example
Code:
// Trigger Required: "Interval"
// Options recommended: 3000ms, synchronous

require(JD_HOME + "/eventscripter/system/prompt.js");

alert(prompt("title", "Hello world"));

Last edited by Agita; 31.07.2019 at 12:52.
Reply With Quote
  #852  
Old 31.07.2019, 12:49
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by maze View Post
I got whole package of ~500GB, is possible to move each single completed download to another directory? How to do that?
Post #391131
Reply With Quote
  #853  
Old 02.08.2019, 18:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,369
Default

@maze: what filesystem do you use for mounting your remote share. this should not happen and sounds like configuration error
__________________
JD-Dev & Server-Admin
Reply With Quote
  #854  
Old 02.08.2019, 18:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,369
Default

@Agita: don't expect too much JS support. JDownloader uses very basic/limited JS environment
__________________
JD-Dev & Server-Admin
Reply With Quote
  #855  
Old 05.08.2019, 10:13
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 836
Default Default Kann man JD automatisch neu starten lassen, so wie er 0 MB/s lädt?

Kann man JD automatisch neu starten lassen, so wie er 0 MB/s lädt / nichts mehr runterlädt, aber nur, wenn er nicht entpackt?
Reply With Quote
  #856  
Old 05.08.2019, 19:36
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by Fetter Biff View Post
Kann man JD automatisch neu starten lassen, so wie er 0 MB/s lädt / nichts mehr runterlädt, aber nur, wenn er nicht entpackt?
In addition to the extraction check, I have also included linkcrawler and linkcollector check. You can remove/comment them out if they are not required. Hope I have understood your requirement correctly.

Code:
// Restart JD if download speed in 0 and JD is idle.
// Trigger: Interval (Recommended: 60000 or more).
// IMPORTANT: Enable "Synchronous execution of script" checkbox in the top panel.

var mySeconds = 120; // (in seconds) <- Restart JD if speed remains at zero for this duration.

if (isSpeedZero()) {
    var elapsed = 0;
    while (isSpeedZero() && elapsed < mySeconds) {
        elapsed++;
        sleep(1000);
    }
    if (isSpeedZero() && isIdle()) callAPI("system", "restartJD");
}

//Functions
function isSpeedZero() {
    return getRunningDownloadLinks().length && !getTotalSpeed();
}

function isIdle() {
    if (callAPI("linkcrawler", "isCrawling")) return;
    if (callAPI("linkgrabberv2", "isCollecting")) return;
    if (callAPI("extraction", "getQueue").length > 0) return;
    return true;
}

What exactly is causing the downloads to stall? Does restart fix the issue? If not, the script will keep running in a loop. If you can provide a log Jiaz might be able to check it and fix the underlying issue, or recommend an alternative solution.
Reply With Quote
  #857  
Old 08.08.2019, 18:29
DunDee DunDee is offline
Baby Loader
 
Join Date: Aug 2019
Posts: 6
Default

Can someone help me with my list of files. i got backup data my on 1fichier.com hosting. Now they got new rules when someone don't download it in 60 or 80 days they change it to cold storage from hot storage. I used this hosting only for my data backup.
So my question is can someone write a script in JS with short connections with my filelist when i add it in JD2 and i will download simulate only for connect with my files list it can be little download and move to next of files in list.

JD2 got script builded with restart of downloads if below are 50kb then restart. Maybe someone know how to change this script, and dont restard only skip after speed is below 50kb/s then my files move to hot storage and i will rescue them before they delete it from my account.
Sorry for my english im not very good with writing.
this is from JD2 script restard download if the speed is low.

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() > 30000) {
            //check if the current speed is below 50kb/s
            if (running[i].getSpeed() < 50 * 1024) {
                //reset the download
                //running[i].reset();
                //stop the download and restart it
                running[i].abort();
            }

        }
    }
}

Last edited by DunDee; 08.08.2019 at 19:33.
Reply With Quote
  #858  
Old 18.08.2019, 10:13
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 8,282
Default

I am looking for a script to download html-pages.
Reply With Quote
  #859  
Old 18.08.2019, 16:32
DunDee DunDee is offline
Baby Loader
 
Join Date: Aug 2019
Posts: 6
Default

Nobody knows? how to modify this script used in JD2?
Reply With Quote
  #860  
Old 22.08.2019, 19:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,369
Default

@DunDee: If the data is backup, why is it bad that they move it from hot storage to cold storage. They files aren't lost, just moved?
__________________
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 10: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 - 2019, Jelsoft Enterprises Ltd.