diff --git a/core/auto_process/movies.py b/core/auto_process/movies.py index 6535cddd..32e93595 100644 --- a/core/auto_process/movies.py +++ b/core/auto_process/movies.py @@ -548,21 +548,27 @@ def get_release(base_url, imdb_id=None, download_id=None, release_id=None): # Narrow results by removing old releases by comparing their last_edit field if len(results) > 1: + rem_id = [] for id1, x1 in results.items(): for x2 in results.values(): try: if x2['last_edit'] > x1['last_edit']: - results.pop(id1) + rem_id.append(id1) except Exception: continue + for id in rem_id: + results.pop(id) # Search downloads on clients for a match to try and narrow our results down to 1 if len(results) > 1: + rem_id = [] for cur_id, x in results.items(): try: if not find_download(str(x['download_info']['downloader']).lower(), x['download_info']['id']): - results.pop(cur_id) + rem_id.append(cur_id) except Exception: continue + for id in rem_id: + results.pop(id) return results