View Single Post
  #1924  
Old 12.10.2021, 03:20
BillyCool BillyCool is offline
Super Loader
 
Join Date: Sep 2016
Location: Australia
Posts: 28
Default

@Jiaz

Here's a basic version that replicates the issue:
Code:
disablePermissionChecks();
setNotifyOnException(true);

// Run one at a time
test1(); // Causes: Security Violation --> Security Violation org.appwork.exceptions.WTFException
//test2(); // Causes: WTFException --> what the like just happened here? no lastValidFilePackage

function test1() {
    try {
        getAllCrawledLinks().forEach(function(link) {
            log(link.getPackage().getDownloadFolder()); // null when download path is default, otherwise works
            log(link.getDownloadPath()); // never works
        });
    } catch (ex) {
        log(ex);
    }
}

function test2() {
    getAllCrawledLinks().forEach(function(link) {
        log(link.getPackage().getDownloadFolder()); // null when download path is default, otherwise works
        log(link.getDownloadPath()); // never works
    });
}

function log(text) {
    writeFile(JD_HOME + '/testing.txt', text + getEnvironment().getNewLine(), true);
}
How I'm running it:
  • Running on 'None' trigger, as it's a work in progress (for now)
  • I run the script manually via 'Test Run' (for now)
  • As for the links, I'm testing with plain standard youtube links, but have tried others as well with the same results. Tried both single and multiple links in the same package.

Further findings/thoughts:
  • I get a more detailed error when not running in a try-catch, see comment in script. I'm not sure why, the exception doesn't seem to get caught as I get nothing in the log file.
  • Getting the download path through the package works when the download path is not your default download location. It might be intended to return null if it's the default, and the expectation is to get the default download path from settings using the API. For now, this is my workaround.
  • I'm not sure a crawled link should have "getDownloadPath()" in the first place. You can't change the download path of a link individually without changing it for the entire package. So it makes sense to me that if you want to get or set the download path, you do that via the package, not the link.
Reply With Quote