mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-12 08:54:41 +08:00
Remove unsupported providers
This commit is contained in:
parent
7b341d1219
commit
283494c121
1 changed files with 9 additions and 0 deletions
|
@ -9,6 +9,15 @@ providers_list = sorted(provider_manager.names())
|
|||
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||
c = db.cursor()
|
||||
|
||||
# Remove unsupported providers
|
||||
providers_in_db = c.execute('SELECT name FROM table_settings_providers').fetchall()
|
||||
for provider_in_db in providers_in_db:
|
||||
if provider_in_db[0] not in providers_list:
|
||||
c.execute('DELETE FROM table_settings_providers WHERE name = ?', (provider_in_db[0], ))
|
||||
|
||||
# Commit changes to database table
|
||||
db.commit()
|
||||
|
||||
# Insert providers in database table
|
||||
for provider_name in providers_list:
|
||||
c.execute('''INSERT OR IGNORE INTO table_settings_providers(name) VALUES(?)''', (provider_name, ))
|
||||
|
|
Loading…
Reference in a new issue