mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-22 09:33:37 +00:00
Merge pull request #1048 from JackDandy/feature/FixWebDLTypesLoad
Fix load web dl types from db if url fetching fails.
This commit is contained in:
commit
716b0a8131
4 changed files with 24 additions and 10 deletions
|
@ -18,6 +18,8 @@
|
||||||
* Fix Events shutdown (a manual start-up is required after updating to this fix)
|
* Fix Events shutdown (a manual start-up is required after updating to this fix)
|
||||||
* Add 'PB', 'EB', 'ZB', 'YB' to output size formats
|
* Add 'PB', 'EB', 'ZB', 'YB' to output size formats
|
||||||
* Fix save option display freespace
|
* 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)
|
### 0.13.15 (2018-01-26 10:30:00 UTC)
|
||||||
|
|
|
@ -69,18 +69,21 @@
|
||||||
<p>No current failures. Failure stats display here when appropriate.</p>
|
<p>No current failures. Failure stats display here when appropriate.</p>
|
||||||
#else
|
#else
|
||||||
<p>Some providers can be often down over periods, SickGear will back off then retry connecting at a later time</p>
|
<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
|
#for $prov in $provider_fail_stats
|
||||||
#if $len($prov['fails'])
|
#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['active']
|
||||||
#if $prov['next_try']
|
#if $prov['next_try']
|
||||||
#set nt = $str($prov['next_try']).split('.', 2)
|
#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
|
#end if
|
||||||
#else
|
#else
|
||||||
... is not enabled
|
... is not enabled
|
||||||
#end if
|
#end if
|
||||||
|
</div>
|
||||||
<table class="manageTable provider-failures tablesorter hover-highlight focus-highlight text-center" cellspacing="0" border="0" cellpadding="0">
|
<table class="manageTable provider-failures tablesorter hover-highlight focus-highlight text-center" cellspacing="0" border="0" cellpadding="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -129,6 +132,7 @@
|
||||||
#end for
|
#end for
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<!-- /$prov['name'] -->
|
||||||
#end if
|
#end if
|
||||||
#end for
|
#end for
|
||||||
#end if
|
#end if
|
||||||
|
|
|
@ -21,12 +21,16 @@ $(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.shows-less').click(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).hide();
|
||||||
$(this).prevAll('input:first').show();
|
$(this).prevAll('input:first').show();
|
||||||
});
|
});
|
||||||
$('.shows-more').click(function(){
|
$('.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).hide();
|
||||||
$(this).nextAll('input:first').show();
|
$(this).nextAll('input:first').show();
|
||||||
});
|
});
|
||||||
|
|
|
@ -142,7 +142,12 @@ def load_webdl_types():
|
||||||
default_types = [('Amazon', r'AMZN|AMAZON'), ('Netflix', r'NETFLIX|NF'), ('Hulu', r'HULU')]
|
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 = 'https://raw.githubusercontent.com/SickGear/sickgear.extdata/master/SickGear/webdl_types.txt'
|
||||||
url_data = helpers.getURL(url)
|
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:
|
try:
|
||||||
for line in url_data.splitlines():
|
for line in url_data.splitlines():
|
||||||
try:
|
try:
|
||||||
|
@ -155,9 +160,6 @@ def load_webdl_types():
|
||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
pass
|
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 = []
|
cl = []
|
||||||
for nt in new_types:
|
for nt in new_types:
|
||||||
if nt not in old_types:
|
if nt not in old_types:
|
||||||
|
@ -169,6 +171,8 @@ def load_webdl_types():
|
||||||
|
|
||||||
if cl:
|
if cl:
|
||||||
my_db.mass_action(cl)
|
my_db.mass_action(cl)
|
||||||
|
else:
|
||||||
|
new_types = old_types
|
||||||
|
|
||||||
sickbeard.WEBDL_TYPES = new_types + default_types
|
sickbeard.WEBDL_TYPES = new_types + default_types
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue