1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 14:55:07 -05:00

Fix for setting status via episode status manager

This commit is contained in:
echel0n 2014-06-19 01:37:44 -07:00
parent 5aba53ae8e
commit acadce4d96
3 changed files with 35 additions and 25 deletions

View File

@ -64,7 +64,7 @@ result_type_map = {RESULT_SUCCESS: "success",
} }
# basically everything except RESULT_SUCCESS / success is bad # basically everything except RESULT_SUCCESS / success is bad
class Api(webserve.IndexHandler): class Api(webserve.MainHandler):
""" api class that returns json results """ """ api class that returns json results """
version = 4 # use an int since float-point is unpredictible version = 4 # use an int since float-point is unpredictible
intent = 4 intent = 4
@ -296,7 +296,7 @@ def filter_params(cmd, args, kwargs):
return curArgs, curKwargs return curArgs, curKwargs
class ApiCall(webserve.IndexHandler): class ApiCall(webserve.MainHandler):
_help = {"desc": "No help message available. Please tell the devs that a help msg is missing for this cmd"} _help = {"desc": "No help message available. Please tell the devs that a help msg is missing for this cmd"}
def __init__(self, args, kwargs): def __init__(self, args, kwargs):

View File

@ -129,9 +129,9 @@ def authenticated(handler_class):
@authenticated @authenticated
class IndexHandler(RequestHandler): class MainHandler(RequestHandler):
def __init__(self, application, request, **kwargs): def __init__(self, application, request, **kwargs):
super(IndexHandler, self).__init__(application, request, **kwargs) super(MainHandler, self).__init__(application, request, **kwargs)
global req_headers global req_headers
sickbeard.REMOTE_IP = self.request.remote_ip sickbeard.REMOTE_IP = self.request.remote_ip
@ -161,7 +161,7 @@ class IndexHandler(RequestHandler):
elif status_code == 401: elif status_code == 401:
self.finish(self.http_error_401_handler()) self.finish(self.http_error_401_handler())
else: else:
super(IndexHandler, self).write_error(status_code, **kwargs) super(MainHandler, self).write_error(status_code, **kwargs)
def _dispatch(self): def _dispatch(self):
@ -208,7 +208,7 @@ class IndexHandler(RequestHandler):
def redirect(self, url, permanent=False, status=None): def redirect(self, url, permanent=False, status=None):
self._transforms = [] self._transforms = []
super(IndexHandler, self).redirect(sickbeard.WEB_ROOT + url, permanent, status) super(MainHandler, self).redirect(sickbeard.WEB_ROOT + url, permanent, status)
@asynchronous @asynchronous
@gen.engine @gen.engine
@ -497,7 +497,7 @@ class PageTemplate(Template):
] ]
class IndexerWebUI(IndexHandler): class IndexerWebUI(MainHandler):
def __init__(self, config, log=None): def __init__(self, config, log=None):
self.config = config self.config = config
self.log = log self.log = log
@ -565,7 +565,7 @@ def ManageMenu():
return manageMenu return manageMenu
class ManageSearches(IndexHandler): class ManageSearches(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="manage_manageSearches.tmpl") t = PageTemplate(file="manage_manageSearches.tmpl")
# t.backlogPI = sickbeard.backlogSearchScheduler.action.getProgressIndicator() # t.backlogPI = sickbeard.backlogSearchScheduler.action.getProgressIndicator()
@ -620,7 +620,7 @@ class ManageSearches(IndexHandler):
return self.redirect("/manage/manageSearches/") return self.redirect("/manage/manageSearches/")
class Manage(IndexHandler): class Manage(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="manage.tmpl") t = PageTemplate(file="manage.tmpl")
t.submenu = ManageMenu() t.submenu = ManageMenu()
@ -728,7 +728,7 @@ class Manage(IndexHandler):
all_eps = [str(x["season"]) + 'x' + str(x["episode"]) for x in all_eps_results] all_eps = [str(x["season"]) + 'x' + str(x["episode"]) for x in all_eps_results]
to_change[cur_indexer_id] = all_eps to_change[cur_indexer_id] = all_eps
Home.setStatus(cur_indexer_id, '|'.join(to_change[cur_indexer_id]), newStatus, direct=True) Home(self.application, self.request).setStatus(cur_indexer_id, '|'.join(to_change[cur_indexer_id]), newStatus, direct=True)
return self.redirect('/manage/episodeStatuses/') return self.redirect('/manage/episodeStatuses/')
@ -1226,7 +1226,7 @@ class Manage(IndexHandler):
return _munge(t) return _munge(t)
class History(IndexHandler): class History(MainHandler):
def index(self, limit=100): def index(self, limit=100):
# sqlResults = myDB.select("SELECT h.*, show_name, name FROM history h, tv_shows s, tv_episodes e WHERE h.showid=s.indexer_id AND h.showid=e.showid AND h.season=e.season AND h.episode=e.episode ORDER BY date DESC LIMIT "+str(numPerPage*(p-1))+", "+str(numPerPage)) # sqlResults = myDB.select("SELECT h.*, show_name, name FROM history h, tv_shows s, tv_episodes e WHERE h.showid=s.indexer_id AND h.showid=e.showid AND h.season=e.season AND h.episode=e.episode ORDER BY date DESC LIMIT "+str(numPerPage*(p-1))+", "+str(numPerPage))
@ -1328,7 +1328,7 @@ ConfigMenu = [
] ]
class ConfigGeneral(IndexHandler): class ConfigGeneral(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_general.tmpl") t = PageTemplate(file="config_general.tmpl")
@ -1474,7 +1474,7 @@ class ConfigGeneral(IndexHandler):
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE)) ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE))
class ConfigSearch(IndexHandler): class ConfigSearch(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_search.tmpl") t = PageTemplate(file="config_search.tmpl")
@ -1557,7 +1557,8 @@ class ConfigSearch(IndexHandler):
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE)) ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE))
class ConfigPostProcessing(IndexHandler): class ConfigPostProcessing(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_postProcessing.tmpl") t = PageTemplate(file="config_postProcessing.tmpl")
@ -1728,7 +1729,8 @@ class ConfigPostProcessing(IndexHandler):
return 'not supported' return 'not supported'
class ConfigProviders(IndexHandler): class ConfigProviders(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_providers.tmpl") t = PageTemplate(file="config_providers.tmpl")
t.submenu = ConfigMenu t.submenu = ConfigMenu
@ -2098,7 +2100,8 @@ class ConfigProviders(IndexHandler):
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE)) ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE))
class ConfigNotifications(IndexHandler): class ConfigNotifications(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_notifications.tmpl") t = PageTemplate(file="config_notifications.tmpl")
t.submenu = ConfigMenu t.submenu = ConfigMenu
@ -2299,7 +2302,8 @@ class ConfigNotifications(IndexHandler):
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE)) ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE))
class ConfigSubtitles(IndexHandler): class ConfigSubtitles(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_subtitles.tmpl") t = PageTemplate(file="config_subtitles.tmpl")
t.submenu = ConfigMenu t.submenu = ConfigMenu
@ -2356,7 +2360,8 @@ class ConfigSubtitles(IndexHandler):
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE)) ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE))
class ConfigAnime(IndexHandler): class ConfigAnime(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config_anime.tmpl") t = PageTemplate(file="config_anime.tmpl")
@ -2401,7 +2406,8 @@ class ConfigAnime(IndexHandler):
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE)) ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE))
class Config(IndexHandler): class Config(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="config.tmpl") t = PageTemplate(file="config.tmpl")
t.submenu = ConfigMenu t.submenu = ConfigMenu
@ -2447,7 +2453,8 @@ def HomeMenu():
] ]
class HomePostProcess(IndexHandler): class HomePostProcess(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="home_postprocess.tmpl") t = PageTemplate(file="home_postprocess.tmpl")
@ -2493,7 +2500,8 @@ class HomePostProcess(IndexHandler):
return _genericMessage("Postprocessing results", result) return _genericMessage("Postprocessing results", result)
class NewHomeAddShows(IndexHandler): class NewHomeAddShows(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="home_addShows.tmpl") t = PageTemplate(file="home_addShows.tmpl")
@ -2878,7 +2886,8 @@ ErrorLogsMenu = [
] ]
class ErrorLogs(IndexHandler): class ErrorLogs(MainHandler):
def index(self, *args, **kwargs): def index(self, *args, **kwargs):
t = PageTemplate(file="errorlogs.tmpl") t = PageTemplate(file="errorlogs.tmpl")
@ -2946,7 +2955,8 @@ class ErrorLogs(IndexHandler):
return _munge(t) return _munge(t)
class Home(IndexHandler): class Home(MainHandler):
def is_alive(self, *args, **kwargs): def is_alive(self, *args, **kwargs):
if 'callback' in kwargs and '_' in kwargs: if 'callback' in kwargs and '_' in kwargs:
callback, _ = kwargs['callback'], kwargs['_'] callback, _ = kwargs['callback'], kwargs['_']
@ -4193,7 +4203,7 @@ class Home(IndexHandler):
return json.dumps({'result': 'failure'}) return json.dumps({'result': 'failure'})
class UI(IndexHandler): class UI(MainHandler):
def add_message(self, *args, **kwargs): def add_message(self, *args, **kwargs):
ui.notifications.message('Test 1', 'This is test number 1') ui.notifications.message('Test 1', 'This is test number 1')
ui.notifications.error('Test 2', 'This is test number 2') ui.notifications.error('Test 2', 'This is test number 2')

View File

@ -75,7 +75,7 @@ def initWebServer(options={}):
app.add_handlers(".*$", [ app.add_handlers(".*$", [
(r"/", RedirectHandler, {'url': '%s/home/' % options['web_root']}), (r"/", RedirectHandler, {'url': '%s/home/' % options['web_root']}),
(r'%s/api/(.*)(/?)' % options['web_root'], webapi.Api), (r'%s/api/(.*)(/?)' % options['web_root'], webapi.Api),
(r'%s/(.*)(/?)' % options['web_root'], webserve.IndexHandler) (r'%s/(.*)(/?)' % options['web_root'], webserve.MainHandler)
]) ])
# Static Path Handler # Static Path Handler