mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-22 07:42:32 +00:00
23 lines
494 B
Python
23 lines
494 B
Python
import os.path
|
|
import sqlite3
|
|
|
|
# Check if database exist
|
|
if os.path.exists('bazarr.db') == True:
|
|
pass
|
|
else:
|
|
# Get SQL script from file
|
|
fd = open('create_db.sql', 'r')
|
|
script = fd.read()
|
|
|
|
# Open database connection
|
|
db = sqlite3.connect('bazarr.db')
|
|
c = db.cursor()
|
|
|
|
# Execute script and commit change to database
|
|
c.executescript(script)
|
|
|
|
# Close database connection
|
|
db.close()
|
|
|
|
# Close SQL script file
|
|
fd.close()
|