mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-05 10:58:01 -05:00
Fixed issues with network timezone downloads crashing on a empty return.
Changed version checker url.
This commit is contained in:
parent
40b8e2d64d
commit
3f29439ff3
@ -47,10 +47,6 @@ In Progress<br />
|
||||
#end if
|
||||
<br />
|
||||
|
||||
<h3>Version Check:</h3>
|
||||
<a class="btn" href="$sbRoot/manage/manageSearches/forceVersionCheck"><i class="icon-check"></i> Force Check</a>
|
||||
<br /> <br />
|
||||
|
||||
<h3>Search Queue:</h3>
|
||||
Backlog: <i>$queueLength['backlog'] pending items</i></br>
|
||||
Daily: <i>$queueLength['daily'] pending items</i></br>
|
||||
|
@ -75,19 +75,23 @@ def _update_zoneinfo():
|
||||
# now check if the zoneinfo needs update
|
||||
url_zv = 'https://raw.githubusercontent.com/Prinz23/sb_network_timezones/master/zoneinfo.txt'
|
||||
|
||||
url_data = helpers.getURL(url_zv)
|
||||
if url_data is None:
|
||||
try:
|
||||
url_data = helpers.getURL(url_zv)
|
||||
if not url_data:
|
||||
raise
|
||||
|
||||
if lib.dateutil.zoneinfo.ZONEINFOFILE is not None:
|
||||
cur_zoneinfo = ek.ek(basename, lib.dateutil.zoneinfo.ZONEINFOFILE)
|
||||
else:
|
||||
cur_zoneinfo = None
|
||||
|
||||
(new_zoneinfo, zoneinfo_md5) = url_data.decode('utf-8').strip().rsplit(u' ')
|
||||
except:
|
||||
# When urlData is None, trouble connecting to github
|
||||
logger.log(u'Loading zoneinfo.txt failed, this can happen from time to time. Unable to get URL: %s' % url_zv,
|
||||
logger.WARNING)
|
||||
return
|
||||
|
||||
if lib.dateutil.zoneinfo.ZONEINFOFILE is not None:
|
||||
cur_zoneinfo = ek.ek(basename, lib.dateutil.zoneinfo.ZONEINFOFILE)
|
||||
else:
|
||||
cur_zoneinfo = None
|
||||
(new_zoneinfo, zoneinfo_md5) = url_data.decode('utf-8').strip().rsplit(u' ')
|
||||
|
||||
if (cur_zoneinfo is not None) and (new_zoneinfo == cur_zoneinfo):
|
||||
return
|
||||
|
||||
|
@ -234,7 +234,7 @@ class KATProvider(generic.TorrentProvider):
|
||||
logger.log(u"Search string: " + searchURL, logger.DEBUG)
|
||||
|
||||
entries = self.cache.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
||||
if entries and len(entries) > 0:
|
||||
if entries:
|
||||
break
|
||||
|
||||
try:
|
||||
@ -361,7 +361,7 @@ class KATCache(tvcache.TVCache):
|
||||
logger.log(u"KAT cache update URL: " + searchURL, logger.DEBUG)
|
||||
|
||||
data = self.getRSSFeed(url, items=['entries', 'feed'])
|
||||
if data and len(data) > 0:
|
||||
if data['entries']:
|
||||
break
|
||||
|
||||
return data
|
||||
|
@ -145,6 +145,8 @@ class BaseHandler(RequestHandler):
|
||||
self.redirect(url)
|
||||
else:
|
||||
self.write('Wrong API key used')
|
||||
self.finish()
|
||||
|
||||
elif self.settings.get("debug") and "exc_info" in kwargs:
|
||||
exc_info = kwargs["exc_info"]
|
||||
trace_info = ''.join(["%s<br/>" % line for line in traceback.format_exception(*exc_info)])
|
||||
@ -196,8 +198,11 @@ class WebHandler(BaseHandler):
|
||||
# process request async
|
||||
self.async_worker(method, self.async_done)
|
||||
except:
|
||||
logger.log('Failed doing webui request "%s": %s' % (route, traceback.format_exc()), logger.ERROR)
|
||||
raise HTTPError(404)
|
||||
|
||||
def post(self, route, *args, **kwargs):
|
||||
super(WebHandler, self).get(route, *args, **kwargs)
|
||||
|
||||
@run_on_executor
|
||||
def async_worker(self, method, callback):
|
||||
@ -207,22 +212,25 @@ class WebHandler(BaseHandler):
|
||||
kwargs[arg] = value[0]
|
||||
|
||||
try:
|
||||
callback(method(**kwargs))
|
||||
except Exception as e:
|
||||
res = method(**kwargs)
|
||||
callback(res)
|
||||
except:
|
||||
logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.ERROR)
|
||||
callback()
|
||||
|
||||
def async_done(self, result=None):
|
||||
if result:
|
||||
try:
|
||||
result = ek.ss(result).encode('utf-8', 'xmlcharrefreplace')
|
||||
except:
|
||||
result = str(result)
|
||||
try:
|
||||
result = ek.ss(result).encode('utf-8', 'xmlcharrefreplace')
|
||||
except:
|
||||
result = str(result)
|
||||
|
||||
try:
|
||||
self.write(result)
|
||||
self.finish()
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
self.write(result)
|
||||
self.finish()
|
||||
except:
|
||||
logger.log('Failed sending webui reponse: %s' % (traceback.format_exc()), logger.DEBUG)
|
||||
try:self.finish()
|
||||
except:pass
|
||||
|
||||
def _genericMessage(self, subject, message):
|
||||
t = PageTemplate(rh=self, file="genericMessage.tmpl")
|
||||
@ -266,9 +274,6 @@ class WebHandler(BaseHandler):
|
||||
else:
|
||||
return False
|
||||
|
||||
# post and get use same method
|
||||
post = get
|
||||
|
||||
class LoginHandler(BaseHandler):
|
||||
def get(self, *args, **kwargs):
|
||||
|
||||
@ -614,7 +619,6 @@ class WebRoot(WebHandler):
|
||||
|
||||
return ical
|
||||
|
||||
|
||||
@route('/ui/(.*)(/?)')
|
||||
class UI(WebRoot):
|
||||
def add_message(self, *args, **kwargs):
|
||||
@ -658,8 +662,6 @@ class Home(WebRoot):
|
||||
{'title': 'Update KODI', 'path': 'home/updateKODI/', 'requires': self.haveKODI},
|
||||
{'title': 'Update Plex', 'path': 'home/updatePLEX/', 'requires': self.havePLEX},
|
||||
{'title': 'Manage Torrents', 'path': 'manage/manageTorrents', 'requires': self.haveTORRENT},
|
||||
{'title': 'Restart', 'path': 'home/restart/?pid=' + str(sickbeard.PID), 'confirm': True},
|
||||
{'title': 'Shutdown', 'path': 'home/shutdown/?pid=' + str(sickbeard.PID), 'confirm': True},
|
||||
]
|
||||
|
||||
return menu
|
||||
@ -1003,14 +1005,18 @@ class Home(WebRoot):
|
||||
|
||||
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable
|
||||
if updated:
|
||||
# do a hard restart
|
||||
sickbeard.events.put(sickbeard.events.SystemEvent.RESTART)
|
||||
# do a hard restart
|
||||
sickbeard.events.put(sickbeard.events.SystemEvent.RESTART)
|
||||
|
||||
t = PageTemplate(rh=self, file="restart_bare.tmpl")
|
||||
return t
|
||||
t = PageTemplate(rh=self, file="restart_bare.tmpl")
|
||||
return t
|
||||
else:
|
||||
return self._genericMessage("Update Failed",
|
||||
"Update wasn't successful, not restarting. Check your log for more information.")
|
||||
if do_update:
|
||||
return self._genericMessage("Update Failed",
|
||||
"Update wasn't successful, not restarting. Check your log for more information.")
|
||||
|
||||
if force:
|
||||
self.redirect("/home/")
|
||||
|
||||
def branchCheckout(self, branch):
|
||||
sickbeard.BRANCH = branch
|
||||
|
Loading…
Reference in New Issue
Block a user