How do I tag 10bit files?

All about user-defined episode / movie format expressions
Post Reply
chase29
Posts: 4
Joined: 18 Sep 2021, 10:46

How do I tag 10bit files?

Post by chase29 »

Hi,

I have the following problem with integers in the format expressions and replacing them with normal regex.
I was told that for all integers object.toString is implemented by default, as I was asking if I could use the supplied string methods.

But I do not get the following to work :
If bitdepth = 10 replace it with 10bit. all my other regexes I use on strings work, I tried everything here from '10' to /10/ etc., I simply get no replacement for it, it is just cut out of the filename at all, if I use it without the replace it just prints 10 in the filename (as expected :D)

How has this to be done for integers here?

Thanks
User avatar
rednoah
The Source
Posts: 20151
Joined: 16 Nov 2011, 08:59

Re: Problem with integers in format expression

Post by rednoah »

Presumably, you mean to tag 10bit files:
* add 10bit for 10bit files
* don't add anything for non-10bit files


e.g. check if bitdepth is 10

Code: Select all

{ bitdepth == 10 ? ' [10bit]' : '' }

e.g. you can do the same check with the ==~ regex match operator but that just adds unnecessary complexity in this case:

Code: Select all

{ bitdepth ==~ /10/ ? ' [10bit]' : '' }


EDIT:

:idea: As for using String methods on non-String objects, here's how that'd work:

Code: Select all

{ bitdepth.toString().concat('bit') }
:idea: Please read the FAQ and How to Request Help.
chase29
Posts: 4
Joined: 18 Sep 2021, 10:46

Re: How do I tag 10bit files?

Post by chase29 »

Argh, I sat way too long in front of the PC already, I simply misplaced the toString method.
Because I need a replace, if not 10bit I don't want it at all.

Works like a charm, and of course your first solution is most elegant and easy LOL

Thanks!
Post Reply