diff --git a/nzbToCouchPotato.py b/nzbToCouchPotato.py index e33575cf..c2a868eb 100755 --- a/nzbToCouchPotato.py +++ b/nzbToCouchPotato.py @@ -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) diff --git a/nzbToGamez b/nzbToGamez.py old mode 100644 new mode 100755 similarity index 53% rename from nzbToGamez rename to nzbToGamez.py index 7c2ce787..098c58f5 --- a/nzbToGamez +++ b/nzbToGamez.py @@ -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) diff --git a/nzbToHeadPhones.py b/nzbToHeadPhones.py old mode 100644 new mode 100755 index dc3acd74..47e3a9ac --- a/nzbToHeadPhones.py +++ b/nzbToHeadPhones.py @@ -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...") diff --git a/nzbToMediaEnv.py b/nzbToMediaEnv.py index 3ac8fb9e..7c1b7768 100644 --- a/nzbToMediaEnv.py +++ b/nzbToMediaEnv.py @@ -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 diff --git a/nzbToMylar.py b/nzbToMylar.py old mode 100644 new mode 100755 index e21b2e60..63acc93b --- a/nzbToMylar.py +++ b/nzbToMylar.py @@ -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) diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index ce6bf683..0493b8d5 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -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...")