summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2021-06-12 09:34:25 -0400
committermorpheus65535 <[email protected]>2021-06-12 09:34:25 -0400
commitbd0a2fe0045f01cfaba9c8c50a33455169cd81ed (patch)
treebb236df5922236bd95a5e285fc8f558891a8ce3b
parentde4ff35e055c0d69c0bfbebb47733792c5196a27 (diff)
downloadbazarr-0.9.6-beta.25.tar.gz
bazarr-0.9.6-beta.25.zip
no log: added some failsafe to language conversion process for erroneous db content (ie.: why do I have a path in language field?!? old stuff...).v0.9.6-beta.25
-rw-r--r--bazarr/api.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/bazarr/api.py b/bazarr/api.py
index fba2b739a..45561962c 100644
--- a/bazarr/api.py
+++ b/bazarr/api.py
@@ -367,14 +367,19 @@ class Languages(Resource):
code2 = language
elif len(language) == 3:
code2 = alpha2_from_alpha3(language)
+ else:
+ continue
if not any(x['code2'] == code2 for x in languages_dicts):
- languages_dicts.append({
- 'code2': code2,
- 'name': language_from_alpha2(code2),
- # Compatibility: Use false temporarily
- 'enabled': False
- })
+ try:
+ languages_dicts.append({
+ 'code2': code2,
+ 'name': language_from_alpha2(code2),
+ # Compatibility: Use false temporarily
+ 'enabled': False
+ })
+ except:
+ continue
return jsonify(sorted(languages_dicts, key=itemgetter('name')))
result = TableSettingsLanguages.select(TableSettingsLanguages.name,