diff options
author | morpheus65535 <[email protected]> | 2021-06-07 09:14:10 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2021-06-07 09:14:10 -0400 |
commit | ea63ecfc2b0d9a1c657a8ee6ed7edc6c7b04af74 (patch) | |
tree | f2088f6488f27032629ae232741722fb8c22d12c | |
parent | 4ebcd49546ed7772cb6f3a9c83079e5aea08e15a (diff) | |
download | bazarr-ea63ecfc2b0d9a1c657a8ee6ed7edc6c7b04af74.tar.gz bazarr-ea63ecfc2b0d9a1c657a8ee6ed7edc6c7b04af74.zip |
Fixed importation of standard languages issue introduced in beta.19
-rw-r--r-- | bazarr/get_languages.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bazarr/get_languages.py b/bazarr/get_languages.py index 7aefae41c..a3abf7deb 100644 --- a/bazarr/get_languages.py +++ b/bazarr/get_languages.py @@ -12,20 +12,28 @@ def load_language_in_db(): langs = [[lang.alpha_3, lang.alpha_2, lang.name] for lang in pycountry.languages if hasattr(lang, 'alpha_2')] - - # Insert languages in database table - CustomLanguage.register(TableSettingsLanguages) + # Insert standard languages in database table + TableSettingsLanguages.insert_many(langs, + fields=[TableSettingsLanguages.code3, TableSettingsLanguages.code2, + TableSettingsLanguages.name]) \ + .on_conflict(action='IGNORE') \ + .execute() + + # Update standard languages with code3b if available langs = [[lang.bibliographic, lang.alpha_3] for lang in pycountry.languages if hasattr(lang, 'alpha_2') and hasattr(lang, 'bibliographic')] - + # Update languages in database table for lang in langs: TableSettingsLanguages.update({TableSettingsLanguages.code3b: lang[0]}) \ .where(TableSettingsLanguages.code3 == lang[1]) \ .execute() + # Insert custom languages in database table + CustomLanguage.register(TableSettingsLanguages) + # Create languages dictionary for faster conversion than calling database create_languages_dict() |