Added Global Constants and Changed Whitespace

-Increasing use of global constants to make it easier when having to make alterations to multiple files.
-Some of the tabs where causing issues, as they would change into 8 spaces upon execution and python would complain about the indenting (as it would now be a mixture of 4 spaces and 8 spaces).  This has been changed to just use spaces.
-Renamed nzbToGamez to include python extention
-Made all nzbTo files that are supposed to be executable, executable
This commit is contained in:
ajw107 2013-03-07 11:56:54 +00:00 committed by Alex Wood
commit 2bf1240565
6 changed files with 86 additions and 87 deletions

View file

@ -14,28 +14,26 @@ Logger.info("====================") # Seperate old from new log
Logger.info("nzbToCouchPotato %s", VERSION)
# SABnzbd
if len(sys.argv) == 8:
# SABnzbd 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
Logger.info("Script triggered from SABnzbd, starting autoProcessMovie...")
result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7])
if len(sys.argv) == SABNZB_NO_OF_ARGUMENTS:
# SABnzbd 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
Logger.info("Script triggered from SABnzbd, starting autoProcessMovie...")
result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7])
# NZBGet
elif len(sys.argv) == 4:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
Logger.info("Script triggered from NZBGet, starting autoProcessMovie...")
result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[3])
elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
Logger.info("Script triggered from NZBGet, starting autoProcessMovie...")
result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[3])
else:
Logger.warn("Invalid number of arguments received from client.")
Logger.info("Running autoProcessMovie as a manual run...")
result = autoProcessMovie.process('Manual Run', 'Manual Run', 0)
Logger.warn("Invalid number of arguments received from client.")
Logger.info("Running autoProcessMovie as a manual run...")
result = autoProcessMovie.process('Manual Run', 'Manual Run', 0)

30
nzbToGamez → nzbToGamez.py Normal file → Executable file
View file

@ -14,27 +14,25 @@ Logger.info("====================") # Seperate old from new log
Logger.info("nzbToGamez %s", VERSION)
# SABnzbd
if len(sys.argv) == 8:
# SABnzbd 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
if len(sys.argv) == SABNZB_NO_OF_ARGUMENTS:
# SABnzbd 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
Logger.info("Script triggered from SABnzbd, starting autoProcessGames...")
result = autoProcessGames.process(sys.argv[1], sys.argv[2], sys.argv[7])
# NZBGet
elif len(sys.argv) == 4:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
Logger.info("Script triggered from NZBGet, starting autoProcessGames...")
result = autoProcessGames.process(sys.argv[1], sys.argv[2], sys.argv[3])
else:
Logger.warn("Invalid number of arguments received from client. Exiting")
sys.exit(1)

30
nzbToHeadPhones.py Normal file → Executable file
View file

@ -14,27 +14,25 @@ Logger.info("====================") # Seperate old from new log
Logger.info("nzbToHeadPhones %s", VERSION)
# SABnzbd
if len(sys.argv) == 8:
# SABnzbd 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
if len(sys.argv) == SABNZB_NO_OF_ARGUMENTS:
# SABnzbd 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
Logger.info("Script triggered from SABnzbd, starting autoProcessMusic...")
result = autoProcessMusic.process(sys.argv[1], sys.argv[2], sys.argv[7])
# NZBGet
elif len(sys.argv) == 4:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
Logger.info("Script triggered from NZBGet, starting autoProcessMusic...")
result = autoProcessMusic.process(sys.argv[1], sys.argv[2], sys.argv[3])
else:
Logger.warn("Invalid number of arguments received from client.")
Logger.info("Running autoProcessMusic as a manual run...")

View file

@ -1 +1,10 @@
# Make things easy and less error prone by centralising all common values
# Global Constants
VERSION = 'V6.1'
# Constants pertinant to SabNzb
SABNZB_NO_OF_ARGUMENTS = 8
# Constants pertinant to NzbGet
NZBGET_NO_OF_ARGUMENTS = 4

30
nzbToMylar.py Normal file → Executable file
View file

@ -14,27 +14,25 @@ Logger.info("====================") # Seperate old from new log
Logger.info("nzbToMylar %s", VERSION)
# SABnzbd
if len(sys.argv) == 8:
# SABnzbd 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
if len(sys.argv) == SABNZB_NO_OF_ARGUMENTS:
# SABnzbd 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
Logger.info("Script triggered from SABnzbd, starting autoProcessComics...")
result = autoProcessComics.processEpisode(sys.argv[1], sys.argv[3], sys.argv[7])
# NZBGet
elif len(sys.argv) == 4:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
Logger.info("Script triggered from NZBGet, starting autoProcessComics...")
result = autoProcessComics.processEpisode(sys.argv[1], sys.argv[2], sys.argv[3])
else:
Logger.warn("Invalid number of arguments received from client. Exiting")
sys.exit(-1)

View file

@ -36,27 +36,25 @@ Logger.info("====================") # Seperate old from new log
Logger.info("nzbToSickBeard %s", VERSION)
# SABnzbd
if len(sys.argv) == 8:
# SABnzbd 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
if len(sys.argv) == SABNZB_NO_OF_ARGUMENTS:
# SABnzbd 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
Logger.info("Script triggered from SABnzbd, starting autoProcessTV...")
result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7])
# NZBGet
elif len(sys.argv) == 4:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 The status of the download: 0 == successful
Logger.info("Script triggered from NZBGet, starting autoProcessTV...")
result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[3])
else:
Logger.debug("Invalid number of arguments received from client.")
Logger.info("Running autoProcessTV as a manual run...")