Fix #1071: IndexError when unable to get download info

This commit is contained in:
labrys 2016-06-21 23:47:49 -04:00
commit a2247345d4

View file

@ -745,21 +745,22 @@ def main(args, section=None):
if not core.CFG[section][subsection].isenabled(): if not core.CFG[section][subsection].isenabled():
continue continue
for dirName in getDirs(section, subsection, link='move'): for dirName in getDirs(section, subsection, link='move'):
logger.info("Starting manual run for {0}:{1} - Folder:{2}".format(section, subsection, dirName)) logger.info("Starting manual run for {0}:{1} - Folder: {2}".format(section, subsection, dirName))
logger.info("Checking database for download info for {0} ...".format(os.path.basename(dirName))) logger.info("Checking database for download info for {0} ...".format(os.path.basename(dirName)))
core.DOWNLOADINFO = get_downloadInfo(os.path.basename(dirName), 0) core.DOWNLOADINFO = get_downloadInfo(os.path.basename(dirName), 0)
if core.DOWNLOADINFO: if core.DOWNLOADINFO:
logger.info( logger.info("Found download info for {0}, "
"Found download info for {0}, setting variables now ...".format(os.path.basename(dirName))) "setting variables now ...".format
(os.path.basename(dirName)))
clientAgent = text_type(core.DOWNLOADINFO[0].get('client_agent', ''))
download_id = text_type(core.DOWNLOADINFO[0].get('input_id', ''))
else: else:
logger.info( logger.info('Unable to locate download info for {0}, '
'Unable to locate download info for {0}, continuing to try and process this release ...'.format( 'continuing to try and process this release ...'.format
os.path.basename(dirName)) (os.path.basename(dirName)))
) clientAgent = ''
download_id = ''
clientAgent = text_type(core.DOWNLOADINFO[0].get('client_agent', ''))
download_id = text_type(core.DOWNLOADINFO[0].get('input_id', ''))
if clientAgent and clientAgent.lower() not in core.NZB_CLIENTS: if clientAgent and clientAgent.lower() not in core.NZB_CLIENTS:
continue continue