JDownloader Community - Appwork GmbH
 

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 06.12.2019, 14:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by SMS View Post
How can I rename files? I want to download domain.com/foo/bar.zip as bar_foo.zip rather than as bar.zip. The renaming should happen early. For example as a Packagizer Hook, or within the following call in a script I have:

Code:
myObject = callAPI("linkgrabberv2", "addLinks", {
    "links": theLink
});
Code:
// Rename files by matching download url pattern
// Trigger: Packagizer Hook

if (state == "BEFORE") {
    var patt = /.+\/domain\.com\/(foo)\/(bar)(\.zip)/i;
    var name = link.getURL().match(patt);
    if (name) link.setName(name[2] + "_" + name[1] + name[3]);
}

Packagizer rules not suitable for this?
Reply With Quote
 

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 04:34.
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 - 2023, Jelsoft Enterprises Ltd.