diff --git a/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh b/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh index 81741fa0..ec015385 100644 --- a/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh +++ b/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh @@ -104,6 +104,7 @@ nzbToMedia() { if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" ; fi if [ "$NZBPP_CATEGORY" = "$CouchPotatoCategory" ]; then if [ "$CouchPotato" = "yes" -a -e "$NzbToCouchPotato" ]; then + script=$NzbToCouchPotato # Call Couchpotato's postprocessing script echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" if [ "$Debug" = "yes" ]; then @@ -120,6 +121,7 @@ nzbToMedia() { fi if [ "$NZBPP_CATEGORY" = "$SickBeardCategory" ]; then if [ "$SickBeard" = "yes" -a -e "$NzbToSickBeard" ]; then + script=$NzbToSickBeard # Call SickBeard's postprocessing script echo "[INFO] Post-Process: Running SickBeard's postprocessing script" if [ "$Debug" = "yes" ]; then @@ -134,6 +136,23 @@ nzbToMedia() { if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist"; fi fi fi + if [ "$NZBPP_CATEGORY" = "$CustomCategory" ]; then + if [ "$Custom" = "yes" -a -e "$CustomScript" ]; then + script=$CustomScript + # Call Custom postprocessing script + echo "[INFO] Post-Process: Running the Custom postprocessing script" + if [ "$Debug" = "yes" ]; then + echo "[DETAIL] Post-Process: Custom-Script-Path=$CustomScript" + echo "[DETAIL] Post-Process: Custom-Script-ARGV1=$NZBPP_DIRECTORY" + echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" + echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" + fi + $CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" | while read line ; do if [ "$line" != "" ] ; then echo "[INFO] Post-Process: $line" ; fi ; done + else + if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')"; fi + if [ ! -e "$CustomScript" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as the specified script ('$CustomScript') does not exist"; fi + fi + fi } # Pass on postprocess exit codes to external scripts for handling failed downloads @@ -141,16 +160,27 @@ do_exit() { if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" ; fi nzbStatus=0 if [ "$1" -ne "$POSTPROCESS_SUCCESS" ]; then nzbStatus=1 ; fi + script=none nzbToMedia $nzbStatus + Email_Subject="${Email_Subject//$NZBPP_NZBFILENAME}" + Email_Subject="${Email_Subject//$NZBPP_CATEGORY}" + Email_Subject="${Email_Subject/