{hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

All your suggestions, requests and ideas for future development
Post Reply
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

{hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by stephen147 »

The {hdr} expression is throwing an error Binding "Video[0][colour_primaries]": undefined.

Checked on 230 test files and 2 of them are receiving this error.

Image

Code: Select all

FileBot 4.8.5 (r6224)
JNA Native: 5.2.2
MediaInfo: 18.12
7-Zip-JBinding: 9.20
Chromaprint: fpcalc version 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2019-04-30 (r563)
Groovy: 2.5.6
JRE: OpenJDK Runtime Environment 11.0.2
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 32 Core / 29 GB Max Memory / 52 MB Used Memory
OS: Windows 10 (amd64)
Package: APPX
License: Microsoft Store License
Done ?(?????)?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by rednoah »

:?: Are these 2 files supposed to be HDR or not?

{hdr} will return HDR for HDR files. It will be undefined for non-HDR files, and display some sort of information message in the format debugger.

You can view raw MediaInfo fields that {hdr} is based on like so:
viewtopic.php?f=5&t=4285
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by stephen147 »

They are not HDR in this case.

Code: Select all

{Video[0].'colour_primaries'}
Retuns:

Code: Select all

Binding "colour_primaries": undefined
which is a similar error for the {hdr} binding.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by rednoah »

Sounds like it's working perfectly fine then. FileBot is just telling your that one of your bindings is not yielding a value, which is perfectly fine if it's not supposed to.

:?: What did you expect to happen when {hdr} is used on non-HDR files?
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by stephen147 »

Well, this code is giving an error Binding "hdr": java.lang.NullPointerException

Code: Select all

{self.hd == 'SD' ? '' : {self.hdr ? self.hdr + bitdepth + 'bit' : 'non-HDR'}}
I want to check if it's not SD then put {hdr} if it exists else use the string non-HDR.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by rednoah »

1.
stephen147 wrote: 08 May 2019, 12:52 I want to check if it's not SD then put {hdr} if it exists else use the string non-HDR.
I'd express this particular logic like so:

Code: Select all

{if (hd =~ 'HD') any{hdr + bitdepth + 'bit'}{'non-HDR'}}

2.
Here's some general documentation you wanna be aware of when dealing with undefined bindings:
viewtopic.php?f=5&t=1895
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by stephen147 »

Thanks once AGAIN!

So with the +~ operater. What is the difference in using != like my example below?

Code: Select all

{if (hd != 'SD') any{'non-HDR'}{hdr + bitdepth + 'bit'}}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by rednoah »

1.
Both work. I just prefer to say "hd must contain HD" (i.e. matches both HD and UHD) rather than "hd must not be SD". Positives are always nicer than negatives. Also, ! has special meaning in bash, so avoid if possible.


2.
any{'non-HDR'}{hdr + bitdepth + 'bit'} is the same as 'non-HDR' because the first closure will always successfully return 'non-HDR' (a valid value non-null non-empty non-error value) so it'll never fail-over to the second one.

This is the same code, just more verbose, which might make it more clear how the if-then-else code path works:

Code: Select all

{
    if (hd =~ 'HD') {
        return any{hdr + bitdepth + 'bit'}{'non-HDR'}
    } else {
       return null
    }
}
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: {hdr} ERROR: Binding "Video[0][colour_primaries]": undefined

Post by stephen147 »

rednoah wrote: 08 May 2019, 13:52 1.
Both work. I just prefer to say "hd must contain HD" (i.e. matches both HD and UHD) rather than "hd must not be SD". Positives are always nicer than negatives. Also, ! has special meaning in bash, so avoid if possible.
I don't mind things not nice sometimes, this doesn't wreak my OCD. Have it not matching SD future proofs it. Who knows what other defs are coming. I suppose 8k is considered UHD so that could be a while before 16K makes an appearance! :lol:
rednoah wrote: 08 May 2019, 13:52 2.
any{'non-HDR'}{hdr + bitdepth + 'bit'} is the same as 'non-HDR' because the first closure will always successfully return 'non-HDR' (a valid value non-null non-empty non-error value) so it'll never fail-over to the second one.

This is the same code, just more verbose, which might make it more clear how the if-then-else code path works:

Code: Select all

{
    if (hd =~ 'HD') {
        return any{hdr + bitdepth + 'bit'}{'non-HDR'}
    } else {
       return null
    }
}
Thanks, this is what I was struggling with before. I can see the syntax now for the if-then-else. Easy when it clicks.

My expression I settled on is:

Code: Select all

{if (hd =~ 'SD') {'non-HDR'} else any{hdr + bitdepth + 'bit'}{'non-HDR'}}
BTW, I've looked and found that the =~ operator is the equals operator only with regex for the if statement.
https://stackoverflow.com/a/12454780/8262102
Post Reply