[HELP] model function not working in Format

All about user-defined episode / movie format expressions
Post Reply
Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

[HELP] model function not working in Format

Post by Romtromon » 16 Feb 2018, 18:04

Sometime last year I created a topic similar to this which ended with rednoah saying that it was an issue that was fixed in a new release. I have now updated to v4.7.15 but the problem still persists with this section of my format:

Code: Select all

({model.collect{ [it.source, it.vc, it.ac] }.transpose()*.minus(null)*.unique()*.join('-').join(' ')})
It gives out the error:

Code: Select all

Binding "model": java.lang.NullPointerException
I've been stuck on this for more than half a year now and I'd really appreciate some help regarding the matter! Thanks in advance!

User avatar
rednoah
The Source
Posts: 16585
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] model function not working in Format

Post by rednoah » 16 Feb 2018, 20:22

What's your test case? What have you tried?

Looks good as far as I can tell:

Code: Select all

$ filebot -rename *.mkv --action test -non-strict --format "{model.collect{ [it.source, it.vc, it.ac] }.transpose()*.minus(null)*.unique()*.join('-').join(' ')}"
Rename episodes using [AniDB]
Auto-detected query: [Suzuka]
Fetching episode data for [Suzuka]
[TEST] from [[Exiled-Destiny]_Suzuka_涼風_Ep26_(E25802AC).mkv] to [x264 AC3.mkv]
Processed 1 files
:idea: Please read the FAQ and How to Request Help.

Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

Re: [HELP] model function not working in Format

Post by Romtromon » 17 Feb 2018, 02:53

I tried a bunch of different anime. I tried checking the MediaInfo bindings and got this error:

Code: Select all

Unable to load amd64 (64-bit) native library MediaInfo.dll: Could not initialize class net.filebot.mediainfo.MediaInfoLibrary
The other thing that I noticed is that my version of JRE is 9.0.4 which is the latest. And when I tried to run filebot.launcher.exe, it says that JRE 1.8.0 is required, however I've been running it from the .jar file until now.

User avatar
rednoah
The Source
Posts: 16585
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] model function not working in Format

Post by rednoah » 17 Feb 2018, 03:53

I see. MediaInfo is not working and so none of the MediaInfo bindings work. See FAQ for details.
:idea: Please read the FAQ and How to Request Help.

Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

Re: [HELP] model function not working in Format

Post by Romtromon » 17 Feb 2018, 13:34

Both my JRE and Filebot installations are in 64-bit so I don't see what could be the issue here... Also, the mediainfo binding doesn't explain the NullPointerException I'm getting in the format does it?

User avatar
rednoah
The Source
Posts: 16585
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] model function not working in Format

Post by rednoah » 17 Feb 2018, 14:10

If you double-click the jar, then FileBot is executed without any additional startup options, so it doesn't really work, even though it might kinda work.

In this case, the jna.library.path property is not set, and maybe some other required properties, and so FileBot won't be able to load native libraries. If libmediainfo can't be loaded, then MediaInfo values are unavailable / null and that results in a NullPointerException somewhere down the line.

TL;DR FileBot won't work correctly unless it's started via the filebot.exe launcher which in turn only works on Java 8 due to a bug in launch4j.
:idea: Please read the FAQ and How to Request Help.

Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

Re: [HELP] model function not working in Format

Post by Romtromon » 18 Feb 2018, 06:33

So in short, I should switch to Java 8. Thanks, I'll try that and get back to you.

Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

Re: [HELP] model function not working in Format

Post by Romtromon » 19 Feb 2018, 00:56

So I uninstalled Java 9 and downgraded to Java 8 and ran Filebot using the .exe file, and I still get the same error when I try to check the MediaInfo bindings. And also the NullPointerException from the model function.

User avatar
rednoah
The Source
Posts: 16585
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] model function not working in Format

Post by rednoah » 19 Feb 2018, 02:51

Can you run a few test cases to narrow down the problem? Does it work with one specific file? Does it not work with one specific file? What is the MediaInfo for all the different files? Is there anything odd about them that would explain why it works for me and not for you? A sample of a file that doesn't work for you would be good so I can confirm the issue on my machine.
:idea: Please read the FAQ and How to Request Help.

Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

Re: [HELP] model function not working in Format

Post by Romtromon » 19 Feb 2018, 03:08

Okay so it seems the problem is definitely with just MediaInfo, I tried using the model function with other tags that are not MediaInfo tags and the format works, despite the Edit Format window still giving the NullPointerException.

The MediaInfo issue seems to be with all files that I try, although my Java and Filebot are both 64-bit, I even tried replacing the MediaInfo.dll in the Filebot installation folder with the one in my MediaInfo installation; that didn't work either.

So I don't think there's anything peculiar about my files that's causing this, something seems to be up with MediaInfo. Are there any specific tests you'd like me to conduct? Do you want a screenshot of the MediaInfo for one of my files? I could also link you to a torrent of one of the anime that I was trying to rename if you think that would help although I doubt it's anything to do with my files.

User avatar
rednoah
The Source
Posts: 16585
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] model function not working in Format

Post by rednoah » 19 Feb 2018, 03:21

Try this as a format to see the MediaInfo values of all the values you're trying to access via the {model} binding:

Code: Select all

{source} {vc} {ac}
If you use this format, then you should be able to see an odd one. The {model} by nature requires that it works for all matches, so a single bad one might break the format for all of them.

Test your format on a single file. Then another single file. If it works for both, try it on both of them and see if the {model} binding works. Then you can expand to more files step by step to see when it stops working, and that way you'll be able to narrow down which files / match breaks things.


1.
Confirm that MediaInfo works for each file:

Code: Select all

$ filebot -rename *.mkv --db TheTVDB -non-strict --action TEST --log INFO  --format "{vc} {ac}"
[TEST] from [Alias 1x01.mkv] to [x264 AC3.mkv]
[TEST] from [Alias 1x02.mkv] to [x264 AAC.mkv]
2.
Confirm that {model} works with MediaInfo for the select files:

Code: Select all

$ filebot -rename *.mkv --db TheTVDB -non-strict --action TEST --log INFO  --format "{model.vc} {model.ac}"
[TEST] from [Alias 1x01.mkv] to [[x264, x264] [AC3, AAC].mkv]
[TEST] from [Alias 1x02.mkv] to [[x264, x264] [AC3, AAC].mkv]
3.
Confirm that your {model} snippet works:

Code: Select all

$ filebot -rename *.mkv --db TheTVDB -non-strict --action TEST --log INFO  --format "{model.collect{ [it.source, it.vc, it.ac] }.transpose()*.minus(null)*.unique()*.join('-').join(' ')}"
[TEST] from [Alias 1x01.mkv] to [x264 AC3-AAC.mkv]
[TEST] from [Alias 1x02.mkv] to [x264 AC3-AAC.mkv]

:idea: I suggest using a separate folder for testing so you can move test files around and easily try different individual things that you can confirm to work or not work instead of doing everything at once and then not knowing why it doesn't work. ;)
:idea: Please read the FAQ and How to Request Help.

Romtromon
Posts: 25
Joined: 16 Sep 2016, 09:51

Re: [HELP] model function not working in Format

Post by Romtromon » 19 Feb 2018, 09:19

For this:

Code: Select all

{source} {vc} {ac}
I got errors for all the fields (source is not an issue as I believe the group Reaktor is not in your list) but the vc and ac gave this error:

Code: Select all

Could not initialize class net.filebot.mediainfo.MediaInfoLibrary
1.
As proven from the test above, MediaInfo doesn't work for any file.

2.
Due to test 1 failing, this also fails.

3.
This one passes as long as I don't use MediaInfo bindings in the model, so something like this works (even though it.source isn't defined):

Code: Select all

{model.collect{ [it.source, n, t] }.transpose()*.minus(null)*.unique()*.join('-').join(' ')}
but this doesn't (even though "n", and "t" are defined):

Code: Select all

{model.collect{ [it.source, it.vc, it.ac, n, t] }.transpose()*.minus(null)*.unique()*.join('-').join(' ')}

Oh I didn't really use a test folder since I used the GUI and I can see the results on that without having to commit the changes, is there any way that the command line would yield a different output? Although I think it's safe to say that MediaInfo is the culprit...

User avatar
rednoah
The Source
Posts: 16585
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] model function not working in Format

Post by rednoah » 19 Feb 2018, 18:23

If you purchase FileBot from the Store then it'll just work. Making MediaInfo work is explained in the FAQ and countless threads here in the forums. With the legacy installer, it'll usually it'll just work, but I don't know why it doesn't in your case. You'll figure it out.

The tests to check things step by step can be done in the GUI or the CLI. The CLI just makes it easier to copy & paste text rather than screenshots.
:idea: Please read the FAQ and How to Request Help.

Post Reply