From 0a954e5a927026f8e1e9527ec8c18e16c57583ce Mon Sep 17 00:00:00 2001 From: panni Date: Wed, 27 Feb 2019 22:07:20 +0100 Subject: [PATCH] get_languages: add get_languages function --- bazarr/get_languages.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bazarr/get_languages.py b/bazarr/get_languages.py index c76ddefc7..7dc281bb7 100644 --- a/bazarr/get_languages.py +++ b/bazarr/get_languages.py @@ -108,5 +108,12 @@ def alpha3_from_language(lang): return result +def get_languages(kind="code2"): + db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) + c = db.cursor() + c.execute('''SELECT ?, name FROM table_settings_languages WHERE enabled = 1''', (kind,)) + return c.fetchall() + + if __name__ == '__main__': load_language_in_db()