JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 20.03.2019, 11:19
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default Move after extraction

Good day.
In settings I only see move to recycle or delete for option after extration.
I want to auto move to specific folder for archiving after succesfull extraction. And only after sucessful extraction.

How can I do this?
Reply With Quote
  #2  
Old 20.03.2019, 12:54
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,343
Default

For example you can setup a custom extraction destination in Settings. That would be easiest solution.
Or you could make of eventscripter and write/use script that moves files after extraction, check https://board.jdownloader.org/showthread.php?t=70525
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 20.03.2019, 20:55
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Quote:
Originally Posted by Jiaz View Post
For example you can setup a custom extraction destination in Settings. That would be easiest solution.
Or you could make of eventscripter and write/use script that moves files after extraction, check **External links are only visible to Support Staff**...
I am sorry I was not clear enough to understand. I want to move the archive after extraction. For extracted file it is clear I can extract to some folder. But I want to move the archive to specific destination instead of recycle bin after successful extraction.
Reply With Quote
  #4  
Old 21.03.2019, 09:54
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,343
Default

Ah, sorry. Missunderstanding. You want the archive file itself, not the extracted files, to be moved to different location?
We already got an open ticket for that
but at the moment time is rare for such features but I will increase priority
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 21.03.2019, 11:50
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Oh yes this would be very helpful. Hope to see this feature. Maybe it will not take too long. Thank you.
Reply With Quote
  #6  
Old 21.03.2019, 13:03
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Currently possible using a script. This script for example, moves the archive files from "JD Downloads" folder to "!TRASH!" folder after extractoin.
Reply With Quote
  #7  
Old 22.03.2019, 07:04
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Ah script is possible. Very interesting will try. Thanks.
Is there tutorial how to start to write script? Like what functions in Jdownloader can be modified by scripts?
Reply With Quote
  #8  
Old 22.03.2019, 10:01
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,343
Default

@sherbee: Syntax is Javascript and all available methods for current selected event-type are listed in top half of the editor window
Whenever you got questions /need help or got stuck, mgpai is our script master
__________________
JD-Dev & Server-Admin
Reply With Quote
  #9  
Old 23.03.2019, 14:12
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Thank you all.
I bit stuck already

I see method readFile to read password list &
I have org.jdownloader.extensions.extraction.ExtractionExtension.passwordlist.json

So when I
1. read my file
2. transform to json
3. save file as: org.jdownloader.extensions.extraction.ExtractionExtension.passwordlist.json

Then everything good? Or someething I miss?
Reply With Quote
  #10  
Old 23.03.2019, 14:44
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Example script:
Code:
var interfaceName = "org.jdownloader.extensions.extraction.ExtractionConfig";
var storage = "cfg/org.jdownloader.extensions.extraction.ExtractionExtension";
var key = "PasswordList";
var value = /*Read and convert your file into JSON array format*/;

callAPI("config", "set", interfaceName, storage, key, value);
Reply With Quote
  #11  
Old 24.03.2019, 13:58
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Quote:
Originally Posted by mgpai View Post
Example script:
Code:
var interfaceName = "org.jdownloader.extensions.extraction.ExtractionConfig";
var storage = "cfg/org.jdownloader.extensions.extraction.ExtractionExtension";
var key = "PasswordList";
var value = /*Read and convert your file into JSON array format*/;

callAPI("config", "set", interfaceName, storage, key, value);
Ahhh. So many thank you I cannot write it all. You are really script god!!

I am not good coder but I have something work now. I can put it here for somebody who wants it?

Quote:
/* Script reads passwords from an existing file line by line
/* removes empty lines, merge with existing Jdownloader password
/* list, deduplicate and store as new password list in Jdownloader
*/

const FILENAME = "C:\\Users\\DownloadUser\\Documents\\passwords.txt"; //Enter path to file. Escape single \ with double \\

if (getPath(FILENAME).exists()) {

// Prepare API call
var interfaceName = "org.jdownloader.extensions.extraction.ExtractionConfig";
var storage = "cfg/org.jdownloader.extensions.extraction.ExtractionExtension";
var key = "PasswordList";

// Read JDownloader password list for keep
var pwl = callAPI("config", "get", interfaceName, storage, key);

//Read password list from disk
var fn = readFile(FILENAME);

// Process file, remove line break characters and empty values
fn = fn.split(/(\r\n|\n|\r)/gm).filter(function(e) {
return e !== "\r\n"
}).filter(function(e) {
return e !== ""
});

// Merge with list exist and remove duplicates
fn = fn.concat(pwl).filter(function(e, i) {
return fn.indexOf(e) >= i;
});

//Call Jdownloader API to store
callAPI("config", "set", interfaceName, storage, key, fn);
}
Is good?
Reply With Quote
  #12  
Old 25.03.2019, 07:23
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Suggestion: Call the API to store, only if new passwords are discovered.
Reply With Quote
  #13  
Old 25.03.2019, 08:34
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Yes very good idea.
I make it so:

Code:
/* Script reads passwords from an existing file line by line
/* removes empty lines, merge with existing Jdownloader password 
/* list, deduplicate and store as new password list in Jdownloader
*/

const FILENAME = "C:\\Users\\DownloadUser\\Documents\\passwords.txt"; //Enter path to file. Escape single \ with double \\

if (getPath(FILENAME).exists()) {

    // Prepare API call
    var interfaceName = "org.jdownloader.extensions.extraction.ExtractionConfig";
    var storage = "cfg/org.jdownloader.extensions.extraction.ExtractionExtension";
    var key = "PasswordList";

    // Read JDownloader password list for keep
    var pwl = callAPI("config", "get", interfaceName, storage, key);

    //Read password list from disk
    var pf = readFile(FILENAME);

    // Process file, remove line break characters and empty values
    pf = pf.split(/(\r\n|\n|\r)/gm).filter(function(e) {
        return e !== "\r\n"
    }).filter(function(e) {
        return e !== ""
    });

    // Merge with list exist and remove duplicates
    pf = pf.concat(pwl).filter(function(e, i) {
        return pf.indexOf(e) >= i;
    });

    //Call API to store only when new password list is differentiate from old password list
    if (!(pwl.length === pf.length && pwl.sort().every(function(value, index) {
            return value === pf.sort()[index]
        }))) {
        //Call Jdownloader API
        callAPI("config", "set", interfaceName, storage, key, pf);
    } 
}
Reply With Quote
  #14  
Old 26.03.2019, 13:09
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,343
Default

@sherbee: Yes, mgpai is a true master Also thanks for sharing your final script!
__________________
JD-Dev & Server-Admin
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:09.
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 - 2024, Jelsoft Enterprises Ltd.