further requests status checks. fixes #348 #351

This commit is contained in:
clinton-hall 2014-04-29 13:53:40 +09:30
commit 00ca156564
5 changed files with 28 additions and 9 deletions

View file

@ -54,5 +54,8 @@ class autoProcessComics:
for line in r.iter_lines(): for line in r.iter_lines():
if line: logger.postprocess("%s" % (line), section) if line: logger.postprocess("%s" % (line), section)
time.sleep(60) #wait 1 minute for now... need to see just what gets logged and how long it takes to process if not r.status_code == requests.codes.ok:
return 0 # Success logger.error("Server returned status %s" % (str(r.status_code)), section)
return 1
else:
return 0

View file

@ -55,7 +55,10 @@ class autoProcessGames:
result = r.json() result = r.json()
logger.postprocess("%s" % (result),section) logger.postprocess("%s" % (result),section)
if result['success']: if not r.status_code == requests.codes.ok:
logger.error("Server returned status %s" % (str(r.status_code)), section)
return 1
elif result['success']:
logger.postprocess("SUCCESS: Status for %s has been set to %s in Gamez" % (gamezID, downloadStatus),section) logger.postprocess("SUCCESS: Status for %s has been set to %s in Gamez" % (gamezID, downloadStatus),section)
return 0 # Success return 0 # Success
else: else:

View file

@ -180,7 +180,10 @@ class autoProcessMovie:
return 1 # failure return 1 # failure
result = r.json() result = r.json()
if result['success']: if not r.status_code == requests.codes.ok:
logger.error("Server returned status %s" % (str(r.status_code)), section)
return 1
elif result['success']:
logger.postprocess("SUCCESS: Finished %s scan for folder %s" % (method, dirName), section) logger.postprocess("SUCCESS: Finished %s scan for folder %s" % (method, dirName), section)
else: else:
logger.error("FAILED: %s scan was unable to finish for folder %s. exiting!" % (method, dirName), logger.error("FAILED: %s scan was unable to finish for folder %s. exiting!" % (method, dirName),
@ -233,7 +236,10 @@ class autoProcessMovie:
return 1 # failure return 1 # failure
result = r.json() result = r.json()
if result['success']: if not r.status_code == requests.codes.ok:
logger.error("Server returned status %s" % (str(r.status_code)), section)
return 1
elif result['success']:
logger.postprocess("SUCCESS: Snatched the next highest release ...", section) logger.postprocess("SUCCESS: Snatched the next highest release ...", section)
return 0 return 0
else: else:

View file

@ -84,7 +84,11 @@ class autoProcessMusic:
return 1 # failure return 1 # failure
logger.debug("Result: %s" % (r.text),section) logger.debug("Result: %s" % (r.text),section)
if r.text == "OK":
if not r.status_code == requests.codes.ok:
logger.error("Server returned status %s" % (str(r.status_code)), section)
return 1
elif r.text == "OK":
logger.postprocess("SUCCESS: Post-Processing started for %s in folder %s ..." % (inputName, dirName),section) logger.postprocess("SUCCESS: Post-Processing started for %s in folder %s ..." % (inputName, dirName),section)
else: else:
logger.error("FAILED: Post-Processing has NOT started for %s in folder %s. exiting!" % (inputName, dirName),section) logger.error("FAILED: Post-Processing has NOT started for %s in folder %s. exiting!" % (inputName, dirName),section)

View file

@ -158,7 +158,10 @@ class autoProcessTV:
logger.postprocess("Deleting failed files and folder %s" % (dirName),section) logger.postprocess("Deleting failed files and folder %s" % (dirName),section)
rmDir(dirName) rmDir(dirName)
if Success: if not r.status_code == requests.codes.ok:
logger.error("Server returned status %s" % (str(r.status_code)), section)
return 1
elif Success:
return 0 return 0
else: else:
return 1 return 1 # We did not receive Success confirmation.