Hi all,
Thanks for this topic, NZBGet is a GREAT alternative to sabnzbd.
Currently I'm using the following post-processing script:
Code:
#!/bin/sh
# 1 - path to destination dir, where downloaded files are located;
# 2 - name of nzb-file processed;
# 3 - name of par-file processed (if par-checked) or empty string (if not);
# 4 - result of par-check:
# 0 - not checked: par-check disabled or nzb-file does not contain any
# par-files;
# 1 - checked and failed to repair;
# 2 - checked and sucessfully repaired;
# 3 - checked and can be repaired but repair is disabled;
# 5 - state of nzb-job:
# 0 - there are more collections in this nzb-file queued;
# 1 - this was the last collection in nzb-file;
# 6 - indication of failed par-jobs for current nzb-file:
# 0 - no failed par-jobs;
# 1 - current par-job or any of the previous par-jobs for the
# same nzb-files failed;
Sendmail=False
from=MyBook@isp.com
sendto=ReMiA@isp.com
server=mail.isp.com
nzbdir=/tmp/harddisk/torrent/target/
UNRAR=True
declare -a RARFILES
dir=$1
dest=/tmp/harddisk/torrent/target/
PauseServer=True
if [ "$5" = "1" ]
then
chmod -R 766 "$1"
subject="Download of $1 completed"
if [ "$4" = "0" ] ; then
echo "PAR2 not checked: par-check disabled or nzb-file does not contain any par-files" > "$nzbdir/message.txt"
elif [ "$4" = "1" ] ; then
echo "PAR2 checked and failed to repair" > "$nzbdir/message.txt"
elif [ "$4" = "2" ] ; then
echo "PAR2 checked and sucessfully repaired" > "$nzbdir/message.txt"
elif [ "$4" = "3" ] ; then
echo "PAR2 checked and can be repaired but repair is disabled" > "$nzbdir/message.txt"
elif [ "$4" = "" ] ; then
echo "No PAR2 returncode" > "$nzbdir/message.txt"
fi
if [ -f "$1/_brokenlog.txt" ] ; then
echo >> "$nzbdir/message.txt"
echo "Broken Files:" >> "$nzbdir/message.txt"
cat "$1/_brokenlog.txt" >> "$nzbdir/message.txt"
fi
fi
if [ $UNRAR = "True" ] ; then
# PAUSE Server
if [ $PauseServer = "True" ] ; then
/opt/bin/nzbget -P
fi
cd "$dir"
RARFILES=(`ls | grep -E [.][pP][Aa][Rr][Tt][0]*[1][.][Rr][Aa][Rr] | tr ' ' '§'`)
number_rar=${#RARFILES[*]}
if [ $number_rar -ge 1 ] ; then
for b in "${RARFILES[@]}"
do
rar=${b//§/ }
f=${rar/[.][pP][Aa][Rr][Tt][01]*[.][Rr][Aa][Rr]/}
destdir=$dest$f
mkdir "$destdir"
unrar x -y -o- -p- "$rar" "$destdir"
echo "UNRARRED $rar to $destdir" >> "$nzbdir/message.txt"
done
else
RARFILES=(`ls | grep -E [.][Rr][Aa][Rr] | tr ' ' '§'`)
number_rar=${#RARFILES[*]}
if [ $number_rar -ge 1 ] ; then
for b in "${RARFILES[@]}"
do
rar=${b//§/ }
f=${rar/[.][Rr][Aa][Rr]/}
destdir=$dest$f
mkdir "$destdir"
unrar x -y -o- -p- "$rar" "$destdir"
echo "UNRARRED $rar to $destdir" >> "$nzbdir/message.txt"
done
fi
chmod -R 766 "$destdir"
fi
# UN-Pause server
if [ $PauseServer = "True" ] ; then
/opt/bin/nzbget -U
fi
fi
if [ $Sendmail = "True" ] ; then
sendEmail -t $sendto -f $from -u $subject -s $server -o message-file="$nzbdir/message.txt" -q
fi
exit 0
But there's an issue with the 'declare' in rule 27... what can I do about this? Or if anyone has a working post-process script to unrar and clean up files, post it here, it seems there are more people interested!