Page 1 of 1

Shell Command to PP-Script

Posted: 02 Nov 2018, 12:42
by cm2003
Hi,

I'm trying to get a shell command run as PP-script since about 3 hours, but I just can't make it to work.
Can someone help me please?

I want to run this command:

Code: Select all

sshpass -p PASSWORD ssh -l admin 192.168.178.3 "filebot -script 'fn:amc' /share/CACHEDEV1_DATA/Download/completed --output /share/CACHEDEV1_DATA/Multimedia --action move -non-strict --order Airdate --conflict auto --lang de --def 'unsorted=y' 'clean=y' 'skipExtract=y' 'seriesFormat=Series/{n}/{'\''Season '\''+s}/{n} - {s00e00} - {t}' 'movieFormat=Movies/{ny}/{ny}{'\'' CD'\''+pi}{subt}' 'excludeList=.excludes' --log all --log-file '/share/CACHEDEV1_DATA/.qpkg/filebot-node/data/filebot.log'"
Basically what I'm trying to do is to trigger my filebot (installed to my NAS) from NZBGet running in an Ubuntu image.

Thanks
cM

-edit-
Crap, this might be the wrong forum. Sorry about that - can you maybe move it to the support forum?

Re: Shell Command to PP-Script

Posted: 02 Nov 2018, 14:23
by hugbug
You need to create a text file, preferab!y with .sh extension. As first line add shebang (google) and then the command.

For script to appear in nzbget extensions list it must contain special comment markers. At the end the script should return certain exit code to inform nzbget about success/failure. Documentation on this can be found via links at the top of the page.

If the script doesn't work post your current version of it for review and suggestions.

Re: Shell Command to PP-Script

Posted: 02 Nov 2018, 17:32
by cm2003
Hi hugbug,

this is the script I've got:

Code: Select all

#!/bin/sh

#######################################
### NZBGET POST-PROCESSING SCRIPT   ###

# Trigger Filebot
#
# This is a script to trigger Filebot. It starts sorting,
# renaming and cleaning up the downloaded file.

### NZBGET POST-PROCESSING SCRIPT   ###
#######################################

sshpass -p PASSWORD ssh -l admin 192.168.178.3 "filebot -script 'fn:amc' /share/CACHEDEV1_DATA/Download/completed --output /share/CACHEDEV1_DATA/Multimedia --action move -non-strict --order Airdate --conflict auto --lang de --def 'unsorted=y' 'clean=y' 'skipExtract=y' 'seriesFormat=Series/{n}/{'\''Season '\''+s}/{n} - {s00e00} - {t}' 'movieFormat=Movies/{ny}/{ny}{'\'' CD'\''+pi}{subt}' 'excludeList=.excludes' --log all --log-file '/share/CACHEDEV1_DATA/.qpkg/filebot-node/data/filebot.log'"

# NZBGet Exit Codes
if [ $? = 0 ]; then
	exit 93 # SUCCESS
else
	exit 94 # FAILURE
fi

It shows up in NZBGet, but when being executed, I receive this error:

Code: Select all

error	Fri Nov 02 2018 18:26:12	Filebot: Could not start /download/scripts/Filebot.sh: No such file or directory
I've tried several approaches, but I always come across a new issue.
I.E. when using the example script from the documentation, I receive this error message:

Code: Select all

error	Fri Nov 02 2018 18:30:17	Post-process-script Filebot.sh for XXX failed (terminated with unknown status)
info	Fri Nov 02 2018 18:30:17	Filebot: /bin/sh: 0: Can't open
When ssh into my NZBGet Docker (with the user I'm using to start NZBGet with), the /bin/sh is available - as well as the share containing the script.

I've also tried this script, but I can't make it work either:
https://github.com/filebot/plugins/blob ... process.sh

Re: Shell Command to PP-Script

Posted: 02 Nov 2018, 18:47
by hugbug
Test if you can start the script from terminal.
Possible cause is the wrong line ending, make sure it's Unix line endings (not Windows).

Re: Shell Command to PP-Script

Posted: 02 Nov 2018, 19:20
by cm2003
Seems to be working from shell:

Code: Select all

$ sh Filebot.sh
: not found 2: Filebot.sh:
: not found 5: Filebot.sh:
: not found 10: Filebot.sh:
: not found 13: Filebot.sh:
: not found 14: Filebot.sh:
x86_64
Locking /share/CACHEDEV1_DATA/.qpkg/filebot-node/data/filebot.log
Run script [fn:amc] at [Fri Nov 02 19:19:16 GMT 2018]
Parameter: unsorted = y
Parameter: clean = y
Parameter: skipExtract = y
Parameter: seriesFormat = Series/{n}/{'Season '+s}/{n} - {s00e00} - {t}
Parameter: movieFormat = Movies/{ny}/{ny}{' CD'+pi}{subt}
Parameter: excludeList = .excludes
Argument[0]: /share/CACHEDEV1_DATA/Download/completed
Use excludes: /share/CACHEDEV1_DATA/Multimedia/.excludes (11)
No files selected for processing
Done ヾ(@⌒ー⌒@)ノ
: not found 16: Filebot.sh:
Filebot.sh: 23: Filebot.sh: Syntax error: end of file unexpected (expecting "then")
$
Not sure why it's throwing the not found errors though :o

-edit-
Fixed the script by changing the mentioned line endings. Just trying if this actually fixes NZBGet too :)

-edit2-
IT'S WORKING!
Just because of these stupid line endings I was wasting like half a day :)

Thank you so much!