JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 28.03.2020, 01:54
fakeswetal2 fakeswetal2 is offline
Modem User
 
Join Date: Dec 2017
Posts: 3
Default Packagizer Search and Replace

Is there a way to set up the the packagizer to rename a file by searching for a string within a file name and then replacing only that portion with your desired text?

For example:

product.image.1.outside.jpg
product.image.1.inside.jpg
product.image.1.side-view.jpg
product.image.1.front.jpg
product.image.1.rear.jpg

where I want the "image.1" portion to be replaced with "image-1" to produce these results:

product.image-1.outside.jpg
product.image-1.inside.jpg
product.image-1.side-view.jpg
product.image-1.front.jpg
product.image-1.rear.jpg

Does this make sense? Is this possible?
Reply With Quote
  #2  
Old 28.03.2020, 02:51
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,976
Default

sure, if the incoming filename has predictable pattern, you use regex to match and then make your alterations.

raztoki
__________________
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 28.03.2020, 03:22
fakeswetal2 fakeswetal2 is offline
Modem User
 
Join Date: Dec 2017
Posts: 3
Default

Ok so I figured the matching regex would be something like this:

.*image\.1.*

and the replace would be:

image-1

but I'm not quite sure which field I would implement it on to preserve all of the rest of the filename since the rest of the filenames are dynamic and can vary wildly.
Reply With Quote
  #4  
Old 28.03.2020, 03:57
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,976
Default

use (.*?)\.(\d+.*)
then use the filename dynamic tag 1 and (from right click context)
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]

Last edited by raztoki; 28.03.2020 at 05:04.
Reply With Quote
  #5  
Old 28.03.2020, 22:44
fakeswetal2 fakeswetal2 is offline
Modem User
 
Join Date: Dec 2017
Posts: 3
Default

I just want to start by saying thanks for helping out. I've been trying to solve this for a while and I just can't seem to wrap my head around how it's supposed to work. I'm amateur level at Regex but I can get the gist for the most part. What I don't understand, is how to do the replace function of this and then combine it with the dynamic tag. Also how to combine that snippet you wrote with my example?

Under the match portion I have the regex that I listed under the "File name" condition. Then under set in the "File name" condition I pasted that code you send and right clicked to add the dynamic tag and it looks like this:

(.*?)\.(\d+.*)<jd:orgfilename:1>

I tried to run that but it doesn't seem to work. I'm fairly certain there is something rather obvious that I am missing or unaware of.
Reply With Quote
  #6  
Old 29.03.2020, 07:05
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,976
Default

regex its for fiename (check the regex checkbox)
dynamic tags are for the and then field. I assume you are doing that part incorrectly
__________________
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 08:17.
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.