Help with If Then Else Syntax

Any questions? Need some help?
Post Reply
Turn5ignal
Posts: 3
Joined: 20 May 2020, 01:05

Help with If Then Else Syntax

Post by Turn5ignal »

Hey guys I'm trying to make a script to rename and move movies and .srt files but I don't fully understand the syntax to achieve this and can't find any good examples on google that breakdown and explain how to do this.

So as an example I would like movies to be placed like this:

Code: Select all

R:Movies\The Matrix (1999)\The Matrix (1999) - 1080p BluRay x264 AAC 2.0.mp4
And Subs like this:

Code: Select all

R:Movies\The Matrix (1999)\Subs\2_eng.srt
My expression is currently:

Code: Select all

R:\Movies\{ny}\{if (ext == 'srt') 'subs\' else '{fn} {ny} - {vf} {vs} {vc} {ac} {channels}'} 
When I try to save this as a preset in Filebot I get this error message

Image
Turn5ignal
Posts: 3
Joined: 20 May 2020, 01:05

Re: Help with If Then Else Syntax

Post by Turn5ignal »

I think this is closer to what I want but I'm still getting a syntax error. Unexpected input: 'else'

Code: Select all

R:/Movies/{ny}/{if (ext == 'srt') 'subs/'}{fn} {else '{ny} - {vf} {vs} {vc} {ac} {channels}'}
kim
Power User
Posts: 1027
Joined: 15 May 2014, 16:17

Re: Help with If Then Else Syntax

Post by kim »

like so ?

Code: Select all

R:/Movies/{ny}/{ext == 'srt' ? 'subs/' + fn : ny + ' - ' + allOf{vf}{vs}{vc}{ac}{channels}.join(' ')}
Turn5ignal
Posts: 3
Joined: 20 May 2020, 01:05

Re: Help with If Then Else Syntax

Post by Turn5ignal »

That is perfect thank you so much
Post Reply