Merge remote-tracking branch 'origin/dev'

This commit is contained in:
echel0n 2014-06-18 09:29:26 -07:00
commit cc0faed640
2 changed files with 42 additions and 42 deletions

View file

@ -2103,7 +2103,7 @@ class CMD_ShowGetPoster(ApiCall):
def run(self):
""" get the poster for a show in sickbeard """
return {'outputType': 'image', 'image': webserve.IndexHandler.showPoster(self.indexerid, 'poster')}
return {'outputType': 'image', 'image': webserve.IndexHandler(self.application, self.request).showPoster(self.indexerid, 'poster')}
class CMD_ShowGetBanner(ApiCall):
@ -2121,7 +2121,7 @@ class CMD_ShowGetBanner(ApiCall):
def run(self):
""" get the banner for a show in sickbeard """
return {'outputType': 'image', 'image': webserve.IndexHandler.showPoster(self.indexerid, 'banner')}
return {'outputType': 'image', 'image': webserve.IndexHandler(self.application, self.request).showPoster(self.indexerid, 'banner')}
class CMD_ShowPause(ApiCall):

View file

@ -96,7 +96,7 @@ def authenticated(handler_class):
def basicauth(handler, transforms, *args, **kwargs):
def _request_basic_auth(handler):
handler.set_status(401)
handler.set_header('WWW-Authenticate', 'Basic realm=SickRage')
handler.set_header('WWW-Authenticate', 'Basic realm="SickRage"')
handler._transforms = []
handler.finish()
return False
@ -270,7 +270,7 @@ class IndexHandler(RequestHandler):
sickbeard.HOME_LAYOUT = layout
self.redirect("/home/")
return self.redirect("/home/")
def setHistoryLayout(self, layout):
@ -279,13 +279,13 @@ class IndexHandler(RequestHandler):
sickbeard.HISTORY_LAYOUT = layout
self.redirect("/history/")
return self.redirect("/history/")
def toggleDisplayShowSpecials(self, show):
sickbeard.DISPLAY_SHOW_SPECIALS = not sickbeard.DISPLAY_SHOW_SPECIALS
self.redirect("/home/displayShow?show=" + show)
return self.redirect("/home/displayShow?show=" + show)
def setComingEpsLayout(self, layout):
if layout not in ('poster', 'banner', 'list'):
@ -293,13 +293,13 @@ class IndexHandler(RequestHandler):
sickbeard.COMING_EPS_LAYOUT = layout
self.redirect("/comingEpisodes/")
return self.redirect("/comingEpisodes/")
def toggleComingEpsDisplayPaused(self, *args, **kwargs):
sickbeard.COMING_EPS_DISPLAY_PAUSED = not sickbeard.COMING_EPS_DISPLAY_PAUSED
self.redirect("/comingEpisodes/")
return self.redirect("/comingEpisodes/")
def setComingEpsSort(self, sort):
if sort not in ('date', 'network', 'show'):
@ -307,7 +307,7 @@ class IndexHandler(RequestHandler):
sickbeard.COMING_EPS_SORT = sort
self.redirect("/comingEpisodes/")
return self.redirect("/comingEpisodes/")
def comingEpisodes(self, layout="None"):
@ -511,7 +511,7 @@ class IndexerWebUI(IndexHandler):
showDirList = ""
for curShowDir in self.config['_showDir']:
showDirList += "showDir=" + curShowDir + "&"
self.redirect("/home/addShows/addShow?" + showDirList + "seriesList=" + searchList)
return self.redirect("/home/addShows/addShow?" + showDirList + "seriesList=" + searchList)
def _munge(string):
@ -590,7 +590,7 @@ class ManageSearches(IndexHandler):
logger.log(u"Backlog search forced")
ui.notifications.message('Backlog search started')
self.redirect("/manage/manageSearches/")
return self.redirect("/manage/manageSearches/")
def forceSearch(self, *args, **kwargs):
@ -601,7 +601,7 @@ class ManageSearches(IndexHandler):
logger.log(u"Daily search forced")
ui.notifications.message('Daily search started')
self.redirect("/manage/manageSearches/")
return self.redirect("/manage/manageSearches/")
def forceFindPropers(self, *args, **kwargs):
@ -612,7 +612,7 @@ class ManageSearches(IndexHandler):
logger.log(u"Find propers search forced")
ui.notifications.message('Find propers search started')
self.redirect("/manage/manageSearches/")
return self.redirect("/manage/manageSearches/")
def pauseBacklog(self, paused=None):
@ -621,7 +621,7 @@ class ManageSearches(IndexHandler):
else:
sickbeard.searchQueueScheduler.action.unpause_backlog() # @UndefinedVariable
self.redirect("/manage/manageSearches/")
return self.redirect("/manage/manageSearches/")
class Manage(IndexHandler):
@ -734,7 +734,7 @@ class Manage(IndexHandler):
Home.setStatus(cur_indexer_id, '|'.join(to_change[cur_indexer_id]), newStatus, direct=True)
self.redirect('/manage/episodeStatuses/')
return self.redirect('/manage/episodeStatuses/')
def showSubtitleMissed(self, indexer_id, whichSubs):
@ -842,7 +842,7 @@ class Manage(IndexHandler):
show = sickbeard.helpers.findCertainShow(sickbeard.showList, int(cur_indexer_id))
subtitles = show.getEpisode(int(season), int(episode)).downloadSubtitles()
self.redirect('/manage/subtitleMissed/')
return self.redirect('/manage/subtitleMissed/')
def backlogShow(self, indexer_id):
@ -852,7 +852,7 @@ class Manage(IndexHandler):
if show_obj:
sickbeard.backlogSearchScheduler.action.searchBacklog([show_obj]) # @UndefinedVariable
self.redirect("/manage/backlogOverview/")
return self.redirect("/manage/backlogOverview/")
def backlogOverview(self, *args, **kwargs):
@ -902,7 +902,7 @@ class Manage(IndexHandler):
t.submenu = ManageMenu()
if not toEdit:
self.redirect("/manage/")
return self.redirect("/manage/")
showIDs = toEdit.split("|")
showList = []
@ -1067,7 +1067,7 @@ class Manage(IndexHandler):
ui.notifications.error('%d error%s while saving changes:' % (len(errors), "" if len(errors) == 1 else "s"),
" ".join(errors))
self.redirect("/manage/")
return self.redirect("/manage/")
def massUpdate(self, toUpdate=None, toRefresh=None, toRename=None, toDelete=None, toMetadata=None, toSubtitle=None):
@ -1176,7 +1176,7 @@ class Manage(IndexHandler):
ui.notifications.message("The following actions were queued:",
messageDetail)
self.redirect("/manage/")
return self.redirect("/manage/")
def manageTorrents(self, *args, **kwargs):
@ -1308,7 +1308,7 @@ class History(IndexHandler):
myDB.action("DELETE FROM history WHERE 1=1")
ui.notifications.message('History cleared')
self.redirect("/history/")
return self.redirect("/history/")
def trimHistory(self, *args, **kwargs):
@ -1318,7 +1318,7 @@ class History(IndexHandler):
(datetime.datetime.today() - datetime.timedelta(days=30)).strftime(history.dateFormat)))
ui.notifications.message('Removed history entries greater than 30 days old')
self.redirect("/history/")
return self.redirect("/history/")
ConfigMenu = [
@ -2465,7 +2465,7 @@ class HomePostProcess(IndexHandler):
if sickbeard.versionCheckScheduler.action.check_for_new_version(force=True):
logger.log(u"Forcing version check")
self.redirect("/home/")
return self.redirect("/home/")
def processEpisode(self, dir=None, nzbName=None, jobName=None, quiet=None, process_method=None, force=None,
is_priority=None, failed="0", type="auto"):
@ -2486,7 +2486,7 @@ class HomePostProcess(IndexHandler):
is_priority = False
if not dir:
self.redirect("/home/postprocess/")
return self.redirect("/home/postprocess/")
else:
result = processTV.processDir(dir, nzbName, process_method=process_method, force=force,
is_priority=is_priority, failed=failed, type=type)
@ -2732,7 +2732,7 @@ class NewHomeAddShows(IndexHandler):
logger.log("Unable to add show due to show selection. Not anough arguments: %s" % (repr(series_pieces)),
logger.ERROR)
ui.notifications.error("Unknown error. Unable to add show due to problem with show selection.")
self.redirect('/home/addShows/existingShows/')
return self.redirect('/home/addShows/existingShows/')
indexer = int(series_pieces[1])
indexer_id = int(series_pieces[3])
show_name = series_pieces[4]
@ -2754,7 +2754,7 @@ class NewHomeAddShows(IndexHandler):
# blanket policy - if the dir exists you should have used "add existing show" numbnuts
if ek.ek(os.path.isdir, show_dir) and not fullShowPath:
ui.notifications.error("Unable to add show", "Folder " + show_dir + " exists already")
self.redirect('/home/addShows/existingShows/')
return self.redirect('/home/addShows/existingShows/')
# don't create show dir if config says not to
if sickbeard.ADD_SHOWS_WO_DIR:
@ -2765,7 +2765,7 @@ class NewHomeAddShows(IndexHandler):
logger.log(u"Unable to create the folder " + show_dir + ", can't add the show", logger.ERROR)
ui.notifications.error("Unable to add show",
"Unable to create the folder " + show_dir + ", can't add the show")
self.redirect("/home/")
return self.redirect("/home/")
else:
helpers.chmodAsParent(show_dir)
@ -2870,7 +2870,7 @@ class NewHomeAddShows(IndexHandler):
# if we're done then go home
if not dirs_only:
self.redirect('/home/')
return self.redirect('/home/')
# for the remaining shows we need to prompt for each one, so forward this on to the newShow page
return self.newShow(dirs_only[0], dirs_only[1:])
@ -2893,7 +2893,7 @@ class ErrorLogs(IndexHandler):
def clearerrors(self, *args, **kwargs):
classes.ErrorViewer.clear()
self.redirect("/errorlogs/")
return self.redirect("/errorlogs/")
def viewlog(self, minLevel=logger.MESSAGE, maxLines=500):
@ -3264,7 +3264,7 @@ class Home(IndexHandler):
def shutdown(self, pid=None):
if str(pid) != str(sickbeard.PID):
self.redirect("/home/")
return self.redirect("/home/")
threading.Timer(2, sickbeard.invoke_shutdown).start()
@ -3276,7 +3276,7 @@ class Home(IndexHandler):
def restart(self, pid=None):
if str(pid) != str(sickbeard.PID):
self.redirect("/home/")
return self.redirect("/home/")
t = PageTemplate(file="restart.tmpl")
t.submenu = HomeMenu()
@ -3290,7 +3290,7 @@ class Home(IndexHandler):
def update(self, pid=None):
if str(pid) != str(sickbeard.PID):
self.redirect("/home/")
return self.redirect("/home/")
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable
if updated:
@ -3711,7 +3711,7 @@ class Home(IndexHandler):
ui.notifications.error('%d error%s while saving changes:' % (len(errors), "" if len(errors) == 1 else "s"),
'<ul>' + '\n'.join(['<li>%s</li>' % error for error in errors]) + "</ul>")
self.redirect("/home/displayShow?show=" + show)
return self.redirect("/home/displayShow?show=" + show)
def deleteShow(self, show=None):
@ -3731,7 +3731,7 @@ class Home(IndexHandler):
showObj.deleteShow()
ui.notifications.message('<b>%s</b> has been deleted' % showObj.name)
self.redirect("/home/")
return self.redirect("/home/")
def refreshShow(self, show=None):
@ -3753,7 +3753,7 @@ class Home(IndexHandler):
time.sleep(cpu_presets[sickbeard.CPU_PRESET])
self.redirect("/home/displayShow?show=" + str(showObj.indexerid))
return self.redirect("/home/displayShow?show=" + str(showObj.indexerid))
def updateShow(self, show=None, force=0):
@ -3776,7 +3776,7 @@ class Home(IndexHandler):
# just give it some time
time.sleep(cpu_presets[sickbeard.CPU_PRESET])
self.redirect("/home/displayShow?show=" + str(showObj.indexerid))
return self.redirect("/home/displayShow?show=" + str(showObj.indexerid))
def subtitleShow(self, show=None, force=0):
@ -3794,7 +3794,7 @@ class Home(IndexHandler):
time.sleep(cpu_presets[sickbeard.CPU_PRESET])
self.redirect("/home/displayShow?show=" + str(showObj.indexerid))
return self.redirect("/home/displayShow?show=" + str(showObj.indexerid))
def updateXBMC(self, showName=None):
@ -3810,7 +3810,7 @@ class Home(IndexHandler):
ui.notifications.message("Library update command sent to XBMC host(s): " + host)
else:
ui.notifications.error("Unable to contact one or more XBMC host(s): " + host)
self.redirect('/home/')
return self.redirect('/home/')
def updatePLEX(self, *args, **kwargs):
@ -3819,7 +3819,7 @@ class Home(IndexHandler):
"Library update command sent to Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST)
else:
ui.notifications.error("Unable to contact Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST)
self.redirect('/home/')
return self.redirect('/home/')
def setStatus(self, show=None, eps=None, status=None, direct=False):
@ -3933,7 +3933,7 @@ class Home(IndexHandler):
if direct:
return json.dumps({'result': 'success'})
else:
self.redirect("/home/displayShow?show=" + show)
return self.redirect("/home/displayShow?show=" + show)
def testRename(self, show=None):
@ -4000,7 +4000,7 @@ class Home(IndexHandler):
return _genericMessage("Error", "Can't rename episodes when the show dir is missing.")
if eps is None:
self.redirect("/home/displayShow?show=" + show)
return self.redirect("/home/displayShow?show=" + show)
with db.DBConnection() as myDB:
for curEp in eps.split('|'):
@ -4027,7 +4027,7 @@ class Home(IndexHandler):
root_ep_obj.rename()
self.redirect("/home/displayShow?show=" + show)
return self.redirect("/home/displayShow?show=" + show)
def searchEpisode(self, show=None, season=None, episode=None):