JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 31.12.2019, 17:42
Knight Knight is offline
Modem User
 
Join Date: Dec 2019
Posts: 3
Question Setting Download Directory in Custom Decrypter

Hello,

I'm trying to create a custom decrypter for my personal use. The basic premise is a page that has multiple blocks of links. These blocks have a title followed by a list of links.

My decrypter reads these blocks, and then puts them into different packages, with the title as the package name. Everything so far works great.

I'm however trying to change the download directory for these packages, and they don't seem to be taking effect. I want these packages to be a sub-directory inside another directory (name will be title of page) in the download path.

Here is the code snippet I'm trying to use. The log does show the new directory, but after the links have been crawled, the Save To property is still [default_path]/<jd:packagename> instead of possibly [default_path]/[d]/<jd:packagename>

Code:
if (dir != null) {
    String d = dir.replaceAll("([\\\\|<|>|\\||\r|\n|\t|\"|:|\\*|\\?|/|\\x00-\\x1f])+", "_");
    Path p = Paths.get(fp.getDownloadDirectory(), d);
    p.toFile().mkdirs();
    fp.setDownloadDirectory(p.toString());
    logger.info("dir: " + fp.getDownloadDirectory());
}
fp.setName(n);
Could you please help me with this?
Thank you for your time.
Reply With Quote
  #2  
Old 01.01.2020, 01:59
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,724
Default

Hi we do not set download path within decrypter plugins. This is done via JD core functions.
Provided from global setting for default path (with package customiser adjustment, sub directory based on package name) or user defined paths with package customiser rules.
folderwatch or linkcrawler rules or api can define a path also.

for a single directory you can do this by setting the FilePackage name, and subdirectory as package name.
if you want nested directory support (multiple directories deep), we do have special means todo this via package customiser and 'Predefined rule: Adopt directory structure) && DownloadLink property ( dl.setProperty(DownloadLink.RELATIVE_DOWNLOAD_FOLDER_PATH, folder_path);
). For a working example at this look at GoogleDrive Decrypter

Hope that helps.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #3  
Old 01.01.2020, 09:31
Knight Knight is offline
Modem User
 
Join Date: Dec 2019
Posts: 3
Default

Thank you for the quick response.

I ended up using a delimiter and setting a rule in the packagizer. I think setting the property didn't work for me because the links go through other decrypters, and they don't push the property down the stack.

As an aside, is there a mechanism to have the decrypter sort of "collect" decrypted links down however many levels from other decrypters, and then be able to set the property on them?

Thanks, and Happy New Year!
Reply With Quote
  #4  
Old 02.01.2020, 01:34
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,724
Default

From what I can tell, the property is gathered from re-entry event on the same plugin (eg. google drive directory > google drive sub-directory > google drive sub-directory > google drive files...) DownloadLink and that is fetched by a call to getAdoptedCloudFolderStructure() method and the required path is constructed based on that property and previous entry.

from my understanding, its meant for preserving directory tree structure on these type of sites. I don't believe its meant to be utilised from different providers (decrypters).
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #5  
Old 02.01.2020, 04:47
Knight Knight is offline
Modem User
 
Join Date: Dec 2019
Posts: 3
Default

I see, understood.

Thank you.
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 13:49.
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.