bazarr/get_providers.py

24 lines
589 B
Python
Raw Normal View History

2017-11-21 20:42:18 +00:00
# coding: utf-8
from __future__ import unicode_literals
2017-09-19 10:43:14 +00:00
import sqlite3
2017-10-20 12:59:21 +00:00
import os
2017-09-19 10:43:14 +00:00
from subliminal import *
# Get providers list from subliminal
providers_list = sorted(provider_manager.names())
# Open database connection
2017-10-20 12:59:21 +00:00
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
2017-09-19 10:43:14 +00:00
c = db.cursor()
# Insert providers in database table
for provider_name in providers_list:
c.execute('''INSERT OR IGNORE INTO table_settings_providers(name) VALUES(?)''', (provider_name, ))
# Commit changes to database table
db.commit()
# Close database connection
db.close()