JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #801  
Old 25.06.2019, 09:42
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

Quote:
Originally Posted by the Dark View Post
Is there a way to put it into download directly not in linkcrawler/-list ?
In Crawljob for Folderwatch you have to enable AutoConfirm AND AutoStart flags


Quote:
Originally Posted by the Dark View Post
Will this work even if jDownloader crashes or is it better to set every 15th and 30th? possible?
Interval of 5 Days -> JDownloader starts and waits 5 days. Your JDownloader should not crash at all!
If your setup somehow let JDownloader crash, then maybe instead of 5 days interval, better on fixed days like
1,5,10,15,20,25..of the month.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #802  
Old 25.06.2019, 13:03
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by the Dark View Post
I want to delete all downloaded files every 5 minutes to keep the hard drive clean (hard drive space is limited)
This would mean a file created at 04m59s will be deleted at 05m00s, almost within less than a second after it was created. If you provide more information, we might be able to recommend alternative solution. Please find me in JD Chat.

Code:
jdownloader.org/knowledge/chat

Quote:
Originally Posted by the Dark View Post
Is there a way to put it into download directly not in linkcrawler/-list ?
For crawljobs, you can define the parameters in the job file itself, as suggested by Jiaz in the previous post. For dlc files, you have to either set it in the packagizer rule (suggested in one of my previous posts) or enable it globally in the linkgrabber bottom toolbar.

Quote:
Originally Posted by the Dark View Post
Will this work even if jDownloader crashes or is it better to set every 15th and 30th? possible?
Code:
// Enable Folder Watch on user specified dates
// Trigger : Interval
// Set Interval to 86400000

var dates = [7, 14, 21, 28]; // <- Set dates
var folderWatch = "org.jdownloader.extensions.folderwatchV2.FolderWatchExtension";
var currentStatus = callAPI("extensions", "isEnabled", folderWatch);
var desiredStatus = dates.indexOf(new Date().getDate()) > -1;

if (currentStatus != desiredStatus) callAPI("extensions", "setEnabled", folderWatch, desiredStatus);
Reply With Quote
  #803  
Old 25.06.2019, 13:25
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

Quote:
Originally Posted by mgpai View Post
This would mean a file created at 04m59s will be deleted at 05m00s, almost within less than a second after it was created.
You can run the check all 5 mins and use the lastmodified timestamp of the file for delete decision
__________________
JD-Dev & Server-Admin
Reply With Quote
  #804  
Old 25.06.2019, 13:52
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by Jiaz View Post
You can run the check all 5 mins and use the lastmodified timestamp of the file for delete decision
Quote:
Originally Posted by the Dark View Post
I want to delete all downloaded files every 5 minutes to keep the hard drive clean (hard drive space is limited)
I just want to confirm if this is literally what the user wants and also inform how such a script would work.
Reply With Quote
  #805  
Old 25.06.2019, 22:29
the Dark
Guest
 
Posts: n/a
Default

I just want to prevent the hard drive is getting filled up.
Maybe I explain what I want to do with the script:
It should run in backraund as a cronjob. filehoster store files for 30 days without diwnload. so I want to download these files to renew the timestamp on the host side. hope you understand. In the watchfolder I want to put every *dlc for each movie.
ex.: Im downloading 5GB/minutes after 5 minutes I have 25GB on my harddrive that are „wasted“ so I want do delete these 25GB of *.rar file vut not *.rar.part
1Tb needs to be downloaded in total so I only have a harddrive with 200GB.
Reply With Quote
  #806  
Old 26.06.2019, 08:51
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by the Dark View Post
/as/example/deletefilesfolder //<--- path to there only watchfolder files get downloaded (manually downloaded files should stay in another path)

if the files got downloaded I want to delete them after about 5 minutes to keep the drive clean (needs to be a seperate folder)
Delete files at specified interval:
Code:
// Delete downloaded files from user-specified folder, at user-specified interval.
// Trigger : Interval (300000)

var myFolder = "/as/example/deletefilesfolder"; // <- case-sensitive

getAllDownloadLinks().forEach(function(link) {
    if (!link.isFinished()) return;
    var file = getPath(link.getDownloadPath());
    if (!file.exists()) return;
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) file.delete();
})

Delete files immediately after downloading (Recommended):
Code:
// Delete downloaded files from user-specified folder, immediately after it's been downloaded.
// Trigger : A Download Stopped

var myFolder = "/as/example/deletefilesfolder"; // <- case-sensitive

if (link.isFinished()) {
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) {
        var file = getPath(link.getDownloadPath());
        file.delete();
    }
}
Reply With Quote
  #807  
Old 26.06.2019, 09:48
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

@mgpai: maybe instead of delete , first move to sort of trash folder and then wait another loop to *empty* the trash
__________________
JD-Dev & Server-Admin
Reply With Quote
  #808  
Old 26.06.2019, 10:30
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,325
Default

Quote:
Originally Posted by Jiaz View Post
We don't want to provide access to the internal url as this can be abused or the internal url is something purely internal but I've added getPluginURL method with next core update
Sure and getPluginURL works great. Thanks!

Example "Downloads":
Code:
// Export download URLs
// Trigger : "DownloadList Contextmenu Button Pressed"
setAdvancedAlert(true);
//disablePermissionChecks();

if (name == "Export URLs") {
    if (dlSelection.getDownloadLinks().length != 0) {
        var links = dlSelection.getDownloadLinks();
        var urls = [];

        for (i = 0; i < links.length; i++) {
            var link = links[i];
            var fileName = link.getName();
            var downloadURL;
            if (/(http(s?)):\/\/|(ftp(s?)):\/\//gi.test(link.getPluginURL())) {
                downloadURL = link.getPluginURL() + "#" + fileName;
            } else {
                downloadURL = link.getContentURL() + "#" + fileName;
            }
            urls.push(downloadURL);
        }
        alert(urls.join("\r\n") + "\n");
    }
}

Example "LinkGrabber":
Code:
// Export URLs (LinkGrabber)
// Trigger : "LinkGrabber Contextmenu Button Pressed"
setAdvancedAlert(true);
//disablePermissionChecks();

if (name == "Export URLs") {
    if (lgSelection.getLinks().length != 0) {
        var links = lgSelection.getLinks();
        var urls = [];

        for (i = 0; i < links.length; i++) {
            var link = links[i];
            var fileName = link.getName();
            var lgURL;
            if (/(http(s?)):\/\/|(ftp(s?)):\/\//gi.test(link.getUrl())) {
                lgURL = link.getUrl() + "#" + fileName;
            } else {
                lgURL = link.getContentURL() + "#" + fileName;
            }
            urls.push(lgURL);
        }
        alert(urls.join("\r\n") + "\n");
    }
}

Example "See new links" (in the comment field):
Code:
// See new links (in the comment field)
// Trigger : "A new link has been added"
//setAdvancedAlert(true);
//disablePermissionChecks();

var myPLink = link;
if (/(http(s?)):\/\/|(ftp(s?)):\/\//gi.test(myPLink.getURL())) {
    myPLink.setComment(myPLink.getURL());
} else {
    myPLink.setComment(myPLink.getProperty("URL_CONTENT"));
}

Example "Get Archive Password (Downloads)" (Contextmenu):
Code:
// Get Archive Password (Downloads)
// Trigger: "DownloadList Contextmenu Button Pressed"
setAdvancedAlert(true);

if (name == "Get Archive Password") {
    if (dlSelection.getDownloadLinks().length != 0) {
        var links = dlSelection.getDownloadLinks();
        var data = "";

        for (i = 0; i < links.length; i++) {
            var link = links[i];
            var fileName = link.getName();
            var downloadURL;
            if (/(http(s?)):\/\//gi.test(link.getPluginURL())) {
                downloadURL = link.getPluginURL() + "#" + fileName;
            } else {
                downloadURL = link.getContentURL() + "#" + fileName;
            }
            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 = ""
            }
            data += downloadURL + "\n" + "Passwords:" + passwords + "\nFinalPassword: " + finalPassword + "\n\n";
        }
        alert(data);
    }
}

Example "Speedtest":
Code:
// Add downloadlinks as speedtest
// Trigger: Main Menu Button Pressed (Schaltfläche Hauptmenü betätigt)
// Triggername: Speedtest

if (name == "Speedtest") {
    var dlURL = [];

    dlURL.push("http" + "://cdn8.appwork.org/speed.zip");
    // speed.hetzner.de
    dlURL.push("https" + "://speed.hetzner.de/100MB.bin");
    dlURL.push("https" + "://speed.hetzner.de/1GB.bin");
    dlURL.push("https" + "://speed.hetzner.de/10GB.bin");
    // ovh.net/files/
    dlURL.push("http" + "://www.ovh.net/files/1Mb.dat");
    dlURL.push("http" + "://www.ovh.net/files/10Mb.dat");
    dlURL.push("http" + "://www.ovh.net/files/100Mb.dat");
    dlURL.push("http" + "://www.ovh.net/files/1Gb.dat");
    dlURL.push("http" + "://www.ovh.net/files/10Gb.dat");
    // speedtest.tele2.net
    dlURL.push("http" + "://speedtest.tele2.net/1MB.zip");
    dlURL.push("http" + "://speedtest.tele2.net/10MB.zip");
    dlURL.push("http" + "://speedtest.tele2.net/100MB.zip");
    dlURL.push("http" + "://speedtest.tele2.net/1GB.zip");
    dlURL.push("http" + "://speedtest.tele2.net/10GB.zip");
    dlURL.push("http" + "://speedtest.tele2.net/100GB.zip");
    dlURL.push("http" + "://speedtest.tele2.net/1000GB.zip");
    // speedtest.serverius.net
    dlURL.push("http" + "://speedtest.serverius.net/files/10mb.bin");
    dlURL.push("http" + "://speedtest.serverius.net/files/100mb.bin");
    dlURL.push("http" + "://speedtest.serverius.net/files/1000mb.bin");
    dlURL.push("http" + "://speedtest.serverius.net/files/2000mb.bin");
    dlURL.push("http" + "://speedtest.serverius.net/files/5000mb.bin");
    dlURL.push("http" + "://speedtest.serverius.net/files/10000mb.bin");
    // mirror.nl.leaseweb.net/speedtest
    dlURL.push("http" + "://mirror.nl.leaseweb.net/speedtest/10mb.bin");
    dlURL.push("http" + "://mirror.nl.leaseweb.net/speedtest/100mb.bin");
    dlURL.push("http" + "://mirror.nl.leaseweb.net/speedtest/1000mb.bin");
    dlURL.push("http" + "://mirror.nl.leaseweb.net/speedtest/10000mb.bin");
    // mirror2.netcologne.de
    dlURL.push("http" + "://mirror2.netcologne.de/10g.bin");
    dlURL.push("http" + "://mirror2.netcologne.de/1gb.bin");
    // speedtest.belwue.net/http-dl.html
    dlURL.push("http" + "://speedtest.belwue.net/random-100M");
    dlURL.push("http" + "://speedtest.belwue.net/random-1G");
    dlURL.push("http" + "://speedtest.belwue.net/10G");
    dlURL.push("http" + "://speedtest.belwue.net/100G");
    dlURL.push("http" + "://speedtest.belwue.net/1000G");
    // www.speedtestx.de (captcha required)
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_1mb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_10mb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_100mb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_256mb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_500mb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_1gb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_5gb.test");
    //dlURL.push("https" + "://www.speedtestx.de/testfiles/data_100mb_compressable.test");


    callAPI("linkgrabberv2", "addLinks", {
        "deepDecrypt": false,
        "packageName": "Speedtest",
        "links": dlURL.join("\r\n")
    });

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

Last edited by thecoder2012; 22.07.2019 at 09:07.
Reply With Quote
  #809  
Old 27.06.2019, 00:22
dankmemer dankmemer is offline
Baby Loader
 
Join Date: Jun 2019
Posts: 8
Default

I tried searching but I don't think my specific case was discussed here!

I am downloading files that sometimes have the same file name, however they are not the same file. Sometimes they are, but sometimes they're not. I think this was a website that did poor CDN practices early on, but later changed their file name system when they grew.

Anyways, what the script would have to check for is both the file name AND the size of the file. If both are the same, then the file is a duplicate, otherwise download the file by renaming the new file.

The files are all within folder, example:
Folder > Folder1 > 67575675.jpg
Folder > Folder1 > 67575675.jpg (duplicate)


There are other folders, so in that example imagine Folder2, etc. BUT this script only needs to check the folder it's saving within.
Reply With Quote
  #810  
Old 27.06.2019, 03:15
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,606
Default

@dankmemer
core feature already does that, so a script wont be needed.
settings > advanced settings > GeneralSettings.mirrordetectiondecision == FILENAME_FILESIZE
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #811  
Old 28.06.2019, 15:35
the Dark
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
Delete files at specified interval:
Code:
// Delete downloaded files from user-specified folder, at user-specified interval.
// Trigger : Interval (300000)

var myFolder = "/as/example/deletefilesfolder"; // <- case-sensitive

getAllDownloadLinks().forEach(function(link) {
    if (!link.isFinished()) return;
    var file = getPath(link.getDownloadPath());
    if (!file.exists()) return;
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) file.delete();
})

Delete files immediately after downloading (Recommended):
Code:
// Delete downloaded files from user-specified folder, immediately after it's been downloaded.
// Trigger : A Download Stopped

var myFolder = "/as/example/deletefilesfolder"; // <- case-sensitive

if (link.isFinished()) {
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) {
        var file = getPath(link.getDownloadPath());
        file.delete();
    }
}
Sorry this is the script now but I can not make it work

Code:
// Enable Folder Watch on user specified dates
// Trigger : Interval

var dates = [1, 16]; // <- Set dates
var watchfolder = "/watchfolder/dir";
var myFolder = "/downloadfolder/delete/after/download"; // <- case-sensitive
var currentStatus = callAPI("extensions", "isEnabled", folderWatch);
var desiredStatus = dates.indexOf(new Date().getDate()) > -1;

if (currentStatus != desiredStatus) callAPI("extensions", "setEnabled", folderWatch, desiredStatus);

if sourceurl(s) contains : file:/*.dlc;
then set... Download Directory: /downloadfolder/delete/after/download;

// Delete downloaded files from user-specified folder, immediately after it's been downloaded.
// Trigger : A Download Stopped

if (link.isFinished()) {
    var downloadFolder = link.getPackage().getDownloadFolder();
    if (downloadFolder == myFolder) {
        var file = getPath(link.getDownloadPath());
        file.delete();
    }
}
Is there also an option to not move the laoded *.dlc into a subfolder "added" ?

Last edited by the Dark; 28.06.2019 at 15:39.
Reply With Quote
  #812  
Old 28.06.2019, 15:41
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

Quote:
Originally Posted by the Dark View Post
Is there also an option to not move the laoded *.dlc into a subfolder "added" ?
I could add support to *rename* the file. Somehow JDownloader needs to know if to parse the file again or it is already been processed before
__________________
JD-Dev & Server-Admin
Reply With Quote
  #813  
Old 28.06.2019, 16:30
manforce
Guest
 
Posts: n/a
Default

Good afternoon to everybody,
I've a question. It's my first time here, sorry if I re-write something already wrote, please tell me in case, no worries!
My idea is to make a script do download everyday a file and then send it by mail.
Would it be possible?
Thanks so much in advance...
Reply With Quote
  #814  
Old 28.06.2019, 17:26
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

Quote:
Originally Posted by manforce View Post
My idea is to make a script do download everyday a file and then send it by mail.
Download the same file? different file? send the file or link by mail. I'm asking because larger files are often not supported by mail providers
__________________
JD-Dev & Server-Admin
Reply With Quote
  #815  
Old 28.06.2019, 17:54
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by the Dark View Post
Sorry this is the script now but I can not make it work
How can it work? They are 2 different scripts with 2 different triggers. Also the instructions to create the packagizer rule are not part of the script. They are just instructions to create a packagizer rule.
  • Add the scripts separately, and select the triggers as per instructions in the script.
  • Create the packagizer rule in 'Settings > Packagizer' based on the instruction provided in my earlier post.
Reply With Quote
  #816  
Old 29.06.2019, 07:53
the Dark
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
How can it work? They are 2 different scripts with 2 different triggers. Also the instructions to create the packagizer rule are not part of the script. They are just instructions to create a packagizer rule.
  • Add the scripts separately, and select the triggers as per instructions in the script.
  • Create the packagizer rule in 'Settings > Packagizer' based on the instruction provided in my earlier post.
OK thanks!!
I got it now - half way.
Everytime I start a download manually (other path than my "delete folder") I get an error message because no files ar in me "delete"folder



Also the *.dlc file gets moved into "added" subfolder - is there a possibility to move if all downloads are finished? --> move als *dlc from subfolder "added" to subfolder "watch"?
Reply With Quote
  #817  
Old 01.07.2019, 10:29
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

@mgpai and the_Dark:
link.getPackage() may return null when the link no longer belongs to a package. scripts needs to check for null
__________________
JD-Dev & Server-Admin
Reply With Quote
  #818  
Old 01.07.2019, 11:05
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai and the_Dark:
link.getPackage() may return null when the link no longer belongs to a package. scripts needs to check for null
Quote:
Originally Posted by the Dark View Post
Everytime I start a download manually ... I get an error message ...
@jiaz: How can it be null on download start? Also, none of the scripts provided to the user have a "A Download Started" Trigger. I have not been able to reproduce the it.

It is possible for one of the scripts (delete after download) to throw that error, if the user has enabled "remove finished downloads" in General Settings. In which case, the user will need to disable it for the script to work.

I will check again when I get user feedback.

@the Dark: Make sure you have selected the correct trigger.

Quote:
Originally Posted by the Dark View Post
Also the *.dlc file gets moved into "added" subfolder - is there a possibility to move if all downloads are finished? --> move als *dlc from subfolder "added" to subfolder "watch"?
If you are enabling the folderwatch only on specific dates, you would not need to move the DLCs to a subfolder. You can just keep them in the 'added' folder and move them back to the watchfolder, whenever you wish to download them again. Under these circumstances, you will also not need a script to enable/disable folderwatch.
Reply With Quote
  #819  
Old 01.07.2019, 11:15
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

@mgpai: my guess is that there is wrong script/wrong event. screenshot shows that "getDownloadFolder of null" and that happens when link.getPackage is null. Yes, remove finished downloads must be disabled else the link will be removed from list before any script can process them.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #820  
Old 01.07.2019, 16:24
manforce
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
Download the same file? different file? send the file or link by mail. I'm asking because larger files are often not supported by mail providers
Hi!
Thank you first of all..
there're different file, like newspapers, about 25MB each.
Would be it possible?
Thanks again:)
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 19:03.
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 - 2023, Jelsoft Enterprises Ltd.