JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #161  
Old 20.08.2017, 12:15
Luke M Luke M is offline
JD Alpha
 
Join Date: May 2012
Posts: 23
Default

I'm trying to make a simple Packagizer Hook to replace "_" with " ":

Code:
if (link.getHost() == "myhost.com") {
	link.setName(link.name.replace(/_/g, " "))
}
getHost returns "http links", not the host name, so the compare always fails. The links are being added by the crawler, if that matters. What am I doing wrong?
Reply With Quote
  #162  
Old 20.08.2017, 13:08
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 15,099
Default

link gethost isn't the domain of the site, its the plugin names entry
hence 'http links' as its supported by directhttp plugin
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #163  
Old 20.08.2017, 13:44
Luke M Luke M is offline
JD Alpha
 
Join Date: May 2012
Posts: 23
Default

Quote:
Originally Posted by raztoki View Post
link gethost isn't the domain of the site, its the plugin names entry
hence 'http links' as its supported by directhttp plugin
How do you get the download URL?
Reply With Quote
  #164  
Old 20.08.2017, 14:32
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 15,099
Default

you can either use the package customiser and remove the chars with simple filename rule
contains *_* replace with $1$2

or you can use eventscripter, my guess would be myDownloadLink.getUrl()

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

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #165  
Old 20.08.2017, 15:37
Luke M Luke M is offline
JD Alpha
 
Join Date: May 2012
Posts: 23
Default

This seems to work: (note: getURL not getUrl)

Code:
// Packagizer Hook to replace "_" with " "

if (/.*myhost\.com.*/.test(link.getURL())) {
	link.setName(link.name.replace(/_/g, " "))
}

Last edited by Luke M; 20.08.2017 at 15:41.
Reply With Quote
  #166  
Old 20.08.2017, 16:09
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 15,099
Default

good stuff

Have fun with your filename renamer ;]
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
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 11:54.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.