diff --git a/SickBeard.py b/SickBeard.py index af30a552..12a08ccd 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -18,10 +18,7 @@ # along with SickRage. If not, see . # Check needed software dependencies to nudge users to fix their setup -import functools import sys -import tornado.ioloop -import tornado.autoreload if sys.version_info < (2, 6): print "Sorry, requires Python 2.6 or 2.7." @@ -56,6 +53,9 @@ import getopt import sickbeard +import tornado.ioloop +import tornado.autoreload + from sickbeard import db from sickbeard.tv import TVShow from sickbeard import logger @@ -395,8 +395,9 @@ def main(): sickbeard.cleanup_tornado_sockets(io_loop) # autoreload. - tornado.autoreload.start(io_loop) - tornado.autoreload.add_reload_hook(autoreload_shutdown) + if sickbeard.AUTO_UPDATE: + tornado.autoreload.start(io_loop) + tornado.autoreload.add_reload_hook(autoreload_shutdown) # start IOLoop. io_loop.start() diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 0d5336c5..51a06ea3 100644 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -17,7 +17,6 @@ # along with SickRage. If not, see . from __future__ import with_statement -import traceback import webbrowser import time diff --git a/sickbeard/ui.py b/sickbeard/ui.py index 1d3c8a94..c1c689d5 100644 --- a/sickbeard/ui.py +++ b/sickbeard/ui.py @@ -25,7 +25,7 @@ MESSAGE = 'notice' ERROR = 'error' -class Notifications(RequestHandler): +class Notifications(object): """ A queue of Notification objects. """ @@ -71,7 +71,7 @@ class Notifications(RequestHandler): notifications = Notifications() -class Notification(RequestHandler): +class Notification(object): """ Represents a single notification. Tracks its own timeout and a list of which clients have seen it before. @@ -81,8 +81,6 @@ class Notification(RequestHandler): self.title = title self.message = message - self.remote_ip = sickbeard.REMOTE_IP - self._when = datetime.datetime.now() self._seen = [] @@ -100,7 +98,7 @@ class Notification(RequestHandler): """ Returns True if the notification hasn't been displayed to the current client (aka IP address). """ - return self.remote_ip not in self._seen + return sickbeard.REMOTE_IP not in self._seen def is_expired(self): """ @@ -113,7 +111,7 @@ class Notification(RequestHandler): """ Returns this notification object and marks it as seen by the client ip """ - self._seen.append(self.remote_ip) + self._seen.append(sickbeard.REMOTE_IP) return self diff --git a/sickbeard/versionChecker.py b/sickbeard/versionChecker.py index 067d79e0..8936bc86 100644 --- a/sickbeard/versionChecker.py +++ b/sickbeard/versionChecker.py @@ -58,8 +58,7 @@ class CheckVersion(): if sickbeard.AUTO_UPDATE: logger.log(u"New update found for SickRage, starting auto-updater ...") if sickbeard.versionCheckScheduler.action.update(): - logger.log(u"Update was successfull, auto-reloading SickRage ...") - #threading.Timer(2, sickbeard.invoke_restart, [False]).start() + logger.log(u"Update was successful!") def find_install_type(self): """ diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 8c3ccaae..391d0e70 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -4209,7 +4209,7 @@ class UI(IndexHandler): ui.notifications.message('Test 1', 'This is test number 1') ui.notifications.error('Test 2', 'This is test number 2') - "ok" + return "ok" def get_messages(self, *args, **kwargs): @@ -4221,4 +4221,4 @@ class UI(IndexHandler): 'type': cur_notification.type} cur_notification_num += 1 - json.dumps(messages) + return json.dumps(messages) diff --git a/sickbeard/webserveInit.py b/sickbeard/webserveInit.py index 797c06db..9644953f 100644 --- a/sickbeard/webserveInit.py +++ b/sickbeard/webserveInit.py @@ -1,7 +1,6 @@ import os import traceback import sickbeard -from tornado.ioloop import IOLoop import webserve import webapi @@ -9,6 +8,7 @@ from sickbeard import logger from sickbeard.helpers import create_https_certificates from tornado.web import Application, StaticFileHandler, RedirectHandler, HTTPError from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop server = None @@ -100,7 +100,7 @@ def initWebServer(options={}): log_function=lambda x: None, debug=False, gzip=True, - autoreload=True, + autoreload=sickbeard.AUTO_UPDATE, xheaders=True, cookie_secret='61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=', login_url='/login'