diff --git a/CHANGES.md b/CHANGES.md index 439a6035..a0422a7d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,10 @@ ### 0.17.0 (2018-xx-xx xx:xx:xx UTC) -* Change add "Keep up to x most recent downloads" to Edit Show/Other -* Change add "Keep up to x most recent downloads" to Manage/Bulk Change/Edit +* Add TVDB, TheXem, and GitHub buttons to page History/Layout "Provider fails" that fetches a site Up/Down report +* Add "Keep up to x most recent downloads" to Edit Show/Other +* Add "Keep up to x most recent downloads" to Manage/Bulk Change/Edit * Change append number of downloads to keep to the number of file(s) at Display Show -* Change add "Keep up to x most recent downloads" to add show finally step +* Add "Keep up to x most recent downloads" to add show finally step * Add prune to refreshDir/rescan * Update Tornado Web Server 5.0.1 (35a538f) to 5.0.1 (2b2a220a) * Add HDME torrent provider diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index 3f1b045f..9d5aa02b 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -3282,6 +3282,9 @@ input.get_less_eps{ margin:0 6px 0 0; min-width:70px } +#provider-failures .check-site .btn{ + min-width:115px +} #media-search .btn.shows-more, #media-search .btn.shows-less, #provider-failures .btn.shows-more, @@ -3604,6 +3607,23 @@ img[src=""],img:not([src]){ top:-999px } +.box-green{ + background-color:#68b92b +} +.box-red{ + background-color:#b72828 +} +.box-green, +.box-red{ + color:#eee; + padding:0 10px; + text-align:center; + text-decoration:none; + border-radius:4px 4px 4px 4px; + -moz-border-radius:3px; + -webkit-border-radius:3px +} + /* ======================================================================= bootstrap Overrides ========================================================================== */ diff --git a/gui/slick/images/iidrn.png b/gui/slick/images/iidrn.png new file mode 100644 index 00000000..43e12d02 Binary files /dev/null and b/gui/slick/images/iidrn.png differ diff --git a/gui/slick/interfaces/default/history.tmpl b/gui/slick/interfaces/default/history.tmpl index 3f4f674e..371bd732 100644 --- a/gui/slick/interfaces/default/history.tmpl +++ b/gui/slick/interfaces/default/history.tmpl @@ -589,8 +589,19 @@ ## ##
No current failures. Failure stats display here when appropriate.
+No current provider failures. Failure stats display here when appropriate.
#elseWhen a provider cannot be contacted over a period, SickGear backs off and waits an increasing interval between each retry
#for $prov in $provider_fail_stats @@ -604,7 +615,7 @@ #else #set $prov_class = $prov_class % '' #end if - $prov_class$prov['name'] + $prov_class$prov['name'] #if $prov['active'] #if $prov['next_try'] #set nt = $str($prov['next_try']).split('.', 2)[0][::-1].replace(':', ' m', 1).replace(':', ' h', 1)[::-1] diff --git a/gui/slick/js/history.js b/gui/slick/js/history.js index 1ae8ae97..d53c331b 100644 --- a/gui/slick/js/history.js +++ b/gui/slick/js/history.js @@ -186,6 +186,49 @@ $(document).ready(function() { $.SickGear.sumChecked(); }); + function updown(data){ + var result = ': failed to test site, oh the irony!'; + + if(!(/undefined/i.test(data))) { + // noinspection JSUnresolvedVariable + var resp = data.last_down; + + if (!(/undefined/i.test(resp))) { + result = ': yes it\'s up and was last down ' + resp + ' ago'; + } else { + // noinspection JSUnresolvedVariable + resp = data.down_for; + if (!(/undefined/i.test(resp))) { + result = ': no, it\'s been down for ~' + resp + ''; + } + } + } + + return result; + } + + function check_site(clicked){ + var that = $(clicked), el$=$(that.parent()); + that.attr('disabled', !0); + $.ajax({ + url: $.SickGear.Root + '/history/check_site/?site_name=' + el$.attr('data-check'), + type: 'GET', + dataType: 'json', + complete: function (data) { + // noinspection JSUnresolvedVariable + el$.find('.result').html(updown(data.responseJSON)); + el$.find('a').show(); + that.attr('disabled', !1); + } + }); + } + + $.each(['tvdb', 'thexem', 'github'], function(i, el_id){ + $('#check-' + el_id).find('input').click(function(){ + check_site(this); + }); + }); + $('.shows-less').click(function(){ var table$ = $(this).nextAll('table:first'); table$ = table$.length ? table$ : $(this).parent().nextAll('table:first'); diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index b9629c4e..ed288b12 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -5329,6 +5329,39 @@ class History(MainHandler): return t.respond() + def check_site(self, site_name='', *args, **kwargs): + + site_url = dict( + tvdb='api.thetvdb.com', thexem='thexem.de', github='github.com' + ).get(site_name.replace('check_', '')) + + result = {} + + if site_url: + resp = helpers.getURL('https://www.isitdownrightnow.com/check.php?domain=%s' % site_url) + if resp: + check = resp.lower() + day = re.findall(r'(\d+)\s*(?:day)', check) + hr = re.findall(r'(\d+)\s*(?:hour)', check) + mn = re.findall(r'(\d+)\s*(?:min)', check) + if any([day, hr, mn]): + period = ', '.join( + (day and ['%sd' % day[0]] or day) + + (hr and ['%sh' % hr[0]] or hr) + + (mn and ['%sm' % mn[0]] or mn)) + else: + try: + period = re.findall('[^>]>([^<]+)ago', check)[0].strip() + except (StandardError, Exception): + try: + period = re.findall('[^>]>([^<]+week)', check)[0] + except (StandardError, Exception): + period = 'quite some time' + + result = {('last_down', 'down_for')['up' not in check and 'down for' in check]: period} + + return json.dumps(result) + def clearHistory(self, *args, **kwargs): myDB = db.DBConnection()