View Single Post
  #950  
Old 02.10.2019, 10:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 659
Default

Quote:
Originally Posted by Amiganer View Post
Setting an option should be no problem.
(Please put it in comments of the script, so it is not forgotten.)
Caution: This script will move finished links to a different package.

Code:
// Move finished link to user-defined package
// Trigger: A Download stopped
// IMPORTANT: Disable "GeneralSettings.movefilesifdownloaddestinationchangesenabled" in advanced settings

if (link.isFinished()) {
    var newPkgName = "Already Downloaded"; // <- Package name to which the finished link will be moved

    var linkIds = [link.getUUID()];
    var destPackageID = null;

    getAllFilePackages().some(function(package) {
        if (package.getName() == newPkgName) {
            destPackageID = package.getUUID();
            return true;
        }
    })

    if (destPackageID) {
        callAPI("downloadsV2", "moveLinks", linkIds, null, destPackageID);
    } else {
        callAPI("downloadsV2", "movetoNewPackage", linkIds, null, newPkgName, null);
    }
}

Quote:
Originally Posted by Amiganer View Post
Is there a documentation for the EventScript? Till now I have not found anything....
A list of available methods (with some examples) can be found in the eventscripter script editor (Main Menu > Show/Hide Help). You can also use MYJD API methods in the eventscripter (using callAPI method).

Code:
my.jdownloader.org/developers

If you need additional info/help, you can post your queries here. You can also find me/Jiaz in JD Chat.

Last edited by mgpai; 02.10.2019 at 11:18. Reason: Correction (Trigger: A Download stopped)
Reply With Quote