Conditional Structures (if-then-else)

All about user-defined episode / movie format expressions
nomadicleo
Posts: 2
Joined: 27 Jun 2020, 14:52

Re: Conditional Structures (if-then-else)

Post by nomadicleo » 27 Jun 2020, 15:33

Thank you, @rednoah!! Worked perfectly.

aryanprincesanty
Posts: 2
Joined: 24 Mar 2020, 05:32

Re: Conditional Structures (if-then-else)

Post by aryanprincesanty » 28 Jun 2020, 18:09

FileBot might not find all the groups for the TV shows I have. How do I make a format such that when {group} exists - it should be added, if not - it should be blank.

My current format is:

Code: Select all

{ny}/Season 0{s}/{ny} - {s00e00} - {t} [{vf} {source} {vc} {if (bitdepth == 10) '10-bit'} {ac} {channels} {if (group != null) {group} else ""}]

What changes should I apply to have my files look like this:
no group:

Code: Select all

Brooklyn Nine-Nine - S02E01 - Undercover [480p x264 8-bit AAC 2.0]
xyz group:

Code: Select all

Brooklyn Nine-Nine - S02E02 - Chocolate Milk [480p x264 8-bit AAC 2.0 XYZ]

User avatar
rednoah
The Source
Posts: 18537
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Conditional Structures (if-then-else)

Post by rednoah » 29 Jun 2020, 03:45

aryanprincesanty wrote:
28 Jun 2020, 18:09
How do I make a format such that when {group} exists - it should be added, if not - it should be blank.
That is default. You're probably asking about the preceding blank though, so that you don't end up with a superfluous blank if {group} is undefined.

e.g.

Code: Select all

{" " + group}

Code: Select all

{" " + ac}{" " + channels}{" " + group}
:arrow: viewtopic.php?t=1895



Note the conceptual similarity to previously asked questions:
rednoah wrote:
27 Jun 2020, 15:10
nomadicleo wrote:
27 Jun 2020, 14:57
When it does not find a certification, it simply appends the hyphen at the end of the name but I would like it to only add the hyphen when there is a certification found.
e.g.

Code: Select all

{" - " + certification}
:arrow: viewtopic.php?t=1895
:idea: Please read the FAQ and How to Request Help.

kim
Power User
Posts: 982
Joined: 15 May 2014, 16:17

Re: Conditional Structures (if-then-else)

Post by kim » 29 Jun 2020, 15:33

Code: Select all

{ny}{'/Season ' + s.pad(2)}{'/' + ny}{' - ' + s00e00}{' - ' + t}{allOf{vf}{source}{vc}{bitdepth == 10 ? ' 10-bit' : ''}{ac}{channels}{group}.joining(' ', ' [', ']')}

Post Reply