View Single Post
  #987  
Old 13.10.2019, 21:26
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,553
Default

Quote:
Originally Posted by RPNet-user View Post
... I will enable this script only when ... the uploaded account is enabled
You can also try this. It will check/process the links only when "uploaded.to" account is enabled.

Code:
// Unskip and start downloading links with "Invalid download directory" message, if the destination folder is available.
// Trigger : Download Controller Stopped

var accountEnabled = callAPI("accounts", "queryAccounts", {
    "enabled": true
}).some(function(account) {
    return account.hostname == "uploaded.to" && account.enabled;
})

if (accountEnabled) {
    getAllFilePackages().forEach(function(package) {
        package.getDownloadLinks().forEach(function(link) {
            if (link.getSkippedReason() == "INVALID_DESTINATION") {
                if (getPath(package.getDownloadFolder()).exists()) {
                    link.setSkipped(false);
                    if (!isDownloadControllerRunning()) startDownloads();
                }
            }
        })
    })
}

Last edited by mgpai; 13.10.2019 at 22:00. Reason: Corrected the description in script
Reply With Quote