Page 1 of 1

Help needed - {Subt} binding

Posted: 28 May 2016, 00:26
by DavidRTurner
Red, I'm stuck again...

The {subt} binding is coming back as UNDEFINED.
I have not tried it before, so it's not 'broken now' as I don't know if it would have worked for me before.

My Filebot program files are dated 4/20/16, which the current installation creates.
The JAR file is the current one I downloaded today.
I've un- and re- installed everything.

Still, no {subt} binding.

Any ideas?

Re: Help needed - {Subt} binding

Posted: 28 May 2016, 04:49
by rednoah
If {subt} doesn't work, then probably neither does {lang}.

Keep in mind:
* {subt} will only be defined for subtitle files
* {subt} will work better if files are named correctly, e.g. name.eng.srt
* {subt} uses statistical language detection as a last resort, it's not 100% and it won't work for empty test files or non-text files

What are the filenames? Do you have a link for that specific subtitle file?

Re: Help needed - {Subt} binding

Posted: 28 May 2016, 11:32
by DavidRTurner
Hmmm... nope, I wasn't looking at external files; I assumed it would identify embedded subs.
That's what I'd like to do now - add a format to flag files with subs in them - as I convert a large library, I'm adding embedded subs, but would like to identify if they already exist.

I'm not expecting to identify commentaries vs. regular subs, but that would also be nice.
If it's not part of FB or the API, then no worries...
If this is possible, then what I'd like to do:
- count the number of embedded sub streams.
- bring back the NAME of the streams (I'm naming them 'Main Audio' and 'Commentary', for example) if a name exists (older files have no description for the sub stream).

Thanks.

Re: Help needed - {Subt} binding

Posted: 28 May 2016, 11:39
by rednoah
1.
{subt} is what allows you to do things like:

Code: Select all

movie.avi
movie.eng.srt
movie.ger.srt

2.
You'll want to look into the {text} binding. Use the integrated Binding/MediaInfo inspector to see what kind of information you can extract from the file contents.
- count the number of embedded sub streams.

Code: Select all

{text.size()}
Image

Re: Help needed - {Subt} binding

Posted: 28 May 2016, 17:16
by DavidRTurner
Great, thanks - {text} is the start I need...

After some trials, I seem to be unable to return a 'zero' value, if there are no subtitles (embedded).

What I'd like to do is add code like this:

Code: Select all

{audio.size+' Audio &'} {text.size+' Subs'}
but I've had to whittle it down to this:

Code: Select all

{audio.size+' Audio &'} {if(text.size != null) text.size else '0'}{' Subs'}
as I get a null pointer exception by simply using {text.size} where there are no subs.
Problem is, I wind up with "1 Audio & 1 Subs" for valid subtitled files, and "1 Audio & Subs" instead of "1 Audio & 0 Subs" as I'd like.

I've tested a number of null pointer catches via various Groovy code sites, without luck.
I'm wondering if it's in fact, 'null' as opposed to 'invalid'.

Any thoughts on how I can identify >= 1 sub, and replace all other values (zero, null, invalid...) with a 'zero'?

Re: Help needed - {Subt} binding

Posted: 29 May 2016, 05:19
by rednoah
Use any(Closure...) like this:

Code: Select all

{any{audio.size}{0}} Audio & {any{text.size}{0}} Subs
@see viewtopic.php?f=5&t=1895

Re: Help needed - {Subt} binding

Posted: 29 May 2016, 12:45
by DavidRTurner
Simple, elegant... thanks very much... AGAIN! :)