mediainfo works only with root and problem with spaces

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Thom-
Posts: 3
Joined: 01 Oct 2012, 07:41

mediainfo works only with root and problem with spaces

Post by Thom- »

Hello guys,

I'm using the awesome FileBot on my Synology DS413j NAS (ARM) to rename my tv episodes and move them into their folders.
I installed the Java, FileBot and the Mediainfo package from MissleHugger. I soon noticed, that MediaInfo doesn't work on my ARM processor, so I did compile it by myself with the Eterimos' tutorial (http://filebot.sourceforge.net/forums/v ... &t=98#p886)

Just to be sure I copied all files from /volume1/@appstore/filebot into /usr/share/filebot and copied the new Mediainfo librarys into that folder. I did a chmod 777 on all files, to make sure every user on my synology nas can access it.
I changed the filebot.sh into:

Code: Select all

java -Dunixfs=false -Xmx256m -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -jar /usr/local/filebot/filebot.jar $@
The first problem seems to be related to some permission problem:
I tried the following command:

Code: Select all

/usr/share/filebot/filebot.sh -mediainfo _____.HDTV.Xvid-LOL.avi
With root it was completely successful, I got the information that the file is a Xvid.
With admin - the standard Synology user I got just empty brackets [].

I tried then a test renaming, first with root, then with admin (within the folder where the .avi is located):

Code: Select all

/usr/share/filebot/filebot.sh -rename . --action test -non-strict --format '/volume1/Daten/Serien/{n}/{n.space(".")}.S{s.pad(2)}E{e.pad(2)}.{t.space(".")}{".$source"}{".$vc-$group"}'
With root I got a perfectly named file with title, source, vc and group.
With however admin the source, vc and group was empty.

I have no idea why and how to fix that :\ I'm not a complete linux newbie, but that problem is way beyond my knowledge.

The second problem seems even stranger:
When I try to rename a file with that command (now with root, just to be sure):

Code: Select all

/usr/share/filebot/filebot.sh -rename . --action test -non-strict --format '/volume1/Daten/Serien/Season {s}/{n}/{n.space(".")}.S{s.pad(2)}E{e.pad(2)}.{t.space(".")}{".$source"}{".$vc-$group"}'
Filebot renames that file into /volume1/Daten/Serien/Season.avi
When I remove the space character after "Season", the file will be renamed perfectly fine:

Code: Select all

/usr/share/filebot/filebot.sh -rename . --action test -non-strict --format '/volume1/Daten/Serien/Season{s}/{n}/{n.space(".")}.S{s.pad(2)}E{e.pad(2)}.{t.space(".")}{".$source"}{".$vc-$group"}'
It is really strange - could it be related to synology using the /bin/sh shell? (I think /bin/sh is even just a link to a shell named busybox)

Any idea how to approach that problem?


Ah and a minor one:
Using inline expressions won't work either:

Code: Select all

/usr/share/filebot/filebot.sh -rename . --action test -non-strict --format '/volume1/Daten/Serien/Season {(episode.season ? s: 0)}/{n}/{n.space(".")}.S{s.pad(2)}E{e.pad(2)}.{t.space(".")}{".$source"}{".$vc-$group"}'

And while I'm already asking for so much help:
Any idea how to tell filebot to just look for shows I'm really watching? Something like a whitelist?
For example "Battlestar Galactica" or "Eureka". I want filebot to just look for the new ones (Battlestar Galactica (2003) and "Eureka", not "Eureka!") - but sometimes it uses the wrong one.

Anyways, I wanted to thank you for that awesome program, which is everything I've been looking for. I hope I can make it work on my Synology as well :D

Greetings
-Thomas
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

1. I thought we already had a pre-compiled libmediainfo.so? If you install filebot via the *-arm.ipkg it should be packaged. The Synology package is provided by a cool guy by the name of MissileHugger, that .so for ARM is not packaged, also nobody ever managed to compile libmediainfo for ATOM...

2. I have no clue what kinda fucked up shit is going on if a native lib works as root but not as user. FileBot doesn't care about the mediainfo executables, it'll directly link to the .so native lib. I have no idea what could go wrong with that in terms of user permissions. This is a wierd one...

Maybe Java can't load native code at all? You could run filebot -script fn:sysinfo to check if it can at least load mediainfo or not.

3. The one with the broken --format argument, I suppose the shell doesn't pass the arguments to filebot properly for some reason... best guess is that your shell doesn't deal well with double-quotes inside of single quotes.

In Windows CMD it's the same but you can work around that with \". That'll probably work on your shell too:

Code: Select all

E:\test\The Daily Show>filebot -rename . --action test -non-strict --format "/volume1/Daten/Serien/Season{s}/{n}/{n.space(\".\")}.S{s.pad(2)}E{e.pad(2)}.{t.space(\".\")}{\"$source\"}{\"$vc-$group\"}"
Filename pattern: [1,00] SxE, [0,00] CWS
Rename episodes using [TheTVDB]
Auto-detected query: [The Daily Show]
Fetching episode data for [The Daily Show: Global Edition]
Fetching episode data for [The Daily Show with Jon Stewart]
Fetching episode data for [The Daily Show Nederlandse Editie]
[TEST] Rename [E:\output\The Daily Show\The Daily Show - S01E03 - James Doohan.avi] to [\volume1\Daten\Serien\Season1\The Daily Show with Jon Stewart\The.Daily.Show.with.Jon.Stewart.S01E03.James.Doohan.avi]
EDIT: I guess your shell doesn't do single-quote cause it works when there is no space, but with space the first part becomes the --format parameter and the second become just another input data argument.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

4. You have full control over what episode data FileBot includes into the matching via the --filter argument.

Check this thread for more info:
http://filebot.sourceforge.net/forums/v ... lter#p1946

Those examples are the basic usage of the --filter argument. But it'll except any Groovy code so you can write your own logic to make it check against a white/blacklist text file. The idea is kinda the same what i'm doing here in Option 4 => http://filebot.sourceforge.net/forums/v ... =182#p1277
:idea: Please read the FAQ and How to Request Help.
Thom-
Posts: 3
Joined: 01 Oct 2012, 07:41

Re: mediainfo works only with root and problem with spaces

Post by Thom- »

Wow, thank you for your fast reply.

1-2.) I didn't know that. I just installed MissleHuggers packages and it didn't work. Now I removed those packages and installed filebot from the filebot-3.0.ARM package. Filebot was now installed in /usr/share/filebot with a filebot.sh file in /usr/share/filebot/bin/filebot.sh
After that I tried filebot -mediainfo with the root account. I got the libzen not found message with that package. Then I copied my compiled libs into /usr/share/filebot and now it works - even as root and admin.

With filebot -script fn:sysinfo I'm getting these informations as admin:

Code: Select all

/volume1/Daten/SerienTemp/Season 02 $ filebot -script fn:sysinfo
Oct 01, 2012 6:18:44 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: Couldn't create user preferences directory. User preferences are unusable.
Oct 01, 2012 6:18:44 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: java.io.IOException: No such file or directory
FileBot 3.0 (r1207)
MediaInfo: MediaInfoLib - v0.7.60
7-Zip-JBinding: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: Failed to load 7z-JBinding: no 7-Zip-JBinding in java.library.path
Java(TM) SE Embedded Runtime Environment 1.7.0_06 (headless)
32-bit Java HotSpot(TM) Embedded Client VM
Linux (arm)
Done ?(?????)?
3.) You're right it had something to do with the shell, thank you for that tip. Synology is using busybox as shell, which leads to these problems.
I tried your command with escaped quotes and it kinda worked. I got the filename as wished, but the {".$source"} command should avoid creating a dot when source is not filled. With your escaped quotes it didn't work - i still got the dot before $source.
To get better results I had to create a file named myfilebot.sh which will calls the filebot

Code: Select all

#!/opt/bin/bash
filebot -rename . --action test -non-strict --format '/volume1/Daten/Serien/Season {(episode.season ? s: 0)}/{n}/{n.space(".")}.S{s.pad(2)}E{e.pad(2)}.{t.space(".")}{".$source"}{".$vc-$group"}'
This got rid of all my problems. I think I could change my shell to bash, but as I only wanted to use filebot for automatic renaming (maybe with a cron) it doesn't matter for me.

I'm still getting funny results as the "admin", because it seems that a normal useraccount (even if its named admin) can't write into it's home directory with synology:

Code: Select all

/volume1/Daten/SerienTemp/Season 02 $ ./test.sh
Oct 01, 2012 6:14:37 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: Couldn't create user preferences directory. User preferences are unusable.
Oct 01, 2012 6:14:37 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: java.io.IOException: No such file or directory
Filename pattern: [1.00] SxE, [0.00] CWS
Rename episodes using [TheTVDB]
Auto-detected query: [Chuck]
Fetching episode data for [Chuck]
Fetching episode data for [Chuck Finn]
Fetching episode data for [Chuck Norris: Karate Kommandos]
Fetching episode data for [Chuck Woolery: Naturally Stoned]
Oct 01, 2012 6:15:08 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock User prefs.  Unix error code 2.
Oct 01, 2012 6:15:08 PM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
Auto-detected query: [Chuck]
Fetching episode data for [Chuck]
Fetching episode data for [Chuck Finn]
Fetching episode data for [Chuck Norris: Karate Kommandos]
Fetching episode data for [Chuck Woolery: Naturally Stoned]
[TEST] Rename [/volume1/Daten/SerienTemp/Season 02/Chuck.S01E01.Chuck.Versus.the.Intersect.DVDSCR.XviD-SAiNTS.avi] to [/volume1/Daten/Serien/Season 1/Chuck/Chuck.S01E01.Chuck.Versus.the.Intersect.DVDSCR.XviD-SAiNTS.avi]
[TEST] Rename [/volume1/Daten/SerienTemp/Season 02/Chuck.S01E01.Chuck.Versus.the.Intersect.DVDSCR.XviD-SAiNTS.srt] to [/volume1/Daten/Serien/Season 1/Chuck/Chuck.S01E01.Chuck.Versus.the.Intersect.DVDSCR.XviD-SAiNTS.srt]
Processed 2 files
Done ?(?????)?
I had more errors until I changed filebot.sh to use a specific chmod 777 home path instead of $HOME. I don't know that much about the system - I'm afraid of changing the home directory :D
So, for now it works for me - somehow. I wanted to thank you a lot for your help, filebot is just an awesome piece of software :)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

So the native libs in the ipk don't work? Is there anyway you could check why that is? Is there different kinds of incompatible ARM architectures meaning everyone has to compile it themselves??
:idea: Please read the FAQ and How to Request Help.
Thom-
Posts: 3
Joined: 01 Oct 2012, 07:41

Re: mediainfo works only with root and problem with spaces

Post by Thom- »

It's strange, but I tried it again with the libs of the arm ipkg package (i copied them to tmp before I moved mine) and it worked now. So probably a false alarm, or it is somehow related to caching of libs or something like that.
Everything works fine now, I renamed 1.1TB of TV Shows with almost no problems. It did have some troubles with Dr. Who (the whole first season was put in many different folders of different shows) and Spartacus (it didn't find vengeance) - well and The King of Queens with its strange episode counting (S02E01 -> Episode 26).
Some minor feature request would be naming of combined episodes (Weeds S08E12-13 is being renamed by filebot into S08E12)

But besides that it did a wonderful job and saved me a lot of time - Thank you again for this wonderful program
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

Weeds S08E12-13 formats to Weeds - 8x12 & 8x13 - It's Time alright with default formatting. Your format is probably not taking double episodes into account.
:idea: Please read the FAQ and How to Request Help.
melonboy
Posts: 19
Joined: 15 Apr 2012, 16:28

Re: mediainfo works only with root and problem with spaces

Post by melonboy »

Hello,

With this post referencing the post of Eterimos, it's getting very confusing as to what has worked and what has not, and more importantly the steps. :-)

I've removed both my Mediainfo and Filebot packages from Misslehugger and have installed filebot_3.0_arm.ipk, and now have a directory called filebot in /usr/share and libmediainfo.so and lizen.so are there as well as the .jar file. In the bin directory I have filbot.sh.

Frankly I don't know what to do next or if I should have done something before, so if someone could steer me in the right direction i would appreciate it.

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

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

Well, you install it and then you can use it, what do you want? What's not working? The ipk should put the filebot command into the path. If you're lucky MediaInfo will work out of the box.
:idea: Please read the FAQ and How to Request Help.
melonboy
Posts: 19
Joined: 15 Apr 2012, 16:28

Re: mediainfo works only with root and problem with spaces

Post by melonboy »

Hey, just asking!

So I asked a friend to check and there was a illegal character that had somehow been added in the .sh, so he removed that and changed the path on first line to '#!/opt/bin/bash' and now I can run the filebot command as it's in the path. Great!

I saw the command you mentioned above, 'filebot -script fn:sysinfo', it loads Mediainfo without any errors so very great!

As Thom says above "filebot is just an awesome piece of software" and thanks very much for your help. I made a donation last week and I encourage anyone that hasn't, to do so.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

haha, no worries, i meant that literally, i mean didn't quite understand the problem. :D

So the filebot.sh packaged in the .ipk doesn't work out of the box? Very odd, I'll have a look.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

Can you try and see if it works if you change it to /bin/sh?

filebot.sh containing:

Code: Select all

#!/bin/sh
java -Dapplication.deployment=ipkg -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -jar /usr/share/filebot/FileBot.jar "$@"
Just relying on /bin/sh might be more universal.
:idea: Please read the FAQ and How to Request Help.
melonboy
Posts: 19
Joined: 15 Apr 2012, 16:28

Re: mediainfo works only with root and problem with spaces

Post by melonboy »

Works fine!

Now to spend the weekend looking at your scripts and what suits me best.

Thanks again.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

Alright, fixed that. Set it to use /bin/sh and made sure there's only unix line-endings. Should work out of the box with next release.
:idea: Please read the FAQ and How to Request Help.
melonboy
Posts: 19
Joined: 15 Apr 2012, 16:28

Re: mediainfo works only with root and problem with spaces

Post by melonboy »

Great, that will make a lot of people happy, I am sure.

Even though I'm logged on as root I'm getting the same error as Thom above. Everything else seems fine though sloooooow, down to the NAS I imagine.

Code: Select all

WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

There's more info on this here:
http://www.allaboutbalance.com/articles/disableprefs/

Make sure all the paths like java.io.tmpdir and application.dir are writable. java.util.prefs.userRoot and java.util.prefs.systemRoot must be set to a writable path as well.
:idea: Please read the FAQ and How to Request Help.
melonboy
Posts: 19
Joined: 15 Apr 2012, 16:28

Re: mediainfo works only with root and problem with spaces

Post by melonboy »

Aha! I saw that and was going to post the url but forgot :-)

I'll ask a friend to check it out with me. Thanks.
melonboy
Posts: 19
Joined: 15 Apr 2012, 16:28

Re: mediainfo works only with root and problem with spaces

Post by melonboy »

Can you see the reason why the Filename pattern is not working in my second example? I'm stumped!

Code: Select all

filebot -rename "/volume1/downloads/temp"-non-strict --format "{n.space(
'_')}_-_{sxe}_[{resolution}_{vc}_{ac}][{crc32}]"
Filename pattern: [NaN] SxE, [NaN] CWS
Rename episodes using [TheTVDB]
Exception: No media files: [/volume1/downloads/temp-non-strict]
Failure (?_?)

Code: Select all

 filebot -rename "/volume1/downloads/test" -non-strcit --format "{n.space('_')}_-_{sx
e}_[{resolution}_{vc}_{ac}][{crc32}]"
Filename pattern: [1.00] SxE, [0.00] CWS
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: mediainfo works only with root and problem with spaces

Post by rednoah »

1. You're missing a space so the cmdline arguments get passed in all wrong

2. Looks good to me, except the rest of the log is missing.
:idea: Please read the FAQ and How to Request Help.
Post Reply