Can you run Multiple Replaces on the same part of the name?

All about user-defined episode / movie format expressions
Post Reply
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Can you run Multiple Replaces on the same part of the name?

Post by DevXen »

So I have several filename that has "Blueray" in it. instead of BDRip, as i'd prefer. So i would like to .replace('blueray','bdrip') in the script. that way when it gets to the part later that looks for bdrip, it'll convert it to (BDRip) and add that to the renamed, file. I had tried but was not able to get that to work. is that even possible, since it would be doing 2 things to the same object in the filename?
User avatar
rednoah
The Source
Posts: 19011
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can you run Multiple Replaces on the same part of the na

Post by rednoah »

You mean like this?

Code: Select all

{fn =~ /(?i)(BlueRay|BDRip)/ ? '(BDRip)' : ''}
Or something like this?

Code: Select all

{'test blueray'.replace('blueray','bdrip').replace('bdrip' , '(BDRip)')}
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Re: Can you run Multiple Replaces on the same part of the na

Post by DevXen »

Yes, almost Exactly like that, I wonder why I couldn't get that to work. i'll work on it as well. thank you.
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Re: Can you run Multiple Replaces on the same part of the na

Post by DevXen »

So. Part of the issue i've found, is BrRip is in the file or foldername. i've used: .replaceAll('BrRip','BDRip'). but then after that i use $source and it's still pulling up BrRip. i've also tried:
$source.replaceAll('BrRip','BDRip') ... but that hasn't worked. is there a way to remap parts of the $source tag? .. preferably to an external csv file. so I could easily fix more such problems as I find them?
User avatar
rednoah
The Source
Posts: 19011
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can you run Multiple Replaces on the same part of the na

Post by rednoah »

Sure, should go along the lines of something I posted recently:

Code: Select all

{csv('mysource.csv').get(source)}
A simple Map lookup should do it ;)
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 132
Joined: 12 Oct 2014, 21:15

Re: Can you run Multiple Replaces on the same part of the na

Post by DevXen »

Thank you, I got it to work with:
{" ["+any{(csv('C:/FileBot Settings/Movie/MovieSources.csv').get(source))}{(source)}{'Unknown Source'}+"]"}

then it'll tell me when there is no source available. yey.
Post Reply