How do I tag 10bit files?
How do I tag 10bit files?
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 )
How has this to be done for integers here?
Thanks
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 )
How has this to be done for integers here?
Thanks
Re: Problem with integers in format expression
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
e.g. you can do the same check with the ==~ regex match operator but that just adds unnecessary complexity in this case:
EDIT:
As for using String methods on non-String objects, here's how that'd work:
* 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:
As for using String methods on non-String objects, here's how that'd work:
Code: Select all
{ bitdepth.toString().concat('bit') }
Please read the FAQ and How to Request Help.
Re: How do I tag 10bit files?
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!
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!
Re: How do I tag 10bit files?
It does not work if my code is like this
Does work in this case
I'm not sure what was wrong.
Code: Select all
{ ' '+bitdepth == 10 ? '10bit' : null }
Code: Select all
{ bitdepth == 10 ? '10bit' : null }
Re: How do I tag 10bit files?
e.g.
Note that equals doesn't work between String / Integer types, i.e. Integer 10 == 10 and String "10" == "10" is true, but "10" == 10 is not.
Code: Select all
{ bitdepth == 10 ? ' 10bit' : null }
Note that equals doesn't work between String / Integer types, i.e. Integer 10 == 10 and String "10" == "10" is true, but "10" == 10 is not.
Please read the FAQ and How to Request Help.
Re: How do I tag 10bit files?
I'm just wondering why can't I add
in front of the {bitdepth} binding as this works for other bindings.
If I remove that, the binding works normally.
I want filebot to add a space in case of null.
Code: Select all
' '+
If I remove that, the binding works normally.
I want filebot to add a space in case of null.
Re: How do I tag 10bit files?
' ' + 10 same as ' 10'
'10' (String) == 10 (Integer) = not the same
try this:
'10' (String) == 10 (Integer) = not the same
try this:
Code: Select all
{' '+ (bitdepth == 10 ? '10bit' : '')}
Re: How do I tag 10bit files?
e.g.
Code: Select all
{ bitdepth == 10 ? ' 10bit' : ' ' }
Note that FileBot will replace \s+ (any sequence of space-like characters) with a single standard space character regardless of custom format. So if you want multiple spaces in a row in your custom file names, then you're probably out of luck on that particular front.
Please read the FAQ and How to Request Help.