From 70a41be8cd5683ca1f2e02bb12551864c326869b Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Wed, 20 Mar 2013 16:52:37 -0700 Subject: [PATCH] make tmp.log absolute path --- .../10.0/nzbget-postprocess.sh | 142 +++++++++--------- 1 file changed, 72 insertions(+), 70 deletions(-) diff --git a/nzbget-postprocessing-files/10.0/nzbget-postprocess.sh b/nzbget-postprocessing-files/10.0/nzbget-postprocess.sh index 73d31716..87134418 100755 --- a/nzbget-postprocessing-files/10.0/nzbget-postprocess.sh +++ b/nzbget-postprocessing-files/10.0/nzbget-postprocess.sh @@ -77,117 +77,117 @@ POSTPROCESS_NONE=95 # Postprocessing function for nzbToCouchPotato and nzbToSickBeard nzbToMedia() { - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing external postprocessing with argument $1" | tee -a tmp.log; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing external postprocessing with argument $1" | tee -a $tmplog; 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'" | tee -a tmp.log; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" | tee -a $tmplog; 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" | tee -a tmp.log + echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" | tee -a $tmplog if [ "$Debug" = "yes" ]; then - 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 + echo "[DETAIL] Post-Process: CouchPotato-Script-Path=$NzbToCouchPotato" | tee -a $tmplog + echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a $tmplog + echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog + echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog fi $PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${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')" | 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 + if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')" | tee -a $tmplog; 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 $tmplog; 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" | tee -a tmp.log + echo "[INFO] Post-Process: Running SickBeard's postprocessing script" | tee -a $tmplog if [ "$Debug" = "yes" ]; then - 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 + echo "[DETAIL] Post-Process: SickBeard-Script-Path=$NzbToSickBeard" | tee -a $tmplog + echo "[DETAIL] Post-Process: SickBeard-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a $tmplog + echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog + echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog fi $PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${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')" | 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 + if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')" | tee -a $tmplog; 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 $tmplog; fi fi fi if [ "$NZBPP_CATEGORY" = "$HeadPhonesCategory" ]; then if [ "$HeadPhones" = "yes" -a -e "$NzbToHeadPhones" ]; then script=$NzbToHeadPhones # Call HeadPhones' postprocessing script - echo "[INFO] Post-Process: Running HeadPhones' postprocessing script" | tee -a tmp.log + echo "[INFO] Post-Process: Running HeadPhones' postprocessing script" | tee -a $tmplog if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: HeadPhones-Script-Path=$NzbToHeadPhones" | tee -a tmp.log - echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a tmp.log - echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a tmp.log - echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV3=$PostProcessStatus" | tee -a tmp.log + echo "[DETAIL] Post-Process: HeadPhones-Script-Path=$NzbToHeadPhones" | tee -a $tmplog + echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a $tmplog + echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog + echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog fi $PythonCmd $NzbToHeadPhones "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done else - if [ "$HeadPhones" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as it is disabled by user ('$HeadPhones')" | tee -a tmp.log; fi - if [ ! -e "$NzbToHeadPhones" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as the specified script ('$NzbToHeadPhones') does not exist" | tee -a tmp.log; fi + if [ "$HeadPhones" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as it is disabled by user ('$HeadPhones')" | tee -a $tmplog; fi + if [ ! -e "$NzbToHeadPhones" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as the specified script ('$NzbToHeadPhones') does not exist" | tee -a $tmplog; fi fi fi if [ "$NZBPP_CATEGORY" = "$MylarCategory" ]; then if [ "$Mylar" = "yes" -a -e "$NzbToMylar" ]; then script=$NzbToMylar # Call Mylar's postprocessing script - echo "[INFO] Post-Process: Running Mylar's postprocessing script" | tee -a tmp.log + echo "[INFO] Post-Process: Running Mylar's postprocessing script" | tee -a $tmplog if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: Mylar-Script-Path=$NzbToMylar" | tee -a tmp.log - echo "[DETAIL] Post-Process: Mylar-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a tmp.log - echo "[DETAIL] Post-Process: Mylar-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a tmp.log - echo "[DETAIL] Post-Process: Mylar-Script-ARGV3=$PostProcessStatus" | tee -a tmp.log + echo "[DETAIL] Post-Process: Mylar-Script-Path=$NzbToMylar" | tee -a $tmplog + echo "[DETAIL] Post-Process: Mylar-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a $tmplog + echo "[DETAIL] Post-Process: Mylar-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog + echo "[DETAIL] Post-Process: Mylar-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog fi $PythonCmd $NzbToMylar "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done else - if [ "$Mylar" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as it is disabled by user ('$Mylar')" | tee -a tmp.log; fi - if [ ! -e "$NzbToMylar" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as the specified script ('$NzbToMylar') does not exist" | tee -a tmp.log; fi + if [ "$Mylar" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as it is disabled by user ('$Mylar')" | tee -a $tmplog; fi + if [ ! -e "$NzbToMylar" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as the specified script ('$NzbToMylar') does not exist" | tee -a $tmplog; fi fi fi if [ "$NZBPP_CATEGORY" = "$GamezCategory" ]; then if [ "$Gamez" = "yes" -a -e "$NzbToGamez" ]; then script=$NzbToGamez # Call Gamez's postprocessing script - echo "[INFO] Post-Process: Running Gamez's postprocessing script" | tee -a tmp.log + echo "[INFO] Post-Process: Running Gamez's postprocessing script" | tee -a $tmplog if [ "$Debug" = "yes" ]; then - echo "[DETAIL] Post-Process: Gamez-Script-Path=$NzbToGamez" | tee -a tmp.log - echo "[DETAIL] Post-Process: Gamez-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a tmp.log - echo "[DETAIL] Post-Process: Gamez-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a tmp.log - echo "[DETAIL] Post-Process: Gamez-Script-ARGV3=$PostProcessStatus" | tee -a tmp.log + echo "[DETAIL] Post-Process: Gamez-Script-Path=$NzbToGamez" | tee -a $tmplog + echo "[DETAIL] Post-Process: Gamez-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a $tmplog + echo "[DETAIL] Post-Process: Gamez-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog + echo "[DETAIL] Post-Process: Gamez-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog fi $PythonCmd $NzbToGamez "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done else - if [ "$Gamez" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as it is disabled by user ('$Gamez')" | tee -a tmp.log; fi - if [ ! -e "$NzbToGamez" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as the specified script ('$NzbToGamez') does not exist" | tee -a tmp.log; fi + if [ "$Gamez" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as it is disabled by user ('$Gamez')" | tee -a $tmplog; fi + if [ ! -e "$NzbToGamez" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as the specified script ('$NzbToGamez') does not exist" | tee -a $tmplog; 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" | tee -a tmp.log + echo "[INFO] Post-Process: Running the Custom postprocessing script" | tee -a $tmplog if [ "$Debug" = "yes" ]; then - 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 + echo "[DETAIL] Post-Process: Custom-Script-Path=$CustomScript" | tee -a $tmplog + echo "[DETAIL] Post-Process: Custom-Script-ARGV1=$NZBPP_DIRECTORY" | tee -a $tmplog + echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog + echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog fi $CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${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')" | 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 + if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')" | tee -a $tmplog; 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 $tmplog; fi fi fi } replaceVarBy() { - 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 [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'replaceVarBy'. Going to replace '${2}' in '${1}' by '${3}'" | tee -a $tmplog; 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 @@ -196,7 +196,7 @@ replaceVarBy() { REPLACEDRESULT=$(echo "${1}" | sed "s^${2}^${3}^g") fi - if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: replace result: ${REPLACEDRESULT}" | tee -a tmp.log; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: replace result: ${REPLACEDRESULT}" | tee -a $tmplog; fi } replaceLogLine() { @@ -213,12 +213,12 @@ replaceLogLine() { newline=$(echo $newline | sed "s^.*WARNING^[WARNING]^") newline=$(echo $newline | sed "s^.*ERROR^[ERROR]^") fi - echo "$newline" | tee -a tmp.log + echo "$newline" | tee -a $tmplog } # 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" | tee -a tmp.log; fi + if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" | tee -a $tmplog; fi nzbStatus=0 if [ "$1" -ne "$POSTPROCESS_SUCCESS" ]; then if [ "$Delete_Failed" = "yes" ]; then @@ -237,7 +237,7 @@ do_exit() { fi script=none nzbToMedia $nzbStatus - echo "[DETAIL] after calling nzbToMedia" | tee -a tmp.log + echo "[DETAIL] after calling nzbToMedia" | tee -a $tmplog replaceVarBy "${Email_Subject}" "" "${NZBPP_NZBFILENAME}" replaceVarBy "${REPLACEDRESULT}" "" "${NZBPP_CATEGORY}" replaceVarBy "${REPLACEDRESULT}" "