Page 1 of 1
Testing PP Script?
Posted: March 22nd, 2015, 2:47 am
by tom34
Hi,
I want to use this:
If the category is tmp, do nothing, if not, search for .mkv or .mp4 in subfolders and move them to a defined directory.
I create the following script:
Code: Select all
#!/bin/bash
Seriendownloads=/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Public/Seriendownloads/
if $5!=tmp
then
find $1 -name *.avi -or -name *.mkv -or -name *.mp4 -execdir mv '{}' $Seriendownloads \;
else
fi
But how can i test the script?
Do I have to download a nzb for testing it? If it doesent work, do I have to download another nzb?
Or is there a hint to test it with current nzbs or completed nzbs?
Re: Testing PP Script?
Posted: March 22nd, 2015, 7:22 am
by tom34
Hm, the given Parameters $1 etc doesen't work for me?
Not even this works:
File "/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Download/sabnzbd/scripte/Postprocessing.py", line 3
echo $1 >>ausgabe.ext
^
SyntaxError: invalid syntax
How to run normal .sh scripts? Do i have to rename them to .py?
Re: Testing PP Script?
Posted: March 22nd, 2015, 4:39 pm
by shypike
Did you create the file with a Windows editor?
Make sure the line endings are LF instead of CR LF.
Re: Testing PP Script?
Posted: March 22nd, 2015, 5:01 pm
by sander
I think tom34 is trying to run a .sh script with python. Not good.
Re: Testing PP Script?
Posted: March 23rd, 2015, 3:52 am
by tom34
Thanks for your answers.
The files are created with nano directly from terminal.
Yes, they are shellscripts, but with extension .sh they don't appear in "category - script"
What has to be modified to use .sh scripts as postprocessing scripts in sabnzbd?
Re: Testing PP Script?
Posted: March 23rd, 2015, 5:39 am
by sander
To me you seem unexperienced with SABnzbd PP scripts and shell & python scripting.
So my advice to you is to first get some experience with an existing, working SABnzbd PP script
HTH
Re: Testing PP Script?
Posted: March 23rd, 2015, 5:42 am
by tom34
Right, i do know nothing about python

But my shellscripts are working till now.
Why doesen't sabnzbd recognize my .sh scripts in the dropdown menus?
Or could you please help me to create a simple python script that runs my shell script with the sabnzbd parameters $1-7?
Re: Testing PP Script?
Posted: March 23rd, 2015, 7:15 am
by shypike
Does your shell script run from a interactive shell?
Does it have its X bit set?
Re: Testing PP Script?
Posted: March 24th, 2015, 7:26 am
by tom34
After 1,5 days of work, try and error all my problems are resolved.
My scripts doesen't work direclty on console with ./script.sh, because the operating system Openmediavault mounts every hdd unter /media as "noexec".
Read, write and delete works, but not execute.
After deleting the noexec in fstab mount the scipts runs on console.
AND: Alle the .sh sctips are visible in sabnzbd!
So here is my working script, that looks for extensions in the downloaded folder and moves the files to other folders, depending on category which was chosen.
If no category was chosen, an error message is written to the logfile.
Code: Select all
#!/bin/bash
Seriendownloads='/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Public/Seriendownloads/'
FilmeHD='/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Public/Filme-HD/'
tmp='/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Download/transmission/completed/tmp/'
quellordner=$1
function kopiervorgang()
{
for k in $(find $1 -name *.avi -or -name *.mkv -or -name *.mp4 -or -name *.apk)
do mv $k $2
done
}
IFS="
"
case $5 in
"serie")
ziel=$Seriendownloads;
kopiervorgang $quellordner $ziel
;;
"film")
ziel=$FilmeHD;
kopiervorgang $quellordner $ziel
;;
tmp)
echo "Kategorie ist $5" ;;
*)
echo "Keine gueltige Kategorie" ;;
esac
exit 0
Re: Testing PP Script?
Posted: March 24th, 2015, 10:30 am
by sander
Well done, tom34!