Help needed - {Subt} binding

Support for Windows users
Post Reply
DavidRTurner
Power User
Posts: 85
Joined: 01 Feb 2014, 16:59

Help needed - {Subt} binding

Post 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?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help needed - {Subt} binding

Post 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?
:idea: Please read the FAQ and How to Request Help.
DavidRTurner
Power User
Posts: 85
Joined: 01 Feb 2014, 16:59

Re: Help needed - {Subt} binding

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help needed - {Subt} binding

Post 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
:idea: Please read the FAQ and How to Request Help.
DavidRTurner
Power User
Posts: 85
Joined: 01 Feb 2014, 16:59

Re: Help needed - {Subt} binding

Post 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'?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help needed - {Subt} binding

Post 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
:idea: Please read the FAQ and How to Request Help.
DavidRTurner
Power User
Posts: 85
Joined: 01 Feb 2014, 16:59

Re: Help needed - {Subt} binding

Post by DavidRTurner »

Simple, elegant... thanks very much... AGAIN! :)
Post Reply