Running FileBot from the console, Groovy scripting, shell scripts, etc
Untoter
Posts: 6 Joined: 20 Jun 2014, 18:56
Post
by Untoter » 20 Jun 2014, 19:01
Hi,
i wish to add a new --command to AMC. in about every 10th episode i have a broken file and this i want to log.
with my Script
Code: Select all
#!/bin/bash
mkvalidator --quiet "$1"
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure
i can verify the mkv. With an edit Avi´s too.
but how can i add this to AMC? is -exec= what iam looking for?
sample output with a broken file
Code: Select all
root@localhost:/tank/media/incoming# mkvverify amovie.mkv
ERR042: The segment's size 9336935136 doesn't match the position where it ends 2043332978
ERR066: The SeekPoint at 87 references an unknown Cues at 9336892310
WRN800: The segment has Clusters but no Cues section (bad for seeking)
WRN0B8: Track #4 is defined but has no frame
WRN0D0: There are 5306 bytes of void data
Failure
rednoah
The Source
Posts: 23942 Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:
Post
by rednoah » 20 Jun 2014, 19:24
Yep, exec is probably what you're looking for.
Untoter
Posts: 6 Joined: 20 Jun 2014, 18:56
Post
by Untoter » 20 Jun 2014, 20:02
how can i pass the path + (renamed)filename to my script?
like
Code: Select all
Working on
ERR003: EBML head not found! Are you sure it's a matroska/webm file?
Failure
with this script
Code: Select all
#!/bin/bash
echo Working on "$1"
mkvalidator --quiet "$1"
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure
if [ $RETVAL -ne 0 ]
then
mv "$1" /tank/media/incoming/failure
fi
rednoah
The Source
Posts: 23942 Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:
Post
by rednoah » 21 Jun 2014, 07:29
Same as the format:
e.g.
echo '{file}'
And don't forget to escape arguments correctly.
Untoter
Posts: 6 Joined: 20 Jun 2014, 18:56
Post
by Untoter » 21 Jun 2014, 07:38
Hey
Even when i Start filebot from commandline? Not from utorrent.
rednoah
The Source
Posts: 23942 Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:
Post
by rednoah » 21 Jun 2014, 08:00
Last statement doesn't make sense to me. Utorrent does call cmdline filebot same as you would.
Think of exec like format. You define an expression that evaluates to a String. In the format it'll be a path. In exec it'll be a cmdline call.
Untoter
Posts: 6 Joined: 20 Jun 2014, 18:56
Post
by Untoter » 13 Jul 2014, 09:10
i tried this
filebot --lang de -script /usr/bin/amc.groovy --output "/tank/media" \
--action move \
-non-strict \
"/tank/media/incoming/Serien" \
--def excludeList=amc.txt \
--conflict auto \
--def extras=y \
--def artwork=y \
--def unsorted=y \
--def xbmc=Ulla,Ulf \
--def clean=y \
--def exec='echo {file}'
and
--def exec=echo '{file}'
this does not work. i dont see the filename anyhwere.
rednoah
The Source
Posts: 23942 Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:
Post
by rednoah » 13 Jul 2014, 09:42
The syntax is
--def name=value where
--def is 1 argument and
name=value is 1 argument. Consequently if value contains spaces you need to quote "name=value" and since {file} may contains spaces it also needs to quoted.
FileBot even shows you the command template you're passing in:
Which results in calls like:
Code: Select all
echo '/path/to/file with maybe some spaces'
Untoter
Posts: 6 Joined: 20 Jun 2014, 18:56
Post
by Untoter » 13 Jul 2014, 09:45
works
thx
Code: Select all
#!/bin/bash
echo Working on "$1"
mkvalidator --quiet "$1"
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure
if [ $RETVAL -ne 0 ]
then
mv "$1" /tank/media/incoming/failure
fi
this plus the commandoption above will add u a mkv validation.