fix SABnzbd nzoid find.

This commit is contained in:
clinton-hall 2014-11-06 09:15:21 +10:30
commit 912e639c4f

View file

@ -823,11 +823,15 @@ def get_nzoid(inputName):
except requests.ConnectionError: except requests.ConnectionError:
logger.error("Unable to open URL") logger.error("Unable to open URL")
return nzoid # failure return nzoid # failure
result = r.json() try:
for slot in result['slots']: result = r.json()
if slot['filename'] == inputName: for slot in result['queue']['slots']:
nzoid = slot['nzo_id'] if slot['filename'] == inputName:
break nzoid = slot['nzo_id']
logger.debug("Found nzoid: %s" % nzoid)
break
except:
logger.warning("Data from SABnzbd could not be parsed")
return nzoid return nzoid