sync with latest nzbget default script

This commit is contained in:
Clinton Hall 2013-03-18 22:48:10 -07:00
commit 6419839b85

View file

@ -279,13 +279,13 @@ do_exit() {
# Check if the script is called from nzbget 10.0 or later # Check if the script is called from nzbget 10.0 or later
if [ "$NZBPP_DIRECTORY" = "" -o "$NZBOP_CONFIGFILE" = "" ]; then if [ "$NZBPP_DIRECTORY" = "" -o "$NZBOP_CONFIGFILE" = "" ]; then
echo "*** NZBGet post-processing script ***" echo "*** NZBGet post-processing script ***"
echo "This script is supposed to be called from nzbget (10.0 or later)." echo "This script is supposed to be called from nzbget (10.0 or later)."
exit $POSTPROCESS_ERROR exit $POSTPROCESS_ERROR
fi fi
if [ "$NZBOP_UNPACK" = "" ]; then if [ "$NZBOP_UNPACK" = "" ]; then
echo "[ERROR] This script requires nzbget version at least 10.0-testing-r555 or 10.0-stable." echo "[ERROR] This script requires nzbget version at least 10.0-testing-r555 or 10.0-stable."
exit $POSTPROCESS_ERROR exit $POSTPROCESS_ERROR
fi fi
# Check if postprocessing was disabled in postprocessing parameters # Check if postprocessing was disabled in postprocessing parameters
@ -320,7 +320,7 @@ if [ "$NZBOP_ALLOWREPROCESS" = "yes" ]; then
fi fi
if [ "$NZBOP_UNPACK" != "yes" ]; then if [ "$NZBOP_UNPACK" != "yes" ]; then
echo "[ERROR] Post-Process: Please enable option \"Unpack\" in nzbget configuration file" | tee -a tmp.log echo "[ERROR] Post-Process: Please enable option \"Unpack\" in nzbget configuration file" | tee -a tmp.log
BadConfig=1 BadConfig=1
fi fi
@ -335,8 +335,8 @@ if [ "$NZBPP_PARSTATUS" -eq 3 ]; then
do_exit $POSTPROCESS_NONE do_exit $POSTPROCESS_NONE
fi fi
if [ "$NZBPP_PARSTATUS" -eq 1 ]; then if [ "$NZBPP_PARSTATUS" -eq 1 ]; then
echo "[WARNING] Post-Process: Par-check failed, exiting" | tee -a tmp.log echo "[WARNING] Post-Process: Par-check failed, exiting" | tee -a tmp.log
do_exit $POSTPROCESS_NONE do_exit $POSTPROCESS_NONE
fi fi
# Check unpack status # Check unpack status
@ -367,12 +367,10 @@ fi
# Check if destination directory exists (important for reprocessing of history items) # Check if destination directory exists (important for reprocessing of history items)
if [ ! -d "$NZBPP_DIRECTORY" ]; then if [ ! -d "$NZBPP_DIRECTORY" ]; then
echo "[ERROR] Post-Process: Nothing to post-process: destination directory $NZBPP_DIRECTORY doesn't exist" | tee -a tmp.log echo "[ERROR] Post-Process: Nothing to post-process: destination directory $NZBPP_DIRECTORY doesn't exist" | tee -a tmp.log
do_exit $POSTPROCESS_ERROR do_exit $POSTPROCESS_ERROR
fi fi
cd "$NZBPP_DIRECTORY"
# All checks done, now processing the files # All checks done, now processing the files
# If download contains only nzb-files move them into nzb-directory # If download contains only nzb-files move them into nzb-directory
@ -401,22 +399,22 @@ if [ "$JoinTS" = "yes" ]; then
# Join any split .ts files if they are named xxxx.0000.ts xxxx.0001.ts # Join any split .ts files if they are named xxxx.0000.ts xxxx.0001.ts
# They will be joined together to a file called xxxx.0001.ts # They will be joined together to a file called xxxx.0001.ts
if (ls *.ts >/dev/null 2>&1); then if (ls *.ts >/dev/null 2>&1); then
echo "[INFO] Post-Process: Joining ts-files" | tee -a tmp.log echo "[INFO] Post-Process: Joining ts-files" | tee -a tmp.log
tsname=`find . -name "*0001.ts" |awk -F/ '{print $NF}'` tsname=`find . -name "*0001.ts" |awk -F/ '{print $NF}'`
cat *0???.ts > ./$tsname cat *0???.ts > ./$tsname
# Remove all the split .ts files # Remove all the split .ts files
echo "[INFO] Post-Process: Deleting source ts-files" | tee -a tmp.log echo "[INFO] Post-Process: Deleting source ts-files" | tee -a tmp.log
rm *0???.ts >/dev/null 2>&1 rm *0???.ts >/dev/null 2>&1
fi fi
fi fi
if [ "$RenameIMG" = "yes" ]; then if [ "$RenameIMG" = "yes" ]; then
# Rename img file to iso # Rename img file to iso
# It will be renamed to .img.iso so you can see that it has been renamed # It will be renamed to .img.iso so you can see that it has been renamed
if (ls *.img >/dev/null 2>&1); then if (ls *.img >/dev/null 2>&1); then
echo "[INFO] Post-Process: Renaming img-files to iso" | tee -a tmp.log echo "[INFO] Post-Process: Renaming img-files to iso" | tee -a tmp.log
imgname=`find . -name "*.img" |awk -F/ '{print $NF}'` imgname=`find . -name "*.img" |awk -F/ '{print $NF}'`
mv $imgname $imgname.iso mv $imgname $imgname.iso
fi fi
fi fi
@ -429,8 +427,8 @@ if [ "$NZBPR_DestDir" != "" ]; then
mv * $NZBPR_DestDir >/dev/null 2>&1 mv * $NZBPR_DestDir >/dev/null 2>&1
cd .. cd ..
rmdir $NZBPP_DIRECTORY rmdir $NZBPP_DIRECTORY
NZBPP_DIRECTORY=$NZBPR_DestDir NZBPP_DIRECTORY=$NZBPR_DestDir
cd $NZBPP_DIRECTORY cd $NZBPP_DIRECTORY
fi fi
# All OK, requesting cleaning up of download queue # All OK, requesting cleaning up of download queue