{vbr} not working in CLI but working in GUI

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Kelsig
Posts: 5
Joined: 16 Jul 2022, 11:07

{vbr} not working in CLI but working in GUI

Post by Kelsig »

CLI sys-info: https://snipboard.io/5LvkAr.jpg

So I reorganized my file naming scheme to specify approximate video quality in title using the following script

Code: Select all

{
    if (((vbr > 30e6) && (hd==/UHD/)) || ((vbr > 10e6) && (hd==/HD/))) 
        'Movies Remux' 
    else
        {vc =~ /HEVC|265/ ? 'Movies H.265' : 'Movies H.264'}
}
{'/!!! HARD-LINKED'}/{plex[1]}{'/'}
{ny}{allOf
	{tags.join(', ')}
	{vs =~ /BluRay/ ? null : vs}
	{allOf
		{vf}
		{hdr.replace('Dolby Vision', 'DV')}
		{vc.replace('AVC','x264').replace('HEVC','x265')}
		{vbr.replace(' Mbps', 'mbps')}               <-------------- problem code
		.joining(' ', '', '')}
	{audio.title =~ /(?i)Commentary/ ? 'Commentary' : null}
	{group}
	.joining('] [', ' [', ']')}
{if (f.subtitle) {subt}}
And it is working just fine in the GUI

Image

Yet for whatever reason, in the CLI, with the same code in the .groovy file, it's just skipping past the line specified.

Image

Code: Select all

{vbr.replace(' Mbps', 'mbps')}
Really stumped on this.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {vbr} not working in CLI but working in GUI

Post by rednoah »

vbr is not a String type object, so String.replace() won't work.


:arrow: You can do String.replace() but you need to convert the vbr object to a String value first:

Code: Select all

vbr.toString().replace(' Mbps', 'mbps')


EDIT:

Newer revisions add AutoScaleInteger.replace(a, b) that simply does toString().replace(a, b) internally. The format engine always works the same for both GUI and CLI, but you might be using different FileBot versions if you really do get different results.
:idea: Please read the FAQ and How to Request Help.
Kelsig
Posts: 5
Joined: 16 Jul 2022, 11:07

Re: {vbr} not working in CLI but working in GUI

Post by Kelsig »

rednoah wrote: 02 Oct 2022, 14:45 vbr is not a String type object, so String.replace() won't work.


:arrow: You can do String.replace() but you need to convert the vbr object to a String value first:

Code: Select all

vbr.toString().replace(' Mbps', 'mbps')


EDIT:

Newer revisions add AutoScaleInteger.replace(a, b) that simply does toString().replace(a, b) internally. The format engine always works the same for both GUI and CLI, but you might be using different FileBot versions if you really do get different results.
Thank you, that fixed it. And now that you mention it I think my ubuntu/CLI version is not updated but GUI is.
Kelsig
Posts: 5
Joined: 16 Jul 2022, 11:07

Re: {vbr} not working in CLI but working in GUI

Post by Kelsig »

So I realized some file's mediainfo doesn't have video stream bitrate for whatever reason, and I have added overall bitrate fallback logic, but is there a way to alternatively derive video stream bitrate when not specified in mediainfo?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {vbr} not working in CLI but working in GUI

Post by rednoah »

Does MediaInfo give you the size of the video stream? If yes, then divide by video duration. If no, then out of luck.
viewtopic.php?t=4285
:idea: Please read the FAQ and How to Request Help.
Post Reply