Vuze Command runner - Executes but nothing happens

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
grobinson
Posts: 7
Joined: 09 Dec 2012, 00:04

Vuze Command runner - Executes but nothing happens

Post by grobinson »

I have filebot installed on a Ubuntu 12.10 box and I've been trying to get Vuze to kick off filebot after a download.

It appears to be running the right commands but nothing is happening. Vuze reports that it's executed just fine and the command in the logs works if I run it by hand in the shell. I've even added some echo's into the filebot.sh script to make sure it's actually getting called and that the command in the Vuze log is accurate. Everything looks fine.

The command I have in Vuze:
filebot.sh -script fn:utorrent-postprocess --output "/plexMedia" --action copy --conflict override -non-strict --def artwork=y "ut_dir=/vuze" "ut_file=American.Horror.Story.S01E05.HDTV.XviD-ASAP.avi" "ut_kind=single" "ut_title=American.Horror.Story.S01E05.HDTV.XviD-ASAP.avi" "ut_label=Uncatergorised" "ut_state=%S"

The command as I see it from the file bot script after adding (echo $@ >> /usr/share/filebot/bin/foo.txt)
--action copy --conflict override -non-strict --def artwork=n ut_dir=/vuze ut_file=American.Horror.Story.S01E05.HDTV.XviD-ASAP.avi ut_kind=single ut_title=American.Horror.Story.S01E05.HDTV.XviD-ASAP.avi ut_label=Uncatergorised ut_state=%S

When I run the command by hand everything gets copied over fine and I've verified that the command I see in the Vuze logs is actually being passed into filebot.sh so I'm completely sumped as to why nothing is happening.

Oh and I've also added a line to the filebot.sh script to check the user and it's running as root so it's not a permission issue.
User avatar
grobinson
Posts: 7
Joined: 09 Dec 2012, 00:04

Re: Vuze Command runner - Executes but nothing happens

Post by grobinson »

I just redirected the output from the java execution and got some interesting results:

Parameter: plex = 127.0.0.1
Parameter: ut_dir = /media/jukebox/BigDrive/Vuze
Argument: /home/jukebox/Downloads
Argument: /home/jukebox/"ut_file=American.Horror.Story.S01E06.HDTV.XviD-ASAP.[VTV].avi"
Argument: /home/jukebox/"ut_kind=single"
Argument: /home/jukebox/"ut_title=American.Horror.Story.S01E06.HDTV.XviD-ASAP.[VTV].avi"
Argument: /home/jukebox/"ut_label=Uncategorised"
Argument: /home/jukebox/"ut_state=%S"
Read archive [xmwebui_0.2.12.zip] to [/home/jukebox/Downloads/xmwebui_0.2.12]
Notify Plex: 127.0.0.1
MissingPropertyException: No such property: myepisodes for class: Script3
groovy.lang.MissingPropertyException: No such property: myepisodes for class: Script3
at Script3.run(Script3.groovy:196)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (°_°)

I get this same exception when I run the command right from the shell but it doesn't prevent filebot from doing it's job. I'd like to resolve this and see if it's the cause but it's not clear to me what the problem is.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Vuze Command runner - Executes but nothing happens

Post by rednoah »

You didn't escape your cmdline arguments correctly. Check your other post for how it should look like. You'd only have "Argument: ..." lines if you were running it standalone without the ut_* parameters.

EDIT:
If you run the command above it should start with this:

Code: Select all

Parameter: artwork = y
Parameter: ut_dir = /vuze
Parameter: ut_file = American.Horror.Story.S01E05.HDTV.XviD-ASAP.avi
Parameter: ut_kind = single
Parameter: ut_title = American.Horror.Story.S01E05.HDTV.XviD-ASAP.avi
Parameter: ut_label = Uncatergorised
Parameter: ut_state = %S
Notice that everything is passed in as "Parameter" (--def name=value syntax) and not as "Argument" (list of files).

For some reason the "..." are passed in as part of the value which is kinda wierd.
:idea: Please read the FAQ and How to Request Help.
User avatar
grobinson
Posts: 7
Joined: 09 Dec 2012, 00:04

Re: Vuze Command runner - Executes but nothing happens

Post by grobinson »

Adding --def before all the params has helped:

/usr/share/filebot/bin/filebot.sh -script fn:utorrent-postprocess --def plex=127.0.0.1 --output "/plexMedia" --action copy --conflict override -non-strict --def ut_dir="%D" --def ut_file="%F" --def ut_kind="%K" --def ut_title="%N" --def ut_label="%L" --def ut_state="%S"

Which ends up looking like this for a given download based on a echo of $@ just before the java call in filebot.sh :

-script fn:utorrent-postprocess --def plex=127.0.0.1 --output "/plexMedia" --action copy --conflict override -non-strict --def ut_dir="/media/jukebox/BigDrive/Vuze Downloads" --def ut_file="The_Onion_Book_Of_Known_Knowledge[V006034107].mp4" --def ut_kind="single" --def ut_title="The Onion Book Of Known Knowledge" --def ut_label="Uncategorised" --def ut_state="%S"

the ut_dir and ut_title values look like they're escaped correctly to me but Filebot is only ingesting the first word with the rest showing as args below?

Parameter: plex = 127.0.0.1
Parameter: ut_dir = "/media/jukebox/BigDrive/Vuze
Parameter: ut_file = "The_Onion_Book_Of_Known_Knowledge[V006034107].mp4"
Parameter: ut_kind = "single"
Parameter: ut_title = "The
Parameter: ut_label = "Uncategorised"
Parameter: ut_state = "%S"
Argument: /home/jukebox/Downloads"
Argument: /home/jukebox/Onion
Argument: /home/jukebox/Book
Argument: /home/jukebox/Of
Argument: /home/jukebox/Known
Argument: /home/jukebox/Knowledge"

Notify Plex: 127.0.0.1
Done ヾ(@⌒ー⌒@)ノ

Apologies if I'm asking obvious questions here. I do really appreciate the help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Vuze Command runner - Executes but nothing happens

Post by rednoah »

I can see how many --def might look like you're getting closer but you're not. The main issue is that the values filebot gets begin and end with " so for some reason the " may get escaped twice or you're doing something else wrong.

Wrong (quote is part of the value):
Parameter: plex = "single"

Correct:
Parameter: ut_kind = single

Probably wrong:
--def ut_kind="single"

Definitely correct (like in my examples):
--def "ut_kind=single"

Example from my utorrent log:

Code: Select all

filebot -script fn:utorrent-postprocess --output "E:" --action test -non-strict --def "ut_dir=E:\Storage" "ut_file=[CCS-Speed] _One_Piece_576_[720p]  [77BF46F3].mkv" "ut_kind=single" "ut_title=[CCS-Speed] _One_Piece_576_[720p]  [77BF46F3].mkv" "ut_label=" "ut_state=5"
:idea: Please read the FAQ and How to Request Help.
User avatar
grobinson
Posts: 7
Joined: 09 Dec 2012, 00:04

Re: Vuze Command runner - Executes but nothing happens

Post by grobinson »

The command runner plugin for Vuze running on Linux seems to have a problem with the quotes. I've decided to use commas as a delimiter in the command and changed the filebot.sh script to parse the command this way. It's working fine now.

Filebot script:

#!/usr/bin/python

import sys
import subprocess

args = ' '.join(sys.argv[1:]).split(',')

filebot = "java -Dunixfs=false -DuseExtendedFileAttributes=true -Dapplication.deployment=deb -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"

subprocess.call(filebot.split() + args)


Command in Vuze:

/usr/share/filebot/bin/filebot.sh -script,fn:utorrent-postprocess,--def,plex=127.0.0.1,--output,/plexMedia,--action,copy,--conflict,override,-non-strict,--def,artwork=y,ut_dir=%D,ut_file=%F,ut_kind=%K,ut_title=%N,ut_label=%L,ut_state=%S
danielsokolowski
Posts: 9
Joined: 03 Jan 2013, 01:55

Re: Vuze Command runner - Executes but nothing happens

Post by danielsokolowski »

Thank you for posting your findings, I am in the process of migrating away from uTorrent (BitTorrent) because their RSS feed support lacks basic 'file size' filter.

Regradless below is a modified filebot-with-vuze-fix.cmd script that fixes the quotes, change paths as needed. I also urge that anyone reading this contacts the Command Runner author and advise them of this bug in hopes they will fix it and also that if you have the option to move files after the complete the "ut_dir" "ut_file" are wrong - the work arround is to do a string replace as in the script:

Code: Select all

@ECHO OFF

REM Fix escaping of quote where we get \" turned into either \<space>" or \"<space>
set CORRECTED=%*
set CORRECTED=%CORRECTED:\" =\"%
set CORRECTED=%CORRECTED:\ "=\"%

REM Fix the incorrect ut_file/ut_dir with string replacment
set CORRECTED=%CORRECTED:\Torrents\_Torrents Incomplete=\Torrents%

ECHO Last run with corrected string was %0 %CORRECTED% > "D:\Media Library\_FileBot Portable\filebot-with-vuze-fix.cmd.log"

java -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=portable -Dapplication.analytics=true "-Dapplication.dir=%~dp0." "-Duser.home=%~dp0."  

"-Djava.io.tmpdir=%~dp0temp" "-Djna.library.path=%~dp0." "-Djava.library.path=%~dp0." -Djava.util.prefs.PreferencesFactory=net.sourceforge.tuned.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=%~dp0prefs.properties" -

jar "%~dp0FileBot.jar" %CORRECTED%
And for completion my Command Runner command is:

Code: Select all

"D:\Media Library\_FileBot Portable\filebot-with-vuze-fix.cmd" -script fn:amc --def "output=D:/Media Library" "log-file D:/Torrents/_filebot-with-vuze-fix.cmd.log" "action=move" "conflict=override" "xbmc=192.168.0.102" "music=y" "subtitles=n" "artwork=n" "clean=y" "seriesFormat=TV Shows/{n.replaceAll(\" \\(\" + y + \"\\)\",\"\")} ({y}) {genres}/{episode.special ? \"Special\" : \"Season \"+s.pad(2)}/{n} - {episode.special ? \"S00E\"+special.pad(2) : s00e00} - {t.replaceAll(/[\`\Â\´\â\€\˜\\â\€\™\Ê\»]/, \"'\").replaceAll(/[!?.]+$/).replacePart(', Part $1')}{\".$lang\"}" "movieFormat=Movies/{n} ({y}) {genres}/{n} ({y}){\" CD$pi\"}{\".$lang\"}" "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S"
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Vuze Command runner - Executes but nothing happens

Post by rednoah »

Pretty sure this part doesn't work:

Code: Select all

--def "output=D:/Media Library" "log-file D:/Torrents/_filebot-with-vuze-fix.cmd.log" "action=move" "conflict=override" 
These options are basic filebot options and must be specified as normal cmdline options like in my examples. They're different from he generic paramaters you can be passed onto scripts via --def name=value syntax.

e.g.

Code: Select all

filebot -script fn:amc --output "X:/path/to/media" --log-file amc.log --action copy --conflict override -non-strict ...
:idea: Please read the FAQ and How to Request Help.
Post Reply