diff --git a/list_subtitles.py b/list_subtitles.py index 52b9675f2..b222ecbc8 100644 --- a/list_subtitles.py +++ b/list_subtitles.py @@ -81,17 +81,17 @@ def list_missing_subtitles(*no): actual_subtitles = [] desired_subtitles = [] missing_subtitles = [] - actual_subtitles_list = [] if episode_subtitles[1] != None: actual_subtitles = ast.literal_eval(episode_subtitles[1]) - if episode_subtitles[2] != None: - desired_subtitles = ast.literal_eval(episode_subtitles[2]) - for item in actual_subtitles: - actual_subtitles_list.append(item[0]) - missing_subtitles = list(set(desired_subtitles) - set(actual_subtitles_list)) - else: - missing_subtitles_global.append(tuple(['[]', episode_subtitles[0]])) - missing_subtitles_global.append(tuple([str(missing_subtitles), episode_subtitles[0]])) + desired_subtitles = ast.literal_eval(episode_subtitles[2]) + actual_subtitles_list = [] + if desired_subtitles == None: + missing_subtitles_global.append(tuple(['[]', episode_subtitles[0]])) + else: + for item in actual_subtitles: + actual_subtitles_list.append(item[0]) + missing_subtitles = list(set(desired_subtitles) - set(actual_subtitles_list)) + missing_subtitles_global.append(tuple([str(missing_subtitles), episode_subtitles[0]])) c_db.executemany("UPDATE table_episodes SET missing_subtitles = ? WHERE sonarrEpisodeId = ?", (missing_subtitles_global))