diff --git a/nzbget-postprocessing-files/9.0/nzbget-postprocess.sh b/nzbget-postprocessing-files/9.0/nzbget-postprocess.sh index 80e4102b..58523642 100644 --- a/nzbget-postprocessing-files/9.0/nzbget-postprocess.sh +++ b/nzbget-postprocessing-files/9.0/nzbget-postprocess.sh @@ -98,66 +98,66 @@ POSTPROCESS_NONE=95 # Postprocessing function for nzbToCouchPotato and nzbToSickBeard nzbToMedia() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing external postprocessing with argument $1" ; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing external postprocessing with argument $1" | tee -a tmp.log; fi PostProcessStatus=0 if [ -n "$1" ]; then PostProcessStatus=$1 ; fi - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" ; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" | tee -a tmp.log; fi find "$NZBPP_DIRECTORY" -type f -size -200000k -iname \*sample\* -exec rm {} \; >/dev/null 2>&1 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" + echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" | tee -a tmp.log if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: CouchPotato-Script-Path=$NzbToCouchPotato" - echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV1=$NZBPP_DIRECTORY" - echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" - echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" + echo "[DETAIL] Post-Process: CouchPotato-Script-Path=$NzbToCouchPotato" | tee -a tmp.log + echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a tmp.log + echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a tmp.log + echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" | tee -a tmp.log fi $PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then echo "[INFO] Post-Process: $line" ; fi ; done else - if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')"; fi - if [ ! -e "$NzbToCouchPotato" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as the specified script ('$NzbToCouchPotato') does not exist"; fi + if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')" | tee -a tmp.log; fi + if [ ! -e "$NzbToCouchPotato" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as the specified script ('$NzbToCouchPotato') does not exist" | tee -a tmp.log; fi fi 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" + echo "[INFO] Post-Process: Running SickBeard's postprocessing script" | tee -a tmp.log if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: SickBeard-Script-Path=$NzbToSickBeard" - echo "[DETAIL] Post-Process: SickBeard-Script-ARGV1=$NZBPP_DIRECTORY" - echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" - echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" + echo "[DETAIL] Post-Process: SickBeard-Script-Path=$NzbToSickBeard" | tee -a tmp.log + echo "[DETAIL] Post-Process: SickBeard-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a tmp.log + echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a tmp.log + echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" | tee -a tmp.log fi $PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then echo "[INFO] Post-Process: $line" ; fi ; done else - if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')"; fi - if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist"; fi + if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')" | tee -a tmp.log; fi + if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist" | tee -a tmp.log; 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" + echo "[INFO] Post-Process: Running the Custom postprocessing script" | tee -a tmp.log 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" + echo "[DETAIL] Post-Process: Custom-Script-Path=$CustomScript" | tee -a tmp.log + echo "[DETAIL] Post-Process: Custom-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a tmp.log + echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a tmp.log + echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" | tee -a tmp.log fi $CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | 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 + if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')" | tee -a tmp.log; fi + if [ ! -e "$CustomScript" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as the specified script ('$CustomScript') does not exist" | tee -a tmp.log; fi fi fi } replaceVarBy() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'replaceVarBy'. Going to replace '${2}' in '${1}' by '${3}'" ; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'replaceVarBy'. Going to replace '${2}' in '${1}' by '${3}'" | tee -a tmp.log; fi # If we're not using Bash use sed, as we need to support as much as systems possible, also those running sh/dash etc if [ -n "${BASH_VERSION}" ]; then @@ -166,12 +166,12 @@ replaceVarBy() { REPLACEDRESULT=$(echo "${1}" | sed "s^${2}^${3}^g") fi - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: replace result: ${REPLACEDRESULT}" ; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: replace result: ${REPLACEDRESULT}" | tee -a tmp.log; fi } # Pass on postprocess exit codes to external scripts for handling failed downloads do_exit() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" ; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" | tee -a tmp.log; fi nzbStatus=0 if [ "$1" -ne "$POSTPROCESS_SUCCESS" ]; then if [ "$Delete_Failed" = "yes" ]; then @@ -190,7 +190,7 @@ do_exit() { fi script=none nzbToMedia $nzbStatus - echo "[DETAIL] after calling nzbToMedia" + echo "[DETAIL] after calling nzbToMedia" | tee -a tmp.log replaceVarBy "${Email_Subject}" "" "${NZBPP_NZBFILENAME}" replaceVarBy "${REPLACEDRESULT}" "" "${NZBPP_CATEGORY}" replaceVarBy "${REPLACEDRESULT}" "