blob: b48fa49317de4cc6054ef7f07893bb2822bb1522 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import sqlite3
import pycountry
# Get languages list in langs tuple
langs = [[lang.alpha_3,lang.alpha_2,lang.name]
for lang in pycountry.languages
if hasattr(lang, 'alpha_2')]
# Open database connection
db = sqlite3.connect('bazarr.db')
c = db.cursor()
# Insert languages in database table
c.executemany('''INSERT OR IGNORE INTO table_settings_languages(code3, code2, name) VALUES(?, ?, ?)''', langs)
# Commit changes to database table
db.commit()
# Close database connection
db.close()
|