Search found 9 matches

by madmiddle
15 Jan 2019, 10:20
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

Actually, this might work too, because String.concat() should throw an error when passing in a null argument: {' - '.concat(info.certifications.GB)} This works perfectly thank you: /Volumes/video/ {f =~ /Christmas/ ? 'Christmas' : f =~ /Kids.Movies/ ? 'Kids Movies' : f =~ /Music.Concerts/ ? 'Music ...
by madmiddle
14 Jan 2019, 23:50
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

Up to you. If it’s very related, reuse. If it’s very distinct, new thread. Been tinkering ever since with looking at other peoples code and I am nearly there with the following: /Volumes/video/ {f =~ /Christmas/ ? 'Christmas' : f =~ /Kids.Movies/ ? 'Kids Movies' : f =~ /Music.Concerts/ ? 'Music Con...
by madmiddle
08 Jan 2019, 16:14
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

1. Fixing & Rewriting your format like so makes it more clear what's going on: {n.sortName('$2, $1').colon(' - ').replace('?', '')} ({y}) .{vf}.{any{source}{'NoSource'}}.{vc}.{ac} {if (vf == '720p' && any{source}{null} == 'BluRay' && vc == 'x264' && ac == 'AC3') '-x0r'} ...
by madmiddle
08 Jan 2019, 15:06
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

Here's some information of why your whole {...} expression fails just because {source} is undefined: https://www.filebot.net/forums/viewtopic.php?f=5&t=1895 An easy fix would be doing this, catching all errors and defaulting to null as return value: any{source}{null} e.g. {vf == '720p' &&am...
by madmiddle
08 Jan 2019, 01:52
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

Yes, the ternary operator is quite common in programming languages: http://groovy-lang.org/operators.html#_ternary_operator Groovy used Java / C style && and || for AND and OR: http://groovy-lang.org/operators.html#_logical_operators Checking if 2 string values are equal is indeed == in Gro...
by madmiddle
07 Jan 2019, 18:28
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

You can do that as well of course: {f =~ /Kids.Films/ ? 'Kids Films' : 'Films'} Does the original path contains "Kids Films"? If yes, yield "Kids Films", otherwise yield "Films". You can use that {...} expression in your format wherever you want. e.g. /Volumes/Video/{f...
by madmiddle
07 Jan 2019, 15:07
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

The easiest solution is to just match that keyword from the original file name: {'-'+fn.match(/x0r/)} This will either give you "-x0r" if x0r is in the file name, or nothing. So this will do: {n.sortName('$2, $1').colon(' - ').replace('?', '')} ({y}).{vf}.{source}.{vc}.{ac}{'-'+fn.match(/...
by madmiddle
07 Jan 2019, 01:14
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Re: Combine 2 expressions and execute either one depending on file name ?

I think I have found the answer, I need to use an IF statement. Can you use a IF with an AND condition ? for example IF it has a 1 AND 2 AND 3 in the filename ? I will probably be interested in how to use the OR function as well.
by madmiddle
07 Jan 2019, 00:00
Forum: Episode / Movie Naming Scheme
Topic: Combine 2 expressions and execute either one depending on file name ?
Replies: 15
Views: 6821

Combine 2 expressions and execute either one depending on file name ?

I have used the for many years but only recently started to learnt how powerful it really is. So firstly thank you for all the time you put into it, it's much appreciated. Secondly thank you to the community as they have provided a lot of answers without me having to register. I have not been able t...