From 9562b47794dc84541792ac37191f13ba973f9a27 Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Wed, 27 Feb 2013 18:31:38 -0800 Subject: [PATCH] logging --- nzbToCouchPotato.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nzbToCouchPotato.py b/nzbToCouchPotato.py index d9bcd664..5b817580 100755 --- a/nzbToCouchPotato.py +++ b/nzbToCouchPotato.py @@ -1,11 +1,16 @@ #!/usr/bin/env python import sys +import logging + import autoProcessMovie - from nzbToMediaEnv import * +from nzbToMediaUtil import * -print "nzbToCouchPotato %s" % VERSION +nzbtomedia_configure_logging(os.path.dirname(sys.argv[0])) +Logger = logging.getLogger(__name__) + +Logger.info("nzbToCouchPotato %s", VERSION) # SABnzbd if len(sys.argv) == 8: @@ -17,7 +22,7 @@ if len(sys.argv) == 8: # 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..." + Logger.info("Script triggered from SABnzbd, starting autoProcessMovie...") autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7]) # NZBGet @@ -26,11 +31,11 @@ elif len(sys.argv) == 4: # 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 - print "Script triggered from NZBGet, starting autoProcessMovie..." + Logger.info("Script triggered from NZBGet, starting autoProcessMovie...") autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[3]) else: - print "Invalid number of arguments received from client." - print "Running autoProcessMovie as a manual run..." + Logger.debug("Invalid number of arguments received from client.") + Logger.info("Running autoProcessMovie as a manual run...") autoProcessMovie.process('Manual Run', 'Manual Run', 0)