Rename to specific genre AND title folder

All about user-defined episode / movie / file name format expressions
Post Reply
OOmatrixOO
Posts: 10
Joined: 29 Jun 2014, 09:01

Rename to specific genre AND title folder

Post 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.
Last edited by OOmatrixOO on 02 Nov 2015, 18:04, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Custom renaming sheme

Post 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.
:idea: Please read the FAQ and How to Request Help.
OOmatrixOO
Posts: 10
Joined: 29 Jun 2014, 09:01

Re: Custom renaming sheme

Post 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.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename to specific genre AND title folder

Post 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.
:idea: Please read the FAQ and How to Request Help.
OOmatrixOO
Posts: 10
Joined: 29 Jun 2014, 09:01

Re: Rename to specific genre AND title folder

Post 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.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename to specific genre AND title folder

Post by rednoah »

Basic operators like && or || are pretty much the same in any programming language:
http://www.groovy-lang.org/operators.html
:idea: Please read the FAQ and How to Request Help.
OOmatrixOO
Posts: 10
Joined: 29 Jun 2014, 09:01

Re: Rename to specific genre AND title folder

Post 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}
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename to specific genre AND title folder

Post 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'}
:idea: Please read the FAQ and How to Request Help.
Post Reply