JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1541  
Old 10.10.2020, 07:49
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 991
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: 991
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
Ultra Loader
 
Join Date: Sep 2019
Posts: 47
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: 991
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
Ultra Loader
 
Join Date: Sep 2019
Posts: 47
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: 68,193
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: 991
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: 991
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: 991
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: 991
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: 68,193
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: 991
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 Addict
 
Join Date: Feb 2020
Posts: 151
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: 991
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 14:31.
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 - 2020, Jelsoft Enterprises Ltd.