Hello, I am writing a bit of automation to rename files.
I was wondering if it is possible to define source as a parameter (using --def) or defining another parameter and checking on that inside the script.
FileBot deals fine with files containing a source in the filename (BD, HDTV, etc) but I'd like to be able to pass this as an argument when the filename does not contain these.
Is this possible ?
Thanks in advance.
Pass Source as a parameter
Re: Pass Source as a parameter
I'm not sure what you wanna do, but there is plenty of ways to pass variables into your format:
You can access environment variables from your format:
You can also build the format string in your Groovy code using your variables:
(assuming you have declared source)
The format actually has access to the cmdline --def variables via {defines} binding:
You can access environment variables from your format:
Code: Select all
{System.env.SOURCE}
Code: Select all
'{n} [' + source + ']'
The format actually has access to the cmdline --def variables via {defines} binding:
Code: Select all
{n} {defines.source}
Re: Pass Source as a parameter
Thanks,
that helped a lot, now I can specify/override source using a def statement on the commandline.
This is about what the format statement looks like now:
that helped a lot, now I can specify/override source using a def statement on the commandline.
This is about what the format statement looks like now:
Code: Select all
{n.ascii().space('.')}.{episode.special ? 's00e'+special.pad(2) : s00e00}.{t.ascii().space('.')}.{defines.source ? defines.source : source}.{vf}.{vc}{video.BitDepth = 10 ? '.Hi10p' : ''}.{ac}{audios.Language.size() > 1 ? (audios.Language.size() > 2 ? '.ML' : '.DL') : ''}{'-'+group}
Re: Pass Source as a parameter
Shorter is better:
== is equals, = is assignment; video.BitDepth will return a String value:
Code: Select all
{defines.source ?: source}
Code: Select all
{video.BitDepth == '10' ? '.Hi10p' : ''}