AMC Add a new --command -> mkvalidator

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Untoter
Posts: 6
Joined: 20 Jun 2014, 18:56

AMC Add a new --command -> mkvalidator

Post by Untoter »

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

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

Re: AMC Add a new --command -> mkvalidator

Post by rednoah »

Yep, exec is probably what you're looking for.
:idea: Please read the FAQ and How to Request Help.
Untoter
Posts: 6
Joined: 20 Jun 2014, 18:56

Re: AMC Add a new --command -> mkvalidator

Post by Untoter »

how can i pass the path + (renamed)filename to my script?

like

Code: Select all

--exec=/path/to/my/script.sh $1

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




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

Re: AMC Add a new --command -> mkvalidator

Post by rednoah »

Same as the format:

e.g.
echo '{file}'


And don't forget to escape arguments correctly.
:idea: Please read the FAQ and How to Request Help.
Untoter
Posts: 6
Joined: 20 Jun 2014, 18:56

Re: AMC Add a new --command -> mkvalidator

Post by Untoter »

Hey

Even when i Start filebot from commandline? Not from utorrent.
User avatar
rednoah
The Source
Posts: 23942
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Add a new --command -> mkvalidator

Post by rednoah »

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.
:idea: Please read the FAQ and How to Request Help.
Untoter
Posts: 6
Joined: 20 Jun 2014, 18:56

Re: AMC Add a new --command -> mkvalidator

Post by Untoter »

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.
User avatar
rednoah
The Source
Posts: 23942
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Add a new --command -> mkvalidator

Post by rednoah »

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.

Code: Select all

--def "exec=echo '{file}'"
FileBot even shows you the command template you're passing in:

Code: Select all

Parameter: exec = echo '{file}'
Which results in calls like:

Code: Select all

echo '/path/to/file with maybe some spaces'
:idea: Please read the FAQ and How to Request Help.
Untoter
Posts: 6
Joined: 20 Jun 2014, 18:56

Re: AMC Add a new --command -> mkvalidator

Post by Untoter »

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.
Post Reply