Don't loop over releases when download doesn't support check snatched. fix #887

This commit is contained in:
Ruud committed 2012-09-30 15:56:51 +02:00
1 parent ce0bf7b51a
commit 9184a97fcd
1 file changed
+43 -43
+43 -43
View File
@@ -521,61 +521,61 @@ class Renamer(Plugin):
if not statuses: if not statuses:
log.debug('Download status functionality is not implemented for active downloaders.') log.debug('Download status functionality is not implemented for active downloaders.')
scan_required = True scan_required = True
else:
try:
for rel in rels:
rel_dict = rel.to_dict({'info': {}})
try: # Get current selected title
for rel in rels: default_title = getTitle(rel.movie.library)
rel_dict = rel.to_dict({'info': {}})
# Get current selected title # Check if movie has already completed and is manage tab (legacy db correction)
default_title = getTitle(rel.movie.library) if rel.movie.status_id == done_status.get('id'):
log.debug('Found a completed movie with a snatched release : %s. Setting release status to ignored...' , default_title)
rel.status_id = ignored_status.get('id')
db.commit()
continue
# Check if movie has already completed and is manage tab (legacy db correction) movie_dict = fireEvent('movie.get', rel.movie_id, single = True)
if rel.movie.status_id == done_status.get('id'):
log.debug('Found a completed movie with a snatched release : %s. Setting release status to ignored...' , default_title)
rel.status_id = ignored_status.get('id')
db.commit()
continue
movie_dict = fireEvent('movie.get', rel.movie_id, single = True) # check status
nzbname = self.createNzbName(rel_dict['info'], movie_dict)
# check status found = False
nzbname = self.createNzbName(rel_dict['info'], movie_dict) for item in statuses:
if item['name'] == nzbname:
found = False timeleft = 'N/A' if item['timeleft'] == -1 else item['timeleft']
for item in statuses: log.debug('Found %s: %s, time to go: %s', (item['name'], item['status'].upper(), timeleft))
if item['name'] == nzbname:
timeleft = 'N/A' if item['timeleft'] == -1 else item['timeleft'] if item['status'] == 'busy':
log.debug('Found %s: %s, time to go: %s', (item['name'], item['status'].upper(), timeleft)) pass
elif item['status'] == 'failed':
if item['delete']:
fireEvent('download.remove_failed', item, single = True)
if item['status'] == 'busy': if self.conf('next_on_failed'):
pass fireEvent('searcher.try_next_release', movie_id = rel.movie_id)
elif item['status'] == 'failed': else:
if item['delete']: rel.status_id = failed_status.get('id')
fireEvent('download.remove_failed', item, single = True) db.commit()
elif item['status'] == 'completed':
log.info('Download of %s completed!', item['name'])
scan_required = True
if self.conf('next_on_failed'): found = True
fireEvent('searcher.try_next_release', movie_id = rel.movie_id) break
else:
rel.status_id = failed_status.get('id')
db.commit()
elif item['status'] == 'completed':
log.info('Download of %s completed!', item['name'])
scan_required = True
found = True if not found:
break log.info('%s not found in downloaders', nzbname)
rel.status_id = ignored_status.get('id')
db.commit()
if not found: if self.conf('next_on_failed'):
log.info('%s not found in downloaders', nzbname) fireEvent('searcher.try_next_release', movie_id = rel.movie_id)
rel.status_id = ignored_status.get('id')
db.commit()
if self.conf('next_on_failed'): except:
fireEvent('searcher.try_next_release', movie_id = rel.movie_id) log.error('Failed checking for release in downloader: %s', traceback.format_exc())
except:
log.error('Failed checking for release in downloader: %s', traceback.format_exc())
if scan_required: if scan_required:
fireEvent('renamer.scan') fireEvent('renamer.scan')