Merge pull request #1048 from JackDandy/feature/FixWebDLTypesLoad

Fix load web dl types from db if url fetching fails.
This commit is contained in:
JackDandy 2018-01-27 19:51:09 +00:00 committed by GitHub
commit 716b0a8131
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 10 deletions

View file

@ -18,6 +18,8 @@
* Fix Events shutdown (a manual start-up is required after updating to this fix)
* Add 'PB', 'EB', 'ZB', 'YB' to output size formats
* Fix save option display freespace
* Fix load web dl types from db if url fetching fails
* Change ManageSearches layout between collapsed Provider Failures tables from single to multi line
### 0.13.15 (2018-01-26 10:30:00 UTC)

View file

@ -69,18 +69,21 @@
<p>No current failures. Failure stats display here when appropriate.</p>
#else
<p>Some providers can be often down over periods, SickGear will back off then retry connecting at a later time</p>
#for $prov in $provider_fail_stats
#if $len($prov['fails'])
<input type="button" class="shows-more btn" id="$prov['name']-btn-more" value="Expand" style="display:none"><input type="button" class="shows-less btn" id="$prov['name']-btn-less" value="Collapse"><img src="$sbRoot/images/providers/$prov['prov_img']" width="16" height="16" style="margin:0 6px" />$prov['name']
<!-- $prov['name'] -->
<div>
<input type="button" class="shows-more btn" value="Expand" style="display:none"><input type="button" class="shows-less btn" value="Collapse"><img src="$sbRoot/images/providers/$prov['prov_img']" width="16" height="16" style="margin:0 6px 0 3px">$prov['name']
#if $prov['active']
#if $prov['next_try']
#set nt = $str($prov['next_try']).split('.', 2)
... is blocked until $sbdatetime.sbdatetime.sbftime($sbdatetime.sbdatetime.now() + $prov['next_try'], markup=True) (in $nt[0]) <input type="button" class="provider-retry btn" id="$prov['prov_id']-btn-retry" value="Ignore block on next search">
... is blocked until $sbdatetime.sbdatetime.sbftime($sbdatetime.sbdatetime.now() + $prov['next_try'], markup=True) (in $nt[0]) <input type="button" class="provider-retry btn" id="$prov['prov_id']-btn-retry" value="Ignore block on next search">
#end if
#else
... is not enabled
... is not enabled
#end if
</div>
<table class="manageTable provider-failures tablesorter hover-highlight focus-highlight text-center" cellspacing="0" border="0" cellpadding="0">
<thead>
<tr>
@ -129,6 +132,7 @@
#end for
</tbody>
</table>
<!-- /$prov['name'] -->
#end if
#end for
#end if

View file

@ -21,12 +21,16 @@ $(function(){
});
$('.shows-less').click(function(){
$(this).nextAll('table:first').hide();
var table$ = $(this).nextAll('table:first');
table$ = table$.length ? table$ : $(this).parent().nextAll('table:first');
table$.hide();
$(this).hide();
$(this).prevAll('input:first').show();
});
$('.shows-more').click(function(){
$(this).nextAll('table:first').show();
var table$ = $(this).nextAll('table:first');
table$ = table$.length ? table$ : $(this).parent().nextAll('table:first');
table$.show();
$(this).hide();
$(this).nextAll('input:first').show();
});

View file

@ -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