MediaInfo symbolic links

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

MediaInfo symbolic links

Post by isujinx »

I just updated my Synology DSM, filebot and MediaInfo - and when I did a sysinfo (and everything was working) i noticed that the MediaInfo version Synology is reporting isn't the same as the one installed from the Package Center. So I thought I could just symbolically link to the files where the MediaInfo Package installs them, and thus have filebot looking at the most up to date version of MediaInfo. I must have missed something - and I don't think I can change my LD_LIBRARY path, because then it would break the 7ZIP, which still has the actual file there. Sysinfo output below.

Code: Select all

RackStation> filebot -script fn:sysinfo
FileBot 4.5.6 (r2818)
JNA Native: 4.0.0
MediaInfo: java.lang.UnsatisfiedLinkError: Unable to load library 'mediainfo': Native library (linux-x86/libmediainfo.so) not found in resource path ([file:/volume1/@appstore/filebot/FileBot.j          ar])
7-Zip-JBinding: OK
chromaprint-tools: fpcalc version 1.1.0 (/volume1/@appstore/filebot/fpcalc)
Extended Attributes: OK
Groovy Engine: 2.3.9
JRE: Java(TM) SE Embedded Runtime Environment 1.8.0_33 (headless)
JVM: 32-bit Java HotSpot(TM) Embedded Server VM
CPU/MEM: 4 Core / 419 MB Max Memory / 30 MB Used Memory
OS: Linux (i386)
uname: Linux RackStation 3.2.40 #5022 SMP Wed Jan 7 14:19:03 CST 2015 x86_64 GNU/Linux synology_bromolow_rs3412xs
Done ヾ(@⌒ー⌒@)ノ
On a related, but less important note, is it possible to use the built in FileStation extractor https://global.download.synology.com/ft ... _Guide.pdf , instead of using 7zip? Or is it just not powerful enough? I would think that by using FileStation extraction, and linking directly to MediaInfo's package location, you could make it much easier to install the additional libraries.
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

1.
Are you sure the MediaInfo package actually provides the libmediainfo.so and isn't just a statically compiled binary?

2.
A PATH may consist of multiple folder paths, try echo $PATH for example.

3.
filebot uses lib7-Zip-JBinding.so which is most definitely not included by default or any package you might have installed.

4.
That doesn't make sense at all. Using the 7z and mediainfo binaries directly and then parsing output might be nice, and could work on all platforms. Though, using native libs is a much better solution and since it works on all primarily platforms there's little reason to rewrite everything.
:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

1. Yes, I'm sure it includes the files. After installing the mediainfo package, it points to "/volume1/@appstore/mediainfo/lib" and there are the following files inside :
libmediainfo.so (symbolic link to libmediainfo.so.0.0.0)
libmediainfo.so.0 (symbolic link to libmediainfo.so.0.0.0)
libmediainfo.so.0.0.0 (actual file)

and then the same type of structure for
libz.so
libz.so.1
libz.so.1.2.8

and

libzen.so
libzen.so.0
libzen.so.0.0.0

2. I'm confused as to why having the actual files in the filebot folder (when it was working) and replacing those with symbolic links makes a difference in the resource PATH. Isn't that the point of symbolic links - so you can reference files in other locations? Does it matter who is logged in when you echo $PATH?

3. I know lib7-zip-jbinding.so isnt included, my question was if you could use the already installed extraction protocols from FileStation, rather than have to install the 7zip jbinding separately. Apparently the answer is no (thats fine, it was just a question for improving ease of installation). It just seems easier to have package dependencies, rather than additional installations. That way people can update package dependencies easily from the Package Center when it notifies them, and will always have the most up to date version - without having to know to go looking for an update.

Appreciate your help! As always, super prompt.

EDIT: After looking a little more, even adding the MediaInfo directory (/volume1/@appstore/mediainfo/lib) to the LD_LIBRARY_PATH, it still doesn't find it. From the sysinfo, it is looking for it in a subfolder (linux-x86) - do i need to create that folder in the filebot folder?
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

1.
That actually looks like it could work. Which package/source are you using?

EDIT: DONE

2.
Yes, $PATH is different per profile. There'll be some /etc/profile which applies to all users and then some more in ~/.profile per user and if you're using bash there's also .bash_rc and all those might be sourced before you get to start typing your commands.

I'm not sure what you're talking about regarding symbolic links. Linking filebot into /usr/bin? Because /usr/bin is always in the $PATH regardless of anything.

3.
The API you referred to is what the DSM WebUI uses. There's absolutely no point in using that. Just calling the 7z executable is reasonable though.

Ignore the error message. Low level error messages don't make sense. When it's saying "can't find one" it might as well mean "can't find one that works".
:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

1. Awesome! Will that be available in the next version of filebot? Do you need me to test it for you? Both filebot and MediaInfo are of the current versions on the Package Center. I'm running a Rackstation 3412XS.

2. If the symbolic link thing gets changed from item 1, this is a moot point. It was in reference as to why item 1 wasnt working.

3. Maybe I'm misinterpreting what the 7zip jbinding does... Does is just provide the compression/extraction utility for un-rar-ing torrents? If that is all it is needed for, I don't understand why the built in DSM UI extraction utility couldn't be used (the autoextract from downloadstation uses it i believe), rather than having to install 7zip jbinding. I wont ask about it again if it can't work, since I havent written any real code since 2003, and it was all under windows based compilers.
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

1.
It's just a matter of adding a few lines filebot.sh so you can check the latest changes in svn and copy & paste from there.

2.
It's just 7zip and some JNI bindings compiled into one native lib. It's all of 7z native code plus Java API. 7z could be used instead, though it only makes sense for platforms where the native libraries aren't easily available, but parsing output is dirty and the native libs work perfectly well on Windows/Linux/Mac. It's only gotten tricky now that there's like a billion almost-the-same but binary incompatible embedded platforms.

3.
Why would FileBot send an extract request to DSM via http requests if it's already running on the same machine? DSM will internally do a 7z syscall. FileBot might as well call 7z directly, and that would work on all platforms. Not just Synology NAS. The current solution is best even though it doesn't work on exotic devices. You'll probably only gonna extract files that are stupid to be compressed in the first place. It's not an issue if you find a proper source that doesn't user these horrible multi-volume rar archives.
:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

Cool, thanks for the explanation! Looking forward to when that update is posted, and I'll integrate it.
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

I manually put the changes into my filebot.sh.

Do they need to be updated in the sysinfo script as well? Still errors out as unable to load Mediainfo.

SysInfo:

Code: Select all

RackStation> filebot -script fn:sysinfo
FileBot 4.5.6 (r2818)
JNA Native: 4.0.0
MediaInfo: java.lang.UnsatisfiedLinkError: Unable to load library 'mediainfo': Native library (linux-x86/libmediainfo.so) not found in resource path ([file:/volume1/@appstore/filebot/FileBot.jar])
7-Zip-JBinding: OK
chromaprint-tools: fpcalc version 1.1.0 (/volume1/@appstore/filebot/fpcalc)
Extended Attributes: OK
Groovy Engine: 2.3.9
JRE: Java(TM) SE Embedded Runtime Environment 1.8.0_33 (headless)
JVM: 32-bit Java HotSpot(TM) Embedded Server VM
CPU/MEM: 4 Core / 419 MB Max Memory / 18 MB Used Memory
OS: Linux (i386)
uname: Linux RackStation 3.2.40 #5022 SMP Wed Jan 7 14:19:03 CST 2015 x86_64 GNU/Linux synology_bromolow_rs3412xs
Done ヾ(@⌒ー⌒@)ノ
SysEnv:

Code: Select all

RackStation> filebot -script fn:sysenv
# Environment Variables #
MAIL: /var/mail/root
CLASSPATH: .:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib
TZ: US/Central
LOGNAME: root
LD_LIBRARY_PATH: /volume1/@appstore/filebot:/var/packages/mediainfo/target/lib
LC_ALL: en_US.UTF-8
TERMINFO: /usr/share/terminfo
HOME: /root
SSH_CONNECTION: 10.0.1.100 65419 10.0.1.3 22
PATH: /sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/bin
SSH_TTY: /dev/pts/1
SSH_CLIENT: 10.0.1.100 65419 22
PAGER: more
XFILESEARCHPATH: /usr/dt/app-defaults/%L/Dt
SHELL: /bin/ash
PGDATA: /var/services/pgsql
TERM: xterm
NLSPATH: /usr/dt/lib/nls/msg/%L/%N.cat
OLDPWD: /root
LANG: en_US.UTF-8
PWD: /root
JAVA_HOME: /volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre
USER: root


# Java System Properties #
path.separator: :
java.vm.name: Java HotSpot(TM) Embedded Server VM
java.io.tmpdir: /volume1/@appstore/filebot/data/temp
user.country: US
user.home: /volume1/@appstore/filebot/data
net.filebot.util.prefs.file: /volume1/@appstore/filebot/data/prefs.properties
useExtendedFileAttributes: true
java.vm.vendor: Oracle Corporation
java.util.prefs.PreferencesFactory: net.filebot.util.prefs.FilePreferencesFactory
user.language: en
java.vendor: Oracle Corporation
java.vendor.url.bug: http://bugreport.sun.com/bugreport/
swing.crossplatformlaf: javax.swing.plaf.nimbus.NimbusLookAndFeel
sun.net.client.defaultReadTimeout: 60000
java.specification.name: Java Platform API Specification
jna.nosys: true
os.name: Linux
java.runtime.name: Java(TM) SE Embedded Runtime Environment
application.deployment: spk
file.separator: /
sun.net.client.defaultConnectTimeout: 10000
java.vm.specification.version: 1.8
sun.boot.class.path: /volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/resources.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/rt.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/sunrsasign.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/jsse.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/jce.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/charsets.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/jfr.jar:/volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/classes
java.version: 1.8.0_33
http.agent: FileBot 4.5.6
java.library.path: /volume1/@appstore/filebot:/var/packages/mediainfo/target/lib:/usr/java/packages/lib/i386:/lib:/usr/lib
unixfs: false
awt.toolkit: sun.awt.HToolkit
java.vm.specification.name: Java Virtual Machine Specification
os.version: 3.2.40
useCreationDate: false
file.encoding: UTF-8
java.awt.printerjob: sun.print.PSPrinterJob
grape.root: /volume1/@appstore/filebot/data/grape
java.class.version: 52.0
java.ext.dirs: /volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/ext:/usr/java/packages/lib/ext
java.specification.version: 1.8
net.filebot.AcoustID.fpcalc: /volume1/@appstore/filebot/fpcalc
java.vendor.url: http://java.oracle.com/
ehcache.disk.store.dir: /volume1/@appstore/filebot/data/cache/0
sun.os.patch.level: unknown
sun.java.launcher: SUN_STANDARD
os.arch: i386
user.dir: /root
line.separator:

user.timezone: US/Central
sun.cpu.endian: little
java.vm.specification.vendor: Oracle Corporation
java.home: /volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre
java.net.useSystemProxies: true
sun.management.compiler: HotSpot Server Compiler
sun.arch.data.model: 32
java.endorsed.dirs: /volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/endorsed
file.encoding.pkg: sun.io
java.specification.vendor: Oracle Corporation
sun.boot.library.path: /volume1/@appstore/java8/ejdk1.8.0_33/linux_i586/jre/lib/i386
sun.jnu.encoding: UTF-8
java.runtime.version: 1.8.0_33-b05
java.vm.info: mixed mode
java.vm.version: 25.33-b05
sun.io.unicode.encoding: UnicodeLittle
java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment
application.dir: /volume1/@appstore/filebot/data
java.awt.headless: true
java.class.path: /volume1/@appstore/filebot/FileBot.jar
sun.java.command: /volume1/@appstore/filebot/FileBot.jar -script fn:sysenv
sun.cpu.isalist:
user.name: root


# Arguments #
args[0] = -script
args[1] = fn:sysenv


Done ヾ(@⌒ー⌒@)ノ
RackStation>
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

It looks like you have copied stuff into /volume1/@appstore/filebot so if you've put a library there it'll take precedence. I've done some tests and it works fine on my DS213J (armada370) at the very least.
:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

You were correct, I had the symlinks in volume1/@appstore/filebot for mediainfo, but even after removing the symlinks sysinfo still cant find mediainfo.

(i still have fpcalc and 7zip jbinding there, just not mediainfo.) Any thoughts?

EDIT: I just moved the $APP_ROOT to the end of the exports in the filebot.sh, so it wouldn't take priority - but that had no effect.
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

btw is fpcalc working for you?

Have you tried installing this package:
http://pcloadletter.co.uk/2012/09/17/bl ... -synology/

And then having a look if that includes the fpcalc binary? That might be an easy way to fpcalc working easily. My DS213J isn't supported though.
:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

fpcalc is installed correctly according to the sysinfo. I don't call it in any scripts, so I'm not sure if it is all working. I also haven't loaded music yet - but i suppose i could try some this weekend.

So, Bliss installed properly, but won't start package service - most likely because it says it requires Java 6 or 7 SE Embedded (also from pcloadletter) - and I only have Java 8 installed, per filebot requirements. Looking at the Package Center install log, it says an instance is already running - perhaps it is looking at my fpcalc?

I'm transferring a crapton of movies via WinSCP now, so my Synology is pretty slow. After that's done I'll dig into it a bit more and see if i can find out some more details. Maybe we can figure out a way to have all the dependencies be package installs!

Any reason you can think of that the update didn't work for my mediainfo install? I've restarted everything, and it still isnt finding it - keeps looking in that linux-x86 folder - which doesn't exist in any PATH variable I can find, nor do I have a folder named that on my Synology. *stumped*

EDIT: From the Bliss website "com.elsten.bliss.policy.tag.auto.linux.amd64-1.0.0.jar – contains fpcalc." So, when properly installed, it contains a .jar that has the fpcalc within it. Source: http://pcloadletter.co.uk/2012/09/17/bl ... nt-page-1/

There is also an linux.x86 jar file, but it isn't nearly as big. Located in "volume1/@appstore/Bliss/bliss-bundle"
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

1.
Ignore any and all low-level error messages. They're utterly misleading.

This tells you no more than "it doesn't work" and contains absolutely no hints as to why:

Code: Select all

java.lang.UnsatisfiedLinkError: Unable to load library 'mediainfo': Native library (linux-x86/libmediainfo.so) not found in resource path ([file:/volume1/@appstore/filebot/FileBot.jar])
2.
If you've installed Bliss you should find the fpcalc* executable somewhere, regardless of Bliss actually working and/or running. You can unpack the jar (it's a zip file) and extract the executable from there. Though at this point it's really not an elegant solution, and seems unmaintained since 2013.

3.
The best solution would be a dedicated fpcalc package maintained by SynoCommunity. Maybe somethings is happening. Feel free to add an extra bounty.
:arrow: https://github.com/SynoCommunity/spksrc/issues/902
:idea: Please read the FAQ and How to Request Help.
isujinx
Posts: 13
Joined: 24 Sep 2014, 19:17

Re: MediaInfo symbolic links

Post by isujinx »

Developers are commenting as of Feb this year, so it seems to be somewhat maintained, perhaps not via the official repositories. Regardless, I think the dedicated package would be a much more elegant solution. Is there one for the 7zip jbinding?
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

No, that would be much more difficult. Cross-compiling JNI native libraries is much more tricky than pure C/C++ native code, and that's already pretty tricky. On the upside, I've already implemented extract via 7z executable in the latest revision.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22980
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MediaInfo symbolic links

Post by rednoah »

New package is ready for testing:
http://sourceforge.net/projects/filebot ... ebot/HEAD/

Code: Select all

filebot -script dev:sysinfo
FileBot 4.5.7 (r2867)
...
MediaInfo: MediaInfoLib - v0.7.72
p7zip: Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
...
The 7z command-line utility should work out-of-the-box since it's shipped with Synology DSM. The MediaInfo library should work after installing the MediaInfo package, if you're lucky.
:idea: Please read the FAQ and How to Request Help.
Post Reply