Few changes for failed download handling by clients

This commit is contained in:
schumi2004 2012-12-07 14:19:53 +01:00
commit d5d86e5ef5
3 changed files with 51 additions and 53 deletions

View file

@ -3,30 +3,18 @@
import sys import sys
import autoProcessMovie import autoProcessMovie
# SABnzbd if len(sys.argv) < 8:
if len(sys.argv) == 8: print "Invalid number of arguments received from client. Please update it."
# SABnzbd argv: sys.exit()
# 1 The final directory of the job (full path) else:
# 2 The original name of the NZB file print "Script triggered from client, starting autoProcessMovie..."
# 3 Clean version of the job name (no path info and ".nzb" removed)
# 4 Indexer's report number (if supported)
# 5 User-defined category
# 6 Group that the NZB was posted in e.g. alt.binaries.x
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2
print "Script triggered from SABnzbd, starting autoProcessMovie..."
autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7]) autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7])
# NZBGet # sys.argv:
elif len(sys.argv) == 3: # 1 The final directory of the job (full path)
# NZBGet argv: # 2 The original name of the NZB file
# 1 The final directory of the job (full path) # 3 Clean version of the job name (no path info and ".nzb" removed)
# 2 The original name of the NZB file # 4 Indexer's report number (if supported)
# From NZBGet only successful downloads are triggered so status is set to "0" # 5 User-defined category
print "Script triggered from NZBGet, starting autoProcessMovie..." # 6 Group that the NZB was posted in e.g. alt.binaries.x
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2
autoProcessMovie.process(sys.argv[1], sys.argv[2], 0)
else:
print "Invalid number of arguments received from client."
print "Running autoProcessMovie as a manual run..."
autoProcessMovie.process('Manual Run', 'Manual Run', 0)

View file

@ -21,33 +21,21 @@
# Edited by Clinton Hall to prevent processing of failed downloads. # Edited by Clinton Hall to prevent processing of failed downloads.
# Also added suppot for NZBGet. With help from thorli # Also added suppot for NZBGet. With help from thorli
import sys import sys
import autoProcessTV import autoProcessTV
# SABnzbd if len(sys.argv) < 8:
if len(sys.argv) == 8: print "Invalid number of arguments received from client. Please update it."
# SABnzbd argv: sys.exit()
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 Clean version of the job name (no path info and ".nzb" removed)
# 4 Indexer's report number (if supported)
# 5 User-defined category
# 6 Group that the NZB was posted in e.g. alt.binaries.x
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2
print "Script triggered from SABnzbd, starting autoProcessTV..."
autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7])
# NZBGet
elif len(sys.argv) == 3:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# From NZBGet only successful downloads are triggered so status is set to "0"
print "Script triggered from NZBGet, starting autoProcessTV..."
autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], 0)
else: else:
print "Invalid number of arguments received from client." print "Script triggered from client, starting autoProcessTV..."
sys.exit() autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7])
# sys.argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 Clean version of the job name (no path info and ".nzb" removed)
# 4 Indexer's report number (if supported)
# 5 User-defined category
# 6 Group that the NZB was posted in e.g. alt.binaries.x
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2

View file

@ -164,6 +164,17 @@ if [ "$NZBPP_PARSTATUS" -eq 1 -o "$NZBPP_PARSTATUS" -eq 3 -o "$NZBPP_PARFAILED"
echo "[WARNING] Post-Process: Par-check successful, but Par-repair disabled, exiting" echo "[WARNING] Post-Process: Par-check successful, but Par-repair disabled, exiting"
else else
echo "[WARNING] Post-Process: Par-check failed, exiting" echo "[WARNING] Post-Process: Par-check failed, exiting"
# Send notifications to SickBeard or CouchPotato that Par-check failed
if [ "$SickBeard" = "yes" -a "$NZBPP_CATEGORY" = "$SickBeardCategory" -a -e "$SabToSickBeard" ]; then
# Call SickBeard's postprocessing script
echo "[INFO] Post-Process: Running SickBeard's postprocessing script to notify Par-check failed"
$PythonCmd $SabToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "" "" "" "" "1" >/dev/null 2>&1
fi
if [ "$CouchPotato" = "yes" -a "$NZBPP_CATEGORY" = "$CouchPotatoCategory" -a -e "$nzbToCouchPotato" ]; then
# Call CouchPotato's postprocessing script
echo "[INFO] Post-Process: Running CouchPotato's postprocessing script to notify Par-check failed"
$PythonCmd $nzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "" "" "" "" "1" >/dev/null 2>&1
fi
fi fi
exit $POSTPROCESS_ERROR exit $POSTPROCESS_ERROR
fi fi
@ -226,6 +237,17 @@ if (ls *.rar >/dev/null 2>&1); then
if (ls *.[pP][aA][rR]2 >/dev/null 2>&1); then if (ls *.[pP][aA][rR]2 >/dev/null 2>&1); then
echo "[INFO] Post-Process: Requesting par-repair" echo "[INFO] Post-Process: Requesting par-repair"
exit $POSTPROCESS_PARCHECK_ALL exit $POSTPROCESS_PARCHECK_ALL
# Send notifications to SickBeard or CouchPotato that unrar (second pass) failed
if [ "$SickBeard" = "yes" -a "$NZBPP_CATEGORY" = "$SickBeardCategory" -a -e "$SabToSickBeard" ]; then
# Call SickBeard's postprocessing script
echo "[INFO] Post-Process: Running SickBeard's postprocessing script to notify unrar (second pass) failed"
$PythonCmd $SabToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "" "" "" "" "1">/dev/null 2>&1
fi
if [ "$CouchPotato" = "yes" -a "$NZBPP_CATEGORY" = "$CouchPotatoCategory" -a -e "$nzbToCouchPotato" ]; then
# Call CouchPotato's postprocessing script
echo "[INFO] Post-Process: Running CouchPotato's postprocessing script to notify unrar (second pass) failed"
$PythonCmd $nzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "" "" "" "" "1">/dev/null 2>&1
fi
fi fi
exit $POSTPROCESS_ERROR exit $POSTPROCESS_ERROR
fi fi
@ -355,13 +377,13 @@ fi
if [ "$SickBeard" = "yes" -a "$NZBPP_CATEGORY" = "$SickBeardCategory" -a -e "$NzbToSickBeard" ]; then if [ "$SickBeard" = "yes" -a "$NZBPP_CATEGORY" = "$SickBeardCategory" -a -e "$NzbToSickBeard" ]; then
# Call SickBeard's postprocessing script # Call SickBeard's postprocessing script
echo "[INFO] Post-Process: Running SickBeard's postprocessing script" echo "[INFO] Post-Process: Running SickBeard's postprocessing script"
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" >/dev/null 2>&1 $PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "" "" "" "" "0" >/dev/null 2>&1
fi fi
if [ "$CouchPotato" = "yes" -a "$NZBPP_CATEGORY" = "$CouchPotatoCategory" -a -e "$NzbToCouchPotato" ]; then if [ "$CouchPotato" = "yes" -a "$NZBPP_CATEGORY" = "$CouchPotatoCategory" -a -e "$NzbToCouchPotato" ]; then
# Call CouchPotato's postprocessing script # Call CouchPotato's postprocessing script
echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" echo "[INFO] Post-Process: Running CouchPotato's postprocessing script"
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" >/dev/null 2>&1 $PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "" "" "" "" "0" >/dev/null 2>&1
fi fi
# Check if destination directory was set in postprocessing parameters # Check if destination directory was set in postprocessing parameters