Filebot does not start - NSA325v2

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
micldi
Posts: 5
Joined: 10 Feb 2016, 05:37

Filebot does not start - NSA325v2

Post by micldi »

Hi @all,

I’m using Entware-ng on an USB-stick with my zyxel NSA325v2 NAS.

Information about Entware-ng can be found here:
http://www.zyxelforum.de/viewtopic.php?f=311&t=10148

My goal is to use filebot.

I did install java 1.8.0_73 using the file ejdk-8u73-linux-arm-sflt.tar.gz.
ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian 2
http://www.oracle.com/technetwork/java/ ... index.html

I did install the latest jdownloader-2.

I did install the latest filebot-version: filebot_4.6.1_noarch.ipk

Java, Jdownloader and filebot are installed under /opt on my entware-ng usb-stick.
Java & Jdownloader-2 are working well.

Within jdownloader I have installed the plugin “EventScripter”. I did put the following event-script into EventScripter:

Code: Select all

[{"eventTrigger":"ON_ARCHIVE_EXTRACTED",
"enabled":true,
"name":"FileBot",
"script":"var amcFile = \"/opt/share/filebot/jdtofilebot.sh\"; \n var path = archive.getFolder(); callAsync(function() {}, amcFile, path);",
"eventTriggerSettings":{}}]
The content of jdtofilebot.sh is:

Code: Select all

#!/bin/sh
##FileBot needs these variables
LOG="/i-data/path-to-my-logfiles/Log-Files/amc.log" 
EXC="/i-data/ path-to-my-logfiles /Log-Files/amc.txt"
SERIEN="/i-data/path-to-my-series/Series/{n}/Staffel {s}/{n} S{s}E{e}"
FILME="/i-data/path-to-my-videos/Movies/{n} ({y})/{n} ({fn.contains('1080') ? '1080p ':''}{fn.contains('720') ? '720p ':''}{fn.contains('3D') || fn.contains('3-D') ? '3D ':''}HD)"
# ANIME="/i-data/md0/Anime/{n}/{n} E{absolute}"
##Run FileBot
# /ffp/filebot/filebot.sh -script fn:amc --lang de --log-file $LOG --action move "$1" --def "seriesFormat=$SERIEN" "movieFormat=$FILME" "animeFormat=$ANIME" -non-strict --def clean=y --def excludeList=$EXC --def xbmc=10.0.1.5
/bin/sh /opt/share/filebot/bin/filebot.sh -script fn:amc --lang de --log-file $LOG --action move "$1" --def "seriesFormat=$SERIEN" "movieFormat=$FILME" -non-strict --def clean=y --def excludeList=$EXC --def xbmc=10.0.1.5
## Clean empty folders, samples etc after processing
/bin/sh /opt/share/filebot/bin/filebot.sh -script fn:cleaner "$1" --def root=y
Amc.log and amc.txt are empty files.
jdtofilebot.sh and filebot.sh have admin-permissions and are set as executable. Jdownloader runs as admin.

The content of filebot.sh is:

Code: Select all

#!/bin/sh
# make sure required environment variables are set
if [ -z "$USER" ]
then
    export USER=`whoami`
fi
APP_ROOT="/opt/share/filebot"
APP_DATA="$APP_ROOT/data/$USER"
# add APP_ROOT to LD_LIBRARY_PATH
if [ ! -z "$LD_LIBRARY_PATH" ]
then
	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$APP_ROOT"
else
	export LD_LIBRARY_PATH="$APP_ROOT"
fi
# force JVM language and encoding settings
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# FileBot settings
# EXTRACTOR="SevenZipNativeBindings"	# use the lib7-Zip-JBinding.so native library
# EXTRACTOR="SevenZipExecutable"		# use the 7z executable
EXTRACTOR="ApacheVFS"					# use Apache Commons VFS2 with junrar plugin
/opt/java/ejre1.7.0_55/bin/java $JAVA_OPTS -Dunixfs=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dfile.encoding="UTF-8" -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=ipkg -Dnet.filebot.Archive.extractor="$EXTRACTOR" -Dnet.filebot.AcoustID.fpcalc="fpcalc" -Dapplication.dir="$APP_DATA" -Djava.io.tmpdir="$APP_DATA/temp" -Duser.home="$APP_DATA" -jar "$APP_ROOT/FileBot.jar" "$@"
When I ran that setup for the first time, Jdownloader asked me whether it should trigger the event-script above. I confirmed that. So I guess that the event trigger itself works.

However nothing happened to my extracted file/folder in my download-folder (e.g.: the downloaded file was not moved to the according series/season-folder). Amc.log and amc.txt are still empty.

I opened a shell session and tried the following commands:

~ # /opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/bin/java -version
java version "1.8.0_73"
Java(TM) SE Embedded Runtime Environment (build 1.8.0_73-b02, headless)
Java HotSpot(TM) Embedded Client VM (build 25.73-b02, mixed mode)

~ # /opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/bin/java /opt/share/filebot/FileBot.jar
Error: Could not find or load main class .opt.share.filebot.FileBot.jar

So Java itself is fine (I guess, since jdownloader works well with java), however something is wrong with FileBot.

What did I do wrong?
What can I do to fix this?

Thank you for your help.
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot does not start - NSA325v2

Post by rednoah »

What does filebot -script fn:sysinfo say?

@see viewtopic.php?f=4&t=1868
:idea: Please read the FAQ and How to Request Help.
micldi
Posts: 5
Joined: 10 Feb 2016, 05:37

Re: Filebot does not start - NSA325v2

Post by micldi »

thanks for helping rednoah.
I've read the link and will do my best.

here is the outcome you were asking for:

Code: Select all

~ # filebot -script fn:sysinfo
FileBot 4.6.1 (r3315)
JNA Native: 4.0.1
MediaInfo: java.lang.UnsatisfiedLinkError: Unable to load library 'zen': Native library (linux-arm/libzen.so) not found in resource path ([file:/opt/share/filebot/FileBot.jar])
Apache Commons VFS: [zip, ftps, rar, ftp, tar, tgz, tbz2, sftp]
Feb 10, 2016 6:12:21 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Chromaprint: java.io.IOException: Cannot run program "fpcalc": error=2, No such file or directory
Extended Attributes: java.lang.RuntimeException: java.lang.RuntimeException: java.nio.file.FileSystemException: /opt/share/filebot/data/root/.xattr-test: Error writing extended attribute 'net.filebot.metadata': Operation not supported
Groovy Engine: 2.4.5
JRE: Java(TM) SE Embedded Runtime Environment 1.8.0_73 (headless)
JVM: 32-bit Java HotSpot(TM) Embedded Client VM
CPU/MEM: 1 Core / 121 MB Max Memory / 15 MB Used Memory
OS: Linux (arm)
Package: IPKG
Data: /opt/share/filebot/data/root
uname: Linux NSA325v2 2.6.31.8 #2 Tue Jan 26 18:49:28 CST 2016 armv5tel GNU/Linux
Done ヾ(@⌒ー⌒@)ノ

I don't know much about linux & java but my guiss is that I have to install additional software modules. can you read more out of that?
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot does not start - NSA325v2

Post by rednoah »

1.
The logs show that java and filebot are working. The issue lies elsewhere, probably your jd/filebot glue logic script.

Some optional features (mediainfo, chromaprint, etc) are not working but that doesn't matter. Memory is also a little bit on the low side which might make things slow.


2.
This logs shows that someone doesn't know how to use the java command:

Code: Select all

~ # /opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/bin/java /opt/share/filebot/FileBot.jar
Error: Could not find or load main class .opt.share.filebot.FileBot.jar
But you shouldn't even the java command yourself in the first place. You should ALWAYS use the filebot command (i.e. filebot.sh) to start FileBot, and that seems to work fine as we have just confirmed by calling sysinfo.
:idea: Please read the FAQ and How to Request Help.
micldi
Posts: 5
Joined: 10 Feb 2016, 05:37

Re: Filebot does not start - NSA325v2

Post by micldi »

thanks for having a look into it.

I will try some other scripts...the ones I used are from some forums where people confirmed that the scripts are working.

I just installed mediainfo from here:
http://pkg.entware.net/binaries/armv5/Packages.html

do you know a source where I can get library 'zen' for armv5?
I did some search in google and did not find it. I guess I have to compile it. how do I do that? or is it to complicated for a beginner like me? :)
micldi
Posts: 5
Joined: 10 Feb 2016, 05:37

Re: Filebot does not start - NSA325v2

Post by micldi »

hi rednoah,

with that code

Code: Select all

[{"eventTrigger":"ON_ARCHIVE_EXTRACTED",
"enabled":true,
"name":"FileBot",
"script":"var amcFile = \"/opt/share/filebot/jdtofilebot.sh\";var path = archive.getFolder(); callAsync(function() {}, amcFile, path);",
"eventTriggerSettings":{}}]
in the EventScripter of jdownloader I was able to start the script "jdtofilebot.sh".
In order to test that EventScript of JD I used an mkdir-command within "jdtofilebot.sh" and created successfully a folder. So far so good.

As a next step I tried to create a simple script to move a downloaded file. Altough googleling and reading threads in certain forums I was not able to create a working script.

May I ask you kindly to write me a simple script that is triggered by JD with the code above (since the code is working) and that moves the downloaded file to my structured video location?

I will further develop that simple moving-script by my own step by step (using http://www.filebot.net/script.html and viewtopic.php?t=5).
My plan is to implement a renaming of series that fits to my existing structure, to implement an art-workdownloader, and to update my xbmc-instance when a new file was moved to my series-folder.

I just need help with a that first working simple script that moves my downloaded file.

My download path is:
/i-data/bc45a675/data/my-downloads/SeriesFolderCreatedByJD_Package

My path to my series and the series-structure is:
/i-data/bc45a675/data/Series/SeriesName/Season 01/SeriesName.S01E01.SeriesTitle.mkv

My path to my movies is:
/i-data/bc45a675/data/Movies/

It would be great if you could take some time for me.
micldi
Posts: 5
Joined: 10 Feb 2016, 05:37

Re: Filebot does not start - NSA325v2

Post by micldi »

hi @all,

thanks for your help.

my setup of jdownloader & filebot works now. The main problem was, that it the event could not be startet by jdownloader when jdownloader was run as admin.
It worked perfectly when jdownloader was run as root. however I solved that issue as well.


here are my steps for NASes that run entware-ng:

A. install java
isntall java headless ejdk1.8.0_73 and reboot your NAS
download Java from here: http://download.oracle.com/otn/java/ejr ... 014.tar.gz
create /opt/java and copy that fileinto that folder.

Code: Select all

tar xzf /opt/java/ejdk-8u73-linux-arm-sflt.gz
ln -s /opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/ /opt/java/jdk1.9.0
ln -s /opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/ /opt/java/jre
set group and owner as root:

Code: Select all

chown -R root:root /opt/java

first java-test:

Code: Select all

/opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/bin/java -version
result should look like that:
"java version "1.8......."

reboot your NAS


B. install jdownloader
install jdownloader headless as described in many forums / threads.
set group & owner of the jdownloader-folder as admin:

Code: Select all

chown -R 501:501 /opt/jdownloader

create a jdownloader start-up-script so jdownloader runs as admin

Code: Select all

#!/bin/sh
DESC="JDownloader 2 Headless"
NAME=JDownloader2
PIDFILE=/opt/jdownloader/$NAME.pid
USER=admin
RUN_AS=admin
COMMAND="/opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/bin/java -- -jar /opt/jdownloader/JDownloader.jar"

d_start() {
sleep 10
start-stop-daemon --start --quiet --background --pidfile $PIDFILE --user $USER --chuid $RUN_AS --exec $COMMAND
}

d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE
sleep 10
if [ -e $PIDFILE ]
then rm $PIDFILE
fi
}

case $1 in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart)
echo  -n "Restarting $DESC: $NAME"
d_stop
sleep 10
d_start
echo ":"
;;
*)
echo "usage: $NAME [start|stop|restart]"
exit 1
;;
esac
exit
you can put that script in /opt/etc, make it executable and call it by a second executable script named "S93jd2" from /opt/etc/init.d that has the following code:

Code: Select all

#!/bin/sh
/bin/sh /opt/etc/jd2-start.sh start
chandge group and owner to admin [501].

to shut down jdownloader when you turn off your NAS for some reason, create the folders "rc0.d" and "rc6.d" in /opt/etc and create a executable script amed "K93jd2" into those folders that as the following code:

Code: Select all

#!/bin/sh
/bin/sh /opt/etc/jd2-start.sh stop
chandge group and owner of that script to admin [501].


C. install and setup filebot
get filebot_4.6.1_noarch.ipk and copy it to /opt

Code: Select all

cd /opt
opkg install fileboot
you will find the following folder: /opt/share/filebot/data/root
duplicate that folder to /opt/share/filebot/data/admin
change group and owner of that admin-folder to admin and make it executable (the whole admin-folder inclding its content).
this enabled me to run eventscripter & filebot when jdownloader was running as admin.

create a script called jdtofilebot.sh (executable, group: admin, owner: admin) and copy it to /opt/share/filebot with the following content:

Code: Select all

#!/bin/sh
##FileBot needs that:
LOG="/path_to_logfile/amc.log"
EXCLUDE="/path_to_excluderlist/amc.txt"
SERIEN="/path_to_your_series/{n}/Season {s.pad(2)}/{n}.{s00e00}.{t}"
FILME="/path_to_your_movies/{n} ({y})/{n} ({fn.contains('1080') ? '1080p ':''}{fn.contains('720') ? '720p ':''}{fn.contains('3D') || fn.contains('3-D') ? '3D ':''}HD)"
UNSORTIERT="/path_to_your_unsorted_unrecognized_movies/{file.structurePathTail}" ### separate folder for filebot for the case that it cannot recognize a movie / series

##execute filebot
/opt/share/filebot/bin/filebot.sh -script fn:amc --lang de --log-file $LOG --action move "$1" --def "seriesFormat=$SERIEN" "movieFormat=$FILME" "unsortedFormat=$UNSORTIERT" -non-strict --def unsorted=y --def artwork=y --def xbmc=IP_OF_YOUR_XBMC/KODI --def excludeList=$EXCLUDE --def clean=y

## clean everything
/opt/share/filebot/bin/filebot.sh -script fn:cleaner "$1" --def root=y "exts=jpg|nfo|rar|nfo|htm|html|url|txt|etc" "terms=sample|trailer|etc"

go to /opt/share/filebot/bin and change the command-line of filebot.sh in there to:

Code: Select all

/opt/java/ejdk1.8.0_73/linux_arm_sflt/jre/bin/java $JAVA_OPTS -Xmx150m -Dunixfs=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dfile.encoding="UTF-8" -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=ipkg -Dnet.filebot.Archive.extractor="$EXTRACTOR" -Dnet.filebot.AcoustID.fpcalc="fpcalc" -Dapplication.dir="$APP_DATA" -Djava.io.tmpdir="$APP_DATA/temp" -Duser.home="$APP_DATA" -jar "$APP_ROOT/FileBot.jar" "$@"

D. eventscripter in jdownloader
intall eventscripter extension
copy and paste the script from into eventscripter:
pastebin.com/r4BifXzd
I cannot post the eventscripter-code here since the forum removes the escaping of the code.
restart jdownloader.


that's it. I know not all steps are quite the old-fashioned linux style. however that worked for me as a linux-newbie.
Post Reply