Page 1 of 1

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

Posted: 24 Jan 2015, 03:57
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?

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

Posted: 24 Jan 2015, 10:33
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)')}

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

Posted: 24 Jan 2015, 10:44
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.

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

Posted: 24 Jan 2015, 11:27
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?

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

Posted: 24 Jan 2015, 11:52
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 ;)

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

Posted: 25 Jan 2015, 14:01
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.