diff options
author | morpheus65535 <[email protected]> | 2018-09-22 18:07:46 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2018-09-22 18:07:46 -0400 |
commit | 54329b0d2bd6f1e2f909994be4382c9f2aed20ac (patch) | |
tree | 0b03111ab3bd95abf38233245467fc31fe6cc79b /bazarr.py | |
parent | d4cd75b0fb6f9bb653d66d60d869e1db55b74fcc (diff) | |
download | bazarr-54329b0d2bd6f1e2f909994be4382c9f2aed20ac.tar.gz bazarr-54329b0d2bd6f1e2f909994be4382c9f2aed20ac.zip |
Fix for providers auth not used
Diffstat (limited to 'bazarr.py')
-rw-r--r-- | bazarr.py | 129 |
1 files changed, 14 insertions, 115 deletions
@@ -85,7 +85,8 @@ import hashlib import time from get_languages import load_language_in_db, language_from_alpha3 -from get_providers import * +from get_providers import load_providers, get_providers, get_providers_auth +load_providers() from get_series import * from get_episodes import * @@ -1473,28 +1474,8 @@ def get_subtitle(): sonarrEpisodeId = request.forms.get('sonarrEpisodeId') # tvdbid = request.forms.get('tvdbid') - db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) - c = db.cursor() - c.execute("SELECT * FROM table_settings_providers WHERE enabled = 1") - enabled_providers = c.fetchall() - c.close() - - providers_list = [] - providers_auth = {} - if len(enabled_providers) > 0: - for provider in enabled_providers: - providers_list.append(provider[0]) - try: - if provider[2] is not '' and provider[3] is not '': - provider_auth = providers_auth.append(provider[0]) - provider_auth.update({'username':providers[2], 'password':providers[3]}) - else: - providers_auth = None - except: - providers_auth = None - else: - providers_list = None - providers_auth = None + providers_list = get_providers() + providers_auth = get_providers_auth() try: result = download_subtitle(episodePath, language, hi, providers_list, providers_auth, sceneName, 'series') @@ -1518,28 +1499,8 @@ def manual_search_json(): language = request.forms.get('language') hi = request.forms.get('hi') - db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) - c = db.cursor() - c.execute("SELECT * FROM table_settings_providers WHERE enabled = 1") - enabled_providers = c.fetchall() - c.close() - - providers_list = [] - providers_auth = {} - if len(enabled_providers) > 0: - for provider in enabled_providers: - providers_list.append(provider[0]) - try: - if provider[2] is not '' and provider[3] is not '': - provider_auth = providers_auth.append(provider[0]) - provider_auth.update({'username':providers[2], 'password':providers[3]}) - else: - providers_auth = None - except: - providers_auth = None - else: - providers_list = None - providers_auth = None + providers_list = get_providers() + providers_auth = get_providers_auth() data = manual_search(episodePath, language, hi, providers_list, providers_auth, sceneName, 'series') return dict(data=data) @@ -1559,19 +1520,8 @@ def manual_get_subtitle(): sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) - c = db.cursor() - provider = c.execute("SELECT * FROM table_settings_providers WHERE name = ?",(selected_provider,)).fetchone() - c.close() - providers_auth = {} - try: - if provider[2] is not '' and provider[3] is not '': - provider_auth = providers_auth.append(provider[0]) - provider_auth.update({'username':providers[2], 'password':providers[3]}) - else: - providers_auth = None - except: - providers_auth = None + providers_list = get_providers() + providers_auth = get_providers_auth() try: result = manual_download_subtitle(episodePath, language, hi, subtitle, selected_provider, providers_auth, sceneName, 'series') @@ -1597,28 +1547,8 @@ def get_subtitle_movie(): radarrId = request.forms.get('radarrId') # tmdbid = request.forms.get('tmdbid') - db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) - c = db.cursor() - c.execute("SELECT * FROM table_settings_providers WHERE enabled = 1") - enabled_providers = c.fetchall() - c.close() - - providers_list = [] - providers_auth = {} - if len(enabled_providers) > 0: - for provider in enabled_providers: - providers_list.append(provider[0]) - try: - if provider[2] is not '' and provider[3] is not '': - provider_auth = providers_auth.append(provider[0]) - provider_auth.update({'username':providers[2], 'password':providers[3]}) - else: - providers_auth = None - except: - providers_auth = None - else: - providers_list = None - providers_auth = None + providers_list = get_providers() + providers_auth = get_providers_auth() try: result = download_subtitle(moviePath, language, hi, providers_list, providers_auth, sceneName, 'movie') @@ -1642,28 +1572,8 @@ def manual_search_movie_json(): language = request.forms.get('language') hi = request.forms.get('hi') - db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) - c = db.cursor() - c.execute("SELECT * FROM table_settings_providers WHERE enabled = 1") - enabled_providers = c.fetchall() - c.close() - - providers_list = [] - providers_auth = {} - if len(enabled_providers) > 0: - for provider in enabled_providers: - providers_list.append(provider[0]) - try: - if provider[2] is not '' and provider[3] is not '': - provider_auth = providers_auth.append(provider[0]) - provider_auth.update({'username':providers[2], 'password':providers[3]}) - else: - providers_auth = None - except: - providers_auth = None - else: - providers_list = None - providers_auth = None + providers_list = get_providers() + providers_auth = get_providers_auth() data = manual_search(moviePath, language, hi, providers_list, providers_auth, sceneName, 'movie') return dict(data=data) @@ -1682,19 +1592,8 @@ def manual_get_subtitle_movie(): subtitle = request.forms.get('subtitle') radarrId = request.forms.get('radarrId') - db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30) - c = db.cursor() - provider = c.execute("SELECT * FROM table_settings_providers WHERE name = ?",(selected_provider,)).fetchone() - c.close() - providers_auth = {} - try: - if provider[2] is not '' and provider[3] is not '': - provider_auth = providers_auth.append(provider[0]) - provider_auth.update({'username':providers[2], 'password':providers[3]}) - else: - providers_auth = None - except: - providers_auth = None + providers_list = get_providers() + providers_auth = get_providers_auth() try: result = manual_download_subtitle(moviePath, language, hi, subtitle, selected_provider, providers_auth, sceneName, 'movie') |