mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Fix load web dl types from db if url fetching fails.
This commit is contained in:
parent
233739a58c
commit
dca5bc6856
1 changed files with 8 additions and 4 deletions
|
@ -142,7 +142,12 @@ def load_webdl_types():
|
|||
default_types = [('Amazon', r'AMZN|AMAZON'), ('Netflix', r'NETFLIX|NF'), ('Hulu', r'HULU')]
|
||||
url = 'https://raw.githubusercontent.com/SickGear/sickgear.extdata/master/SickGear/webdl_types.txt'
|
||||
url_data = helpers.getURL(url)
|
||||
if url_data:
|
||||
|
||||
my_db = db.DBConnection()
|
||||
sql_results = my_db.select('SELECT * FROM webdl_types')
|
||||
old_types = [(r['dname'], r['regex']) for r in sql_results]
|
||||
|
||||
if isinstance(url_data, basestring) and url_data.strip():
|
||||
try:
|
||||
for line in url_data.splitlines():
|
||||
try:
|
||||
|
@ -155,9 +160,6 @@ def load_webdl_types():
|
|||
except (IOError, OSError):
|
||||
pass
|
||||
|
||||
my_db = db.DBConnection()
|
||||
sql_results = my_db.select('SELECT * FROM webdl_types')
|
||||
old_types = [(r['dname'], r['regex']) for r in sql_results]
|
||||
cl = []
|
||||
for nt in new_types:
|
||||
if nt not in old_types:
|
||||
|
@ -169,6 +171,8 @@ def load_webdl_types():
|
|||
|
||||
if cl:
|
||||
my_db.mass_action(cl)
|
||||
else:
|
||||
new_types = old_types
|
||||
|
||||
sickbeard.WEBDL_TYPES = new_types + default_types
|
||||
|
||||
|
|
Loading…
Reference in a new issue