1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00

Updates to close the database connection in all cases (#191)

This commit is contained in:
Trenton Holmes 2018-10-15 16:52:28 -07:00 committed by morpheus65535
parent 54b2c06a37
commit 05fb7088f8

View file

@ -31,7 +31,7 @@ def language_from_alpha2(lang):
result = c.execute('''SELECT name FROM table_settings_languages WHERE code2 = ?''', (lang,)).fetchone()[0]
except:
result = None
db.close
db.close()
return result
def language_from_alpha3(lang):
@ -43,7 +43,7 @@ def language_from_alpha3(lang):
result = c.execute('''SELECT name FROM table_settings_languages WHERE code3 = ?''', (lang,)).fetchone()[0]
except:
result = None
db.close
db.close()
return result
def alpha2_from_alpha3(lang):
@ -55,7 +55,7 @@ def alpha2_from_alpha3(lang):
result = c.execute('''SELECT code2 FROM table_settings_languages WHERE code3 = ?''', (lang,)).fetchone()[0]
except:
result = None
db.close
db.close()
return result
def alpha2_from_language(lang):
@ -65,7 +65,7 @@ def alpha2_from_language(lang):
result = c.execute('''SELECT code2 FROM table_settings_languages WHERE name = ?''', (lang,)).fetchone()[0]
except:
result = None
db.close
db.close()
return result
def alpha3_from_alpha2(lang):
@ -75,7 +75,7 @@ def alpha3_from_alpha2(lang):
result = c.execute('''SELECT code3 FROM table_settings_languages WHERE code2 = ?''', (lang,)).fetchone()[0]
except:
result = None
db.close
db.close()
return result
def alpha3_from_language(lang):
@ -85,8 +85,8 @@ def alpha3_from_language(lang):
result = c.execute('''SELECT code3 FROM table_settings_languages WHERE name = ?''', (lang,)).fetchone()[0]
except:
result = None
db.close
db.close()
return result
if __name__ == '__main__':
load_language_in_db()
load_language_in_db()