JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1521  
Old 19.08.2020, 14:21
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Dockel View Post
I hope on Monday or Tuesday I will make it, I still have too much to do. Hope, that is OK.
Yes. It's fine.
Reply With Quote
  #1522  
Old 19.08.2020, 14:59
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 664
Default

Great! Thank you very much!
__________________
Aktuelles Windows
Reply With Quote
  #1523  
Old 21.08.2020, 22:39
DeusExBestia DeusExBestia is offline
DSL User
 
Join Date: Feb 2018
Posts: 36
Default

I'm looking for a script that will replace any twitter links that contain "/status/NumbersHere" with "/media." I've found some javascript things that claim to replace text with other text, but I have no idea what I'm doing.
Reply With Quote
  #1524  
Old 24.08.2020, 12:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by DeusExBestia View Post
... script that will replace any twitter links that contain "/status/NumbersHere" with "/media." ...
Code:
/*
    Rewrite URL
    Trigger: New Crawler Job
*/

var re = /(https:\/\/twitter.com\/[^\/]+\/)(status\/\d+)/g;
var text = job.text;

if (re.test(text)) {
    job.text = job.text.replace(re, "$1media");
}
Reply With Quote
  #1525  
Old 26.08.2020, 06:46
DeusExBestia DeusExBestia is offline
DSL User
 
Join Date: Feb 2018
Posts: 36
Thumbs up

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Rewrite URL
    Trigger: New Crawler Job
*/

var re = /(https:\/\/twitter.com\/[^\/]+\/)(status\/\d+)/g;
var text = job.text;

if (re.test(text)) {
    job.text = job.text.replace(re, "$1media");
}
Ahhhhhhhhhh! Perfect! Thank you :D
Reply With Quote
  #1526  
Old 26.08.2020, 15:36
Bilkoff Bilkoff is offline
Junior Loader
 
Join Date: Sep 2019
Posts: 10
Default

Is there something like link.isExtractable or I have to do it only by the file extension?
Reply With Quote
  #1527  
Old 26.08.2020, 15:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Bilkoff View Post
Is there something like link.isExtractable or I have to do it only by the file extension?
You can find a list of available methods in the built-in help of the script editor. Following methods return archive object for links/packages, if present. Else, it returns null.

Code:
var myArchive = myCrawledLink.getArchive();
var myArchive[] = myCrawledPackage.getArchives();
var myArchive = myDownloadLink.getArchive();
var myArchive[] = myFilePackage.getArchives();
Reply With Quote
  #1528  
Old 08.09.2020, 23:23
Emp3 Emp3 is offline
Modem User
 
Join Date: Sep 2020
Posts: 1
Default MP3 Event Scripter stopped working

Hi folks,

I have followed the instructions on the forum and successfully installed the script so that the downloaded content is automatically converted to MP3 format.

It worked ok for one day and now its not converting anymore.

Please can someone point me to the right direction?

Kind Regards
Reply With Quote
  #1529  
Old 09.09.2020, 04:46
RedNapalm RedNapalm is offline
Wind Gust
 
Join Date: Dec 2017
Posts: 44
Default

Hey I need a script that simply copies the file directory and pastes it as a comment since there isn't a search function for directories. Thanks!
Reply With Quote
  #1530  
Old 09.09.2020, 07:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

I was unable to reproduce any errors. Check if the script has been disabled. If the script is getting disabled automatically, provide the url which causes the same.
Reply With Quote
  #1531  
Old 09.09.2020, 08:13
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by RedNapalm View Post
... a script that simply copies the file directory and pastes it as a comment ..
Code:
/*
    On download finished, append download folder to comment
    Trigger: A Download Stopped
*/

if (link.finished) {
    var comment = link.comment || "",
        folder = link.package.getDownloadFolder();

    if (comment.indexOf(folder) == -1) {
        link.comment = comment + folder;
    }
}
Reply With Quote
  #1532  
Old 09.09.2020, 09:07
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Requested by dex1983 (IRC)

Code:
/*
    On package finished, if the package does not contain archives, move files to user-specified location
    Trigger: Package finished
*/

var myFolder = "/path/to/folder"; //<- set destination path

if (!package.getArchives().length) {
    package.getDownloadLinks().forEach(function(link) {
        getPath(link.downloadPath).moveTo(myFolder);
    })
}

Code:
/*
    On package finished, move files to user-specified location
    Trigger: Archive extraction finished
*/

var myFolder = "/path/to/folder", //<- set destination path
    links = archive.getDownloadLinks();

if (links) {
    var package = links[0].package;

    if (package.finished) {
        package.getDownloadLinks().forEach(function(link) {
            if (link.getArchive()) {
                archive.getExtractedFilePaths().forEach(function(file) {
                    file.moveTo(myFolder);
                })
            } else {
                getPath(link.downloadPath).moveTo(myFolder);
            }
        })
    }
}
Reply With Quote
  #1533  
Old 09.09.2020, 13:55
pspzockerscene's Avatar
pspzockerscene pspzockerscene is online now
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 70,913
Default

Merged EventScripter threads.
__________________
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
  #1534  
Old 09.09.2020, 15:39
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Requested by @RedNapalm (IRC)

Code:
/*
    Append download folder to comment
    Trigger: Downloadlist Contextmenu button pressed
    Customize context menu > Add new "Eventscript Trigger" button > Rename it to "Append folder to comment" (without quotes) > Change Icon (optional))
*/

if (name == "Append folder to comment") {
    dlSelection.getLinks().forEach(function(link) {

        if (link.finished) {
            var comment = link.comment || "",
                folder = link.package.getDownloadFolder();

            if (comment.indexOf(folder) == -1) {
                link.comment = comment + folder;
            }
        }

    })
}
Reply With Quote
  #1535  
Old 15.09.2020, 20:19
quidnunc quidnunc is offline
Modem User
 
Join Date: Aug 2020
Posts: 4
Default blacklist stop captcha notification to mobile?

via the blacklist I disabled captcha to mobile and other manual options except for a few that are whitelisted and the blacklisted does not show up inside the iOS app to solve the captcha - however I still receive the notification (presumably generated via the event scripter) that there is a captcha challenge to solve. Is there a way to disable this notification if the captcha is within the blacklist? (I would still like to receive the notification for the whitelisted hosts)

for context the blacklisted captcha is solved already by external captcha method (CaptchaSolver). maybe the problem is that external captcha method does not figure in the captcha solver priority/timing?
Reply With Quote
  #1536  
Old 16.09.2020, 16:27
pspzockerscene's Avatar
pspzockerscene pspzockerscene is online now
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 70,913
Default

Merged EventScripter threads.

@quidnunc
Your script will need functionality to process that blacklist.
You will have to update it accordingly.

-psp-
__________________
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
  #1537  
Old 29.09.2020, 01:52
metozeton metozeton is offline
Modem User
 
Join Date: Sep 2020
Posts: 1
Default

Quote:
Originally Posted by mgpai View Post
Export download URLs (Linkgrabber List)
  • Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\export")
  • Default file name: "<timestamp> - LG Selection.txt" (e.g. "Nov 25 2016 17.26.44 - LG Selection.txt")
Code:
// Export download URLs
// Trigger : "Linkgrabber Contextmenu Button Pressed"

if (name == "Export URLs") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - LG Selection.txt"; // <- Filename for exporting the URLs
    var links = lgSelection.getLinks();
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        var downloadURL = link.getContentURL();
        urls.push(downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}

Export Download URLs (Download List)
  • Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\export")
  • Default file name: "<timestamp> - DL Selection.txt" (e.g. "Nov 25 2016 17.26.44 - DL Selection.txt")
Code:
// Export download URLs
// Trigger : "DownloadList Contextmenu Button Pressed"

if (name == "Export URLs") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - DL Selection.txt"; // <- Filename for exporting the URLs
    var links = dlSelection.getDownloadLinks();
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        var downloadURL = link.getContentURL();
        urls.push(downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}

Hello,

It works. But how can I add information about the source? (the webpage where found the link)

Last edited by metozeton; 29.09.2020 at 02:35.
Reply With Quote
  #1538  
Old 29.09.2020, 12:14
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by metozeton View Post
... how can I add information about the source? (the webpage where found the link)
If available, JD may save the webpage URL as 'origin', 'referrer' or 'container' URL depending on the plugin and/or how it was copied. The following script will export all the available URLs related to a link. It can be used with DL or LG context menu trigger.

Code:
// Export related URLs
// Trigger : Linkgrabber Contextmenu Button Pressed OR DownloadList Contextmenu Button Pressed

if (name == "Export URLs") {
    var lgSelection, dlSelection,
        selection = lgSelection || dlSelection;

    if (selection) {
        var folder = JD_HOME + "/auto/export/", // <- Folder for exporting the text files
            date = new Date().toString().substring(4, 24).replace(/:/g, "."), // <- Timestamp used in file name
            name = lgSelection ? " - LG Selection.txt" : " - DL Selection.txt",
            file = date + name,
            content = [],
            links = selection.links,
            addContent = function(arr, data) {
                if (data && arr.indexOf(data) == -1) {
                    arr.push(data);
                }
            };

        links.forEach(function(link) {
            var arr = [];
            addContent(arr, link.name);
            addContent(arr, link.contentURL);
            addContent(arr, link.pluginURL);
            addContent(arr, link.containerURL);
            addContent(arr, link.referrerURL);
            addContent(arr, link.originURL);
            content.push(arr.join(","));
        })

        if (!getPath(folder).exists()) {
            getPath(folder).mkdirs();
        }
        
        writeFile(folder + file, content.join("\r\n"), true);
    }
}
Reply With Quote
  #1539  
Old 06.10.2020, 08:36
MiloSun MiloSun is offline
I will play nice!
 
Join Date: Oct 2020
Posts: 1
Default Where do I type in this code?

:confused:

Hello
I'm new at this. I want to in convert all audio files into MP3 format.
Can you please explain me where to input this code and how to do it?
Also, if I want to download in OGG format later, how do I revert to the default settings?

THANK YOU SO MUCH!!!
:biggrin:




Quote:
Originally Posted by mgpai View Post
Convert AAC/M4A/OGG files to MP3.
Code:
// Convert aac/m4a/ogg files to mp3.
// Trigger required: "A Download Stopped".
// Requires ffmpeg/ffprobe. Uses JD ffmpeg/ffprobe settings if available.
// Overwrites destination file (mp3) if it already exists.

if (link.isFinished()) {
    var fileName = link.name.replace(/(.+)(\..+$)/, "$1");
    var fileType = link.name.replace(/(.+)(\..+$)/, "$2");
    var sourceFile = link.getDownloadPath();
    var audioFile = /\.(aac|m4a|ogg)$/.test(sourceFile);

    if (audioFile) {
        var downloadFolder = package.getDownloadFolder();
        var destFile = downloadFolder + "/" + fileName + ".mp3";
        var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath");
        var ffprobe = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypathprobe");
        var data = JSON.parse(callSync(ffprobe, "-v", "quiet", "-print_format", "json", "-show_streams", "-show_format", sourceFile));
        var streamsBitrate = data.streams[0].bit_rate ? data.streams[0].bit_rate : 0;
        var formatBitrate = data.format.bit_rate ? data.format.bit_rate : 0;
        var bitrate = Math.max(streamsBitrate, formatBitrate) / 1000;
        var deleteSourceFile = false; // Set this to true to delete source file after conversion.

        if (bitrate > 0) {
            callSync(ffmpeg, "-y", "-i", sourceFile, "-b:a", bitrate + "k", destFile);
            if (deleteSourceFile && getPath(destFile).exists()) deleteFile(sourceFile, false);
        }
    }
}
Reply With Quote
  #1540  
Old 09.10.2020, 17:55
marka marka is offline
Modem User
 
Join Date: Oct 2020
Posts: 3
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Add metadata to image file, using external program
// Trigger: "A Download Stopped"
// External program required: ExifTool by Phil Harvey (**External links are only visible to Support Staff**
// IMPORTANT: Remove any command line parameters included in the executable. For e.g. in Windows OS, rename 'exiftool(-k).exe' to 'exiftool.exe'

if (link.isFinished()) {
    var filePath = link.getDownloadPath();
    var ext = getPath(filePath).getExtension();
    var supported = ["jpg", "tiff"]; // <- Specify supported file types.

    if (supported.indexOf(ext) > -1) {
        var comment = link.getComment();

        if (comment) {
            var exiftool = "c:/portable/exiftool/exiftool.exe"; // <- Set full path to "exiftool.exe"
            var tagName = "comment"; // <- For the comment to be visible in the OS file properties viewer, use OS compatible tag name.
            comment = comment.replace(/"/g, "'");
            callAsync(function() {}, exiftool, "-overwrite_original", "-" + tagName + "=" + comment, filePath);
        }
    }
}
Hello, I would like to change the "Title" from Filname with the exiftool.
Thats the comman I use:
Code:
exiftool '-PDF:Title<${filename;s/\..*?$//}' '-XMP-dc:Tile<${filename;s/\.[^.]*$//}'
Unfortunatly I dont really understand this sript. How can i add this to the provided script?
Reply With Quote
  #1541  
Old 10.10.2020, 07:49
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by MiloSun View Post
Can you please explain me where to input this code and how to do it?
Settings > Event Scripter
  • Install Event Scripter and restart JD to enable it.
  • Open Eventscripter panel > Click edit button > Paste script > Save > Enable
Quote:
Also, if I want to download in OGG format later, how do I revert to the default settings?
Disable the script in eventscripter panel.
Reply With Quote
  #1542  
Old 10.10.2020, 08:09
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by marka View Post
Hello, I would like to change the "Title" from Filname with the exiftool ...How can i add this to the provided script?
I do not use the software myself, so I am not familiar with its parameters. All external commands in the script will should be in the following format.

Synchronous:
Code:
callSync("\"commandline1\"", "\"commandline2\"", "\"...\"" });

Asynchronous:
Code:
callAsync(function(){},"\"commandline1\"", "\"commandline2\"", "\"...\"" });

Alternatively, you can create a batch file and call it in the script instead and pass the variable to it.


I can try to help you configure it if you contact me in JD Chat.
Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader
Reply With Quote
  #1543  
Old 19.10.2020, 12:52
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

Hello i would like jdownloader to automatically delete the "aac" and "ogg" files once it is finished converting them?
How should I proceed?
Can you help me ?
Thank you in advance for your answers
Reply With Quote
  #1544  
Old 19.10.2020, 12:57
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by smokiemamour View Post
... automatically delete the "aac" and "ogg" files once it is finished converting them?
You can enable the option in the script:
Code:
var deleteSourceFile = false; // Set this to true to delete source file after conversion.
Reply With Quote
  #1545  
Old 19.10.2020, 13:01
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

line 21 is already there


// Convert aac/m4a/ogg files to mp3.
// Trigger required: "A Download Stopped".
// Requires ffmpeg/ffprobe. Uses JD ffmpeg/ffprobe settings if available.
// Overwrites destination file (mp3) if it already exists.

if (link.isFinished()) {
var fileName = link.name.replace(/(.+)(\..+$)/, "$1");
var fileType = link.name.replace(/(.+)(\..+$)/, "$2");
var sourceFile = link.getDownloadPath();
var audioFile = /\.(aac|m4a|ogg)$/.test(sourceFile);

if (audioFile) {
var downloadFolder = package.getDownloadFolder();
var destFile = downloadFolder + "/" + fileName + ".mp3";
var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath");
var ffprobe = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypathprobe");
var data = JSON.parse(callSync(ffprobe, "-v", "quiet", "-print_format", "json", "-show_streams", "-show_format", sourceFile));
var streamsBitrate = data.streams[0].bit_rate ? data.streams[0].bit_rate : 0;
var formatBitrate = data.format.bit_rate ? data.format.bit_rate : 0;
var bitrate = Math.max(streamsBitrate, formatBitrate) / 1000;
var deleteSourceFile = false; // Set this to true to delete source file after conversion.

if (bitrate > 0) {
callSync(ffmpeg, "-y", "-i", sourceFile, "-b:a", bitrate + "k", destFile);
if (deleteSourceFile && getPath(destFile).exists()) deleteFile(sourceFile, false);
}
}
}
Reply With Quote
  #1546  
Old 19.10.2020, 20:15
Artex Artex is offline
I will play nice!
 
Join Date: Oct 2020
Posts: 4
Default Move Completed Downloads to alternate folder, into a subfolder of the same name

So similar to this:

// 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);
}


I'm looking for a way to move completed downloads into a 'subfolder' of the "c:/myFolder/movedFiles" that has the same name as the file or folder being downloaded.

So if JDownloader2 is downloading the following...
  • C:\Downloads\TestFileFolder\TestFileName.txt
  • C:\Downloads\TestFileFolder\TestSubfolder\SubfolderFile.txt

...then once completed, move them to:
  • c:/myFolder/movedFiles/TestFileFolder
  • c:/myFolder/movedFiles/TestFileFolder/TestSubfoldder

This would keep the structure intact.

Thanks!
Reply With Quote
  #1547  
Old 19.10.2020, 20:32
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@smokiemamour: you have to modify
Quote:
var deleteSourceFile = false; // Set this to true to delete source file after conversion.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1548  
Old 20.10.2020, 10:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Artex View Post
... move completed downloads into a 'subfolder' of the "c:/myFolder/movedFiles" that has the same name as the file or folder being downloaded.
Code:
// Move downloaded non-archive files to user-specified folder
// Trigger: A Download Stopped

if (link.finished && !link.archive) {
    var downloadFolder = link.package.downloadFolder;
    var newFolder = downloadFolder.replace("C:\\Downloads", "C:\\myFolder\\MovedFiles"); // case-sensitive

    if (newFolder != downloadFolder) {
        getPath(link.downloadPath).moveTo(newFolder);
    }
}
Reply With Quote
  #1549  
Old 20.10.2020, 18:10
Artex Artex is offline
I will play nice!
 
Join Date: Oct 2020
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Move downloaded non-archive files to user-specified folder
// Trigger: A Download Stopped

if (link.finished && !link.archive) {
    var downloadFolder = link.package.downloadFolder;
    var newFolder = downloadFolder.replace("C:\\Downloads", "C:\\myFolder\\MovedFiles"); // case-sensitive

    if (newFolder != downloadFolder) {
        getPath(link.downloadPath).moveTo(newFolder);
    }
}
Apologies - I think I was unclear:


Currently all downloads go into F:/!Downloads/JDownloader2 into a subfolder which is the name of a movie for example.

So...
  • F:/!Downloads/JDownloader2/MovieName/Movie/*.*
  • F:/!Downloads/JDownloader2/MovieName/Featurettes/*.*


When each download is finished, I would like these to go to:
  • F:/!Downloads/JDownloader2/_COMPLETE/MovieName/Movie/*.*
  • F:/!Downloads/JDownloader2/_COMPLETE/MovieName/Featurettes/*.*

[
Reply With Quote
  #1550  
Old 20.10.2020, 19:11
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Artex View Post
I think I was unclear
I have created the script based on the example you provided, in which the destination folder is not a sub-folder of the source folder, but an entirely different one.

Try replacing this:
Code:
var newFolder = downloadFolder.replace("C:\\Downloads", "C:\\myFolder\\MovedFiles"); // case-sensitive

with this:
Code:
var newFolder = downloadFolder.split("F:\\!Downloads\\JDownloader2\\").join("F:\\!Downloads\\JDownloader2\\_COMPLETE\\");// case-sensitive
Reply With Quote
  #1551  
Old 20.10.2020, 20:18
Artex Artex is offline
I will play nice!
 
Join Date: Oct 2020
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
I have created the script based on the example you provided, in which the destination folder is not a sub-folder of the source folder, but an entirely different one.

Try replacing this:
Code:
var newFolder = downloadFolder.replace("C:\\Downloads", "C:\\myFolder\\MovedFiles"); // case-sensitive

with this:
Code:
var newFolder = downloadFolder.split("F:\\!Downloads\\JDownloader2\\").join("F:\\!Downloads\\JDownloader2\\_COMPLETE\\");// case-sensitive
This didn't seem to work either I'm afraid - it left the downloaded folder (and contents) in

F:\!Downloads\JDownloader2\MovieFolderName\Movie.mkv

And I would have expected it to go to:

F:\!Downloads\JDownloader2\_COMPLETE\MovieFolderName\Movie.mkv
Reply With Quote
  #1552  
Old 21.10.2020, 00:00
StarFury StarFury is offline
Modem User
 
Join Date: Dec 2019
Posts: 2
Default

I would like JDownloader to switch a file to 'Disable' (gray out) if its Status is 'Temporarily unavailable', and skip to the next file. Is there a script that can do that?

Thanks

Last edited by StarFury; 21.10.2020 at 01:33.
Reply With Quote
  #1553  
Old 21.10.2020, 07:59
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Artex View Post
This didn't seem to work either...
Should be working fine. Here is the script used for testing, which has the same folder settings provided in your example. Please note the source folder string is case-sensitive, as commented in the script.

Code:
/*
    Move downloaded non-archive files to user-specified folder
    Trigger: A Download Stopped
*/    

if (link.finished && !link.archive) {
    var downloadFolder = link.package.downloadFolder;
    var newFolder = downloadFolder.split("F:\\!Downloads\\JDownloader2\\").join("F:\\!Downloads\\JDownloader2\\_COMPLETE\\");// case-sensitive

    if (newFolder != downloadFolder) {
        getPath(link.downloadPath).moveTo(newFolder);
    }
}
Reply With Quote
  #1554  
Old 21.10.2020, 08:04
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by StarFury View Post
I would like JDownloader to switch a file to 'Disable' (gray out) if its Status is 'Temporarily unavailable', and skip to the next file.
Links with 'Temporarily unavailable' status do not use/block any download slots and as such will automatically start the next link without any user intervention. Also, if not disabled, JD will retry those links automatically when the timer ends.

In any case, here is a script which does what you requested:
Code:
/*
    Disable links with "FILE_TEMP_UNAVAILABLE" status
    Trigger: Interval (Recommended Interval: 60000 or more)
*/   

if (isDownloadControllerRunning()) {
    getAllDownloadLinks().forEach(function(link) {
        var csr = link.conditionalSkipReason;

        if (csr) {
            var skipReason = csr.waitingSkipReason;

            if (skipReason == "FILE_TEMP_UNAVAILABLE") {
                link.setEnabled(false);
            }
        }
    })
}
Reply With Quote
  #1555  
Old 21.10.2020, 12:01
StarFury StarFury is offline
Modem User
 
Join Date: Dec 2019
Posts: 2
Smile

Thank you so much for the script, I really appreciate your help!! I just tried it and it worked for me.

I should have explained why I needed a script like this. I was looking for a way to change a file to 'Disable' when a file is not available for download, because JDownloader cannot download *some* files from this file provider I use (though the link would work in my browser if I copy/paste the link from Jdownloader2 for some reason. No big deal, I can download manually still).

But if I activate Enable Shutdown, because I want the system to shutdown after all the downloads are finished, these non-downloadable files are set to retry to download, waiting after xxx seconds, and keep retrying. And shutdown won't ever get activated because the files are still in the queue, retrying forever in a loop.

However, by Disable a file, the retry function won't get switched on. Because these files are disabled, and Enable Shutdown will work as intended after all the other files that are available, are all downloaded and finished. So that is what I was going for, and it works now, thanks for your excellent work



Quote:
Originally Posted by mgpai View Post
Links with 'Temporarily unavailable' status do not use/block any download slots and as such will automatically start the next link without any user intervention. Also, if not disabled, JD will retry those links automatically when the timer ends.

In any case, here is a script which does what you requested:
Code:
/*
    Disable links with "FILE_TEMP_UNAVAILABLE" status
    Trigger: Interval (Recommended Interval: 60000 or more)
*/   

if (isDownloadControllerRunning()) {
    getAllDownloadLinks().forEach(function(link) {
        var csr = link.conditionalSkipReason;

        if (csr) {
            var skipReason = csr.waitingSkipReason;

            if (skipReason == "FILE_TEMP_UNAVAILABLE") {
                link.setEnabled(false);
            }
        }
    })
}
Reply With Quote
  #1556  
Old 21.10.2020, 12:30
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@StarFury: Can you send us example non working links to support@jdownloader.org so we can check it
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1557  
Old 21.10.2020, 20:27
Artex Artex is offline
I will play nice!
 
Join Date: Oct 2020
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
Should be working fine. Here is the script used for testing, which has the same folder settings provided in your example. Please note the source folder string is case-sensitive, as commented in the script.

Code:
/*
    Move downloaded non-archive files to user-specified folder
    Trigger: A Download Stopped
*/    

if (link.finished && !link.archive) {
    var downloadFolder = link.package.downloadFolder;
    var newFolder = downloadFolder.split("F:\\!Downloads\\JDownloader2\\").join("F:\\!Downloads\\JDownloader2\\_COMPLETE\\");// case-sensitive

    if (newFolder != downloadFolder) {
        getPath(link.downloadPath).moveTo(newFolder);
    }
}

I'm so sorry but it's just not working for me. :(

I have an F$ drive mapped to F:

The file downloads to:

F:\!Downloads\JDownloader2\MovieName\Movie.mkv, preserving the structure so it actually creates the \MovieName subfolder in the F:\!Downloads\JDownloader2 folder as expected.

When the download is finished, I am expecting the entire MovieName\Movie.mkv to move to:

F:\!Downloads\JDownloader2\_COMPLETED\MovieName\Movie.mkv

It's not doing that though. MovieName\Movie.mkv just stays in F:\!Downloads\JDownloader2.

I do have the JDownloader2 Event Scripter for this event set to "A download stopped"

:( I really appreciate your time!
Reply With Quote
  #1558  
Old 22.10.2020, 15:28
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Artex View Post
I'm so sorry but it's just not working for me. :(
Find me in chat room:
Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader
Reply With Quote
  #1559  
Old 24.10.2020, 15:30
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 664
Default

It seems as if one could enable / disable one download at a time for sound notification only, not e.g. 10 with one click or a package:



Is there a way to enable / disable sound notification for more than one link / download and / or a package? And is there a way to recognize whether sound notification is enabled / disabled for a link?
__________________
Aktuelles Windows
Reply With Quote
  #1560  
Old 25.10.2020, 07:54
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Dockel View Post
Is there a way to enable / disable sound notification for more than one link / download and / or a package?
Code:
/*
    Toggle sound notification
    Trigger : Downloadlist Contextmenu Button Pressed AND/OR Linkgrabber Contextmenu Button Pressed
    Customize context menu > Create a new "Eventscripter trigger" button > Rename it to "Toggle sound notification" > Change Icon (optional)
*/    

if (name == "Toggle sound notification") {
    var dlSelection, lgSelection;
    var selection = dlSelection || lgSelection;

    if (selection) {
        var items = selection.linkContext ? selection.links : selection.packages;
        var myComment = selection.packageContext ? "#playsoundwhenpackagefinished#" : "#playsoundwhenlinkfinished#";

        items.forEach(function(item) {
            var comment = item.comment || "";
            
            if (comment.indexOf(myComment) > -1) {
                item.comment = comment.replace(myComment, "");
            } else {
                item.comment = myComment + comment;
            }
        })
    }
}
Quote:
Originally Posted by Dockel View Post
And is there a way to recognize whether sound notification is enabled / disabled for a link?
You can check link/package comment using any of the following to see if notification has been enabled:
  • Enable 'comment' column in list
  • Check comment field link/package properties panel
  • Use the bottom toolbar search field to filter links/packages by comment
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 16:24.
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.