From b32ef3b7831260e67a57f2b3f7f80eac5e3b2e42 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sat, 13 Feb 2021 17:21:54 -0500 Subject: [PATCH] Fix for default profiles migration. --- bazarr/database.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/bazarr/database.py b/bazarr/database.py index 26b28f3b8..392dd4f37 100644 --- a/bazarr/database.py +++ b/bazarr/database.py @@ -169,22 +169,28 @@ def db_upgrade(): if not lang_table_exist: series_default = [] - for language in ast.literal_eval(settings.general.serie_default_language): - if settings.general.serie_default_forced == 'Both': - series_default.append([language, 'True', settings.general.serie_default_hi]) - series_default.append([language, 'False', settings.general.serie_default_hi]) - else: - series_default.append([language, settings.general.serie_default_forced, - settings.general.serie_default_hi]) + try: + for language in ast.literal_eval(settings.general.serie_default_language): + if settings.general.serie_default_forced == 'Both': + series_default.append([language, 'True', settings.general.serie_default_hi]) + series_default.append([language, 'False', settings.general.serie_default_hi]) + else: + series_default.append([language, settings.general.serie_default_forced, + settings.general.serie_default_hi]) + except ValueError: + pass movies_default = [] - for language in ast.literal_eval(settings.general.movie_default_language): - if settings.general.movie_default_forced == 'Both': - movies_default.append([language, 'True', settings.general.movie_default_hi]) - movies_default.append([language, 'False', settings.general.movie_default_hi]) - else: - movies_default.append([language, settings.general.movie_default_forced, - settings.general.movie_default_hi]) + try: + for language in ast.literal_eval(settings.general.movie_default_language): + if settings.general.movie_default_forced == 'Both': + movies_default.append([language, 'True', settings.general.movie_default_hi]) + movies_default.append([language, 'False', settings.general.movie_default_hi]) + else: + movies_default.append([language, settings.general.movie_default_forced, + settings.general.movie_default_hi]) + except ValueError: + pass profiles_to_create = database.execute("SELECT DISTINCT languages, hearing_impaired, forced " "FROM (SELECT languages, hearing_impaired, forced FROM table_shows "