Page 1 of 1

if-then-else structure not working

Posted: 29 Jan 2019, 14:02
by vriesnet
I created the following format for Movies:

Code: Select all

Movies/{collection ? {"${collection}/${y}.${n.colon("|")}/${collection.replace(" Collection","")}[${ci}]."} : {"${ny.colon("|")}/"}}{ny.colon("|")}{".${lang}"}
Result when Movie is in Collection:
Movies/Avatar Collection/2009.Avatar/Avatar[1].Avatar (2009).mkv

Expected result when Movie is not in Collection (else-part):
Movies/Avatar (2009)/Avatar (2009).mkv

Actual result when Move is not in Collection:
Movies/Avatar (2009.mkv

Conclusion:
Movies that are part of a collection are processed ok. :)
The expected else-part of the format (when Movie is not part of a collection) is however omitted in the resulting filename. :?:

When I test the format in the Windows application with an optional if-statement "(collection == null)" the result of the else-part is formatted ok (on screen that is).
What am I doing wrong?

Re: if-then-else structure not working

Posted: 29 Jan 2019, 14:16
by rednoah
Here's an example that works for both cases:

Code: Select all

Movies/
{
    any{collection / "$y.$n" / collection.before('Collection') + "[$ci]."}
       {ny + '/'}
}
{plex.name}

Here's an explanation of how and why it works:
viewtopic.php?f=5&t=1895


:idea: collection == null doesn't work because {collection} is never null because instead of returning with a null value, it'll throw an error.

Re: if-then-else structure not working

Posted: 29 Jan 2019, 14:35
by vriesnet
Wow, thanks for your quick response!
Your suggestion works as expected.

Re: if-then-else structure not working

Posted: 08 Dec 2019, 18:25
by Yammers
Hi there i am looking for something similar but i do not want it to name the folder Alien Collection i just want to see Alien, then inside that folder all the alien films.