Page 1 of 1

Rename to specific genre AND title folder

Posted: 02 Nov 2015, 09:48
by OOmatrixOO
Hi.
Please can anyone help.
I want to do this:
Rename movies like this:

Code: Select all

H:/#Ungesehen/{n.upperInitial().replace(':', ' - ')} ({y}) {genres.take(2)}
BUT if genre family rename to H:/#Kinderfilme/{n.upperInitial().replace(':', ' - ')} ({y}) {genres.take(2)}
AND if Barbie is in name available rename to H:/#Kinderfilme/Barbie Reihe/{n.upperInitial().replace(':', ' - ')} ({y}) {genres.take(2)}
AND if Tinkerbell is in name available rename to H:/#Kinderfilme/Tinkerbell Reihe/{n.upperInitial().replace(':', ' - ')} ({y}) {genres.take(2)}

and so on.

Can i do this in one renaming sheme?
Thank you.

Re: Custom renaming sheme

Posted: 02 Nov 2015, 11:11
by rednoah
1.
Yes, this is a very simple problem and you will find many many format examples here in the forums that will show you how to do exactly that.

2.
Please update your topic title to something more specific so that this thread may be useful to others.

3.
If you come up with a solution, please share it with us.

Re: Custom renaming sheme

Posted: 02 Nov 2015, 18:03
by OOmatrixOO
I spend a lot of time to search for this problem but I've don't found a solution. So I wrote this topic.

Re: Rename to specific genre AND title folder

Posted: 02 Nov 2015, 18:23
by rednoah
Here you go:

Code: Select all

{genres =~ /Family/ && n =~ /Barbie/ ? 'Kids TV/Barbie/' : 'My TV'}
This is case 2. If you want to cover case 1 and case 3 you simply need to extend this expression with additional conditions.

Re: Rename to specific genre AND title folder

Posted: 12 Nov 2015, 15:05
by OOmatrixOO
Oh thank you that looks good.
How cann i include an OR expression? I would like to include 1 and 3 too.

&& = AND
OR = 'i dont know'

thanks for your help and great tool.

Re: Rename to specific genre AND title folder

Posted: 12 Nov 2015, 16:37
by rednoah
Basic operators like && or || are pretty much the same in any programming language:
http://www.groovy-lang.org/operators.html

Re: Rename to specific genre AND title folder

Posted: 14 Nov 2015, 11:17
by OOmatrixOO
Thank you.

I think I've got it right. What do you think? Or you could still improve it?
Thanks for your help.

Code: Select all

{genres =~ /Familie/ && n =~ /Barbie/ ? 'H:/#Kinderfilme/Barbie Reihe/' : genres =~ /Familie/ && n =~ /Tinkerbell/ ? 'H:/#Kinderfilme/Tinkerbell Reihe/' : genres =~ /Familie/ || genres =~ /Animation/? 'H:/#Kinderfilme/' : 'H:/#Ungesehen'}/{n.upperInitial().replace(':', ' - ')} ({y}) {genres}

Re: Rename to specific genre AND title folder

Posted: 14 Nov 2015, 13:46
by rednoah
Well, there's a few things that seem repetitive, so you could make it shorter:

Code: Select all

{genres =~ /Familie|Animation/ ? n =~ /Barbie/ ? 'Kinderfilme/Barbie Reihe' : n =~ /Tinkerbell/ ? 'Kinderfilme/Tinkerbell Reihe' : 'Kinderfilme' : 'Ungesehen'}