mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixed issues with WebAPI and showPoster function
This commit is contained in:
parent
a6773a4be8
commit
26e4979f10
@ -37,7 +37,6 @@ from sickbeard import processTV
|
|||||||
from sickbeard import network_timezones, sbdatetime
|
from sickbeard import network_timezones, sbdatetime
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
from sickbeard.common import Quality, Overview, qualityPresetStrings, statusStrings, SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
from sickbeard.common import Quality, Overview, qualityPresetStrings, statusStrings, SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
||||||
from sickbeard.webserve import WebRoot
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
@ -176,9 +175,9 @@ class ApiHandler(RequestHandler):
|
|||||||
if not (multiCmds and cmd in ('show.getposter', 'show.getbanner')): # skip these cmd while chaining
|
if not (multiCmds and cmd in ('show.getposter', 'show.getbanner')): # skip these cmd while chaining
|
||||||
try:
|
try:
|
||||||
if cmd in _functionMaper:
|
if cmd in _functionMaper:
|
||||||
curOutDict = _functionMaper.get(cmd)(curArgs, curKwargs).run()
|
curOutDict = _functionMaper.get(cmd)(curArgs, curKwargs).run(self)
|
||||||
elif _is_int(cmd):
|
elif _is_int(cmd):
|
||||||
curOutDict = TVDBShorthandWrapper(curArgs, curKwargs, cmd).run()
|
curOutDict = TVDBShorthandWrapper(curArgs, curKwargs, cmd).run(self)
|
||||||
else:
|
else:
|
||||||
curOutDict = _responds(RESULT_ERROR, "No such cmd: '" + cmd + "'")
|
curOutDict = _responds(RESULT_ERROR, "No such cmd: '" + cmd + "'")
|
||||||
except ApiError, e: # Api errors that we raised, they are harmless
|
except ApiError, e: # Api errors that we raised, they are harmless
|
||||||
@ -202,7 +201,7 @@ class ApiHandler(RequestHandler):
|
|||||||
if multiCmds: # if we had multiple cmds we have to wrap it in a response dict
|
if multiCmds: # if we had multiple cmds we have to wrap it in a response dict
|
||||||
outDict = _responds(RESULT_SUCCESS, outDict)
|
outDict = _responds(RESULT_SUCCESS, outDict)
|
||||||
else: # index / no cmd given
|
else: # index / no cmd given
|
||||||
outDict = CMD_SickBeard(args, kwargs).run()
|
outDict = CMD_SickBeard(args, kwargs).run(self)
|
||||||
|
|
||||||
return outDict
|
return outDict
|
||||||
|
|
||||||
@ -240,6 +239,33 @@ class ApiHandler(RequestHandler):
|
|||||||
curKwargs[kwarg] = kwargs[kwarg]
|
curKwargs[kwarg] = kwargs[kwarg]
|
||||||
return curArgs, curKwargs
|
return curArgs, curKwargs
|
||||||
|
|
||||||
|
def showPoster(self, show=None, which=None):
|
||||||
|
# Redirect initial poster/banner thumb to default images
|
||||||
|
if which[0:6] == 'poster':
|
||||||
|
default_image_name = 'poster.png'
|
||||||
|
else:
|
||||||
|
default_image_name = 'banner.png'
|
||||||
|
|
||||||
|
# image_path = ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', 'slick', 'images', default_image_name)
|
||||||
|
static_image_path = os.path.join('/images', default_image_name)
|
||||||
|
if show and sickbeard.helpers.findCertainShow(sickbeard.showList, int(show)):
|
||||||
|
cache_obj = image_cache.ImageCache()
|
||||||
|
|
||||||
|
image_file_name = None
|
||||||
|
if which == 'poster':
|
||||||
|
image_file_name = cache_obj.poster_path(show)
|
||||||
|
if which == 'poster_thumb' or which == 'small':
|
||||||
|
image_file_name = cache_obj.poster_thumb_path(show)
|
||||||
|
if which == 'banner':
|
||||||
|
image_file_name = cache_obj.banner_path(show)
|
||||||
|
if which == 'banner_thumb':
|
||||||
|
image_file_name = cache_obj.banner_thumb_path(show)
|
||||||
|
|
||||||
|
if ek.ek(os.path.isfile, image_file_name):
|
||||||
|
static_image_path = os.path.normpath(image_file_name.replace(sickbeard.CACHE_DIR, '/cache'))
|
||||||
|
|
||||||
|
static_image_path = static_image_path.replace('\\', '/')
|
||||||
|
return self.redirect(static_image_path)
|
||||||
|
|
||||||
class ApiCall(ApiHandler):
|
class ApiCall(ApiHandler):
|
||||||
_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"}
|
||||||
@ -256,11 +282,11 @@ class ApiCall(ApiHandler):
|
|||||||
if 'help' in kwargs:
|
if 'help' in kwargs:
|
||||||
self.run = self.return_help
|
self.run = self.return_help
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
# override with real output function in subclass
|
# override with real output function in subclass
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def return_help(self):
|
def return_help(self, **kwargs):
|
||||||
try:
|
try:
|
||||||
if self._requiredParams:
|
if self._requiredParams:
|
||||||
pass
|
pass
|
||||||
@ -297,7 +323,7 @@ class ApiCall(ApiHandler):
|
|||||||
del self._help["desc"]
|
del self._help["desc"]
|
||||||
return _responds(RESULT_SUCCESS, self._help, msg)
|
return _responds(RESULT_SUCCESS, self._help, msg)
|
||||||
|
|
||||||
def return_missing(self):
|
def return_missing(self, **kwargs):
|
||||||
if len(self._missing) == 1:
|
if len(self._missing) == 1:
|
||||||
msg = "The required parameter: '" + self._missing[0] + "' was not set"
|
msg = "The required parameter: '" + self._missing[0] + "' was not set"
|
||||||
else:
|
else:
|
||||||
@ -424,7 +450,6 @@ class ApiCall(ApiHandler):
|
|||||||
raise ApiError(u"param: '" + str(name) + "' with given value: '" + str(
|
raise ApiError(u"param: '" + str(name) + "' with given value: '" + str(
|
||||||
value) + "' is out of allowed range '" + str(allowedValues) + "'")
|
value) + "' is out of allowed range '" + str(allowedValues) + "'")
|
||||||
|
|
||||||
|
|
||||||
class TVDBShorthandWrapper(ApiCall):
|
class TVDBShorthandWrapper(ApiCall):
|
||||||
_help = {"desc": "this is an internal function wrapper. call the help command directly for more information"}
|
_help = {"desc": "this is an internal function wrapper. call the help command directly for more information"}
|
||||||
|
|
||||||
@ -439,15 +464,15 @@ class TVDBShorthandWrapper(ApiCall):
|
|||||||
|
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" internal function wrapper """
|
""" internal function wrapper """
|
||||||
args = (self.sid,) + self.origArgs
|
args = (self.sid,) + self.origArgs
|
||||||
if self.e:
|
if self.e:
|
||||||
return CMD_Episode(args, self.kwargs).run()
|
return CMD_Episode(args, self.kwargs).run(rh)
|
||||||
elif self.s:
|
elif self.s:
|
||||||
return CMD_ShowSeasons(args, self.kwargs).run()
|
return CMD_ShowSeasons(args, self.kwargs).run(rh)
|
||||||
else:
|
else:
|
||||||
return CMD_Show(args, self.kwargs).run()
|
return CMD_Show(args, self.kwargs).run(rh)
|
||||||
|
|
||||||
|
|
||||||
# ###############################
|
# ###############################
|
||||||
@ -639,10 +664,10 @@ class CMD_Help(ApiCall):
|
|||||||
_functionMaper.keys())
|
_functionMaper.keys())
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display help information for a given subject/command """
|
""" display help information for a given subject/command """
|
||||||
if self.subject in _functionMaper:
|
if self.subject in _functionMaper:
|
||||||
out = _responds(RESULT_SUCCESS, _functionMaper.get(self.subject)((), {"help": 1}).run())
|
out = _responds(RESULT_SUCCESS, _functionMaper.get(self.subject)((), {"help": 1}).run(rh))
|
||||||
else:
|
else:
|
||||||
out = _responds(RESULT_FAILURE, msg="No such cmd")
|
out = _responds(RESULT_FAILURE, msg="No such cmd")
|
||||||
return out
|
return out
|
||||||
@ -671,7 +696,7 @@ class CMD_ComingEpisodes(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display the coming episodes """
|
""" display the coming episodes """
|
||||||
today = datetime.date.today().toordinal()
|
today = datetime.date.today().toordinal()
|
||||||
next_week = (datetime.date.today() + datetime.timedelta(days=7)).toordinal()
|
next_week = (datetime.date.today() + datetime.timedelta(days=7)).toordinal()
|
||||||
@ -792,7 +817,7 @@ class CMD_Episode(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display detailed info about an episode """
|
""" display detailed info about an episode """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -855,7 +880,7 @@ class CMD_EpisodeSearch(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" search for an episode """
|
""" search for an episode """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -912,7 +937,7 @@ class CMD_EpisodeSetStatus(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" set status of an episode or a season (when no ep is provided) """
|
""" set status of an episode or a season (when no ep is provided) """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -1021,7 +1046,7 @@ class CMD_SubtitleSearch(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" search episode subtitles """
|
""" search episode subtitles """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -1073,7 +1098,7 @@ class CMD_Exceptions(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display scene exceptions for all or a given show """
|
""" display scene exceptions for all or a given show """
|
||||||
myDB = db.DBConnection("cache.db", row_type="dict")
|
myDB = db.DBConnection("cache.db", row_type="dict")
|
||||||
|
|
||||||
@ -1117,7 +1142,7 @@ class CMD_History(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display sickrage downloaded/snatched history """
|
""" display sickrage downloaded/snatched history """
|
||||||
|
|
||||||
typeCodes = []
|
typeCodes = []
|
||||||
@ -1172,7 +1197,7 @@ class CMD_HistoryClear(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" clear sickrage's history """
|
""" clear sickrage's history """
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
myDB.action("DELETE FROM history WHERE 1=1")
|
myDB.action("DELETE FROM history WHERE 1=1")
|
||||||
@ -1190,7 +1215,7 @@ class CMD_HistoryTrim(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" trim sickrage's history """
|
""" trim sickrage's history """
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
myDB.action("DELETE FROM history WHERE date < " + str(
|
myDB.action("DELETE FROM history WHERE date < " + str(
|
||||||
@ -1211,7 +1236,7 @@ class CMD_Failed(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display failed downloads """
|
""" display failed downloads """
|
||||||
|
|
||||||
myDB = db.DBConnection('failed.db', row_type="dict")
|
myDB = db.DBConnection('failed.db', row_type="dict")
|
||||||
@ -1233,7 +1258,7 @@ class CMD_Backlog(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display backlogged episodes """
|
""" display backlogged episodes """
|
||||||
|
|
||||||
shows = []
|
shows = []
|
||||||
@ -1277,7 +1302,7 @@ class CMD_Logs(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" view sickrage's log """
|
""" view sickrage's log """
|
||||||
# 10 = Debug / 20 = Info / 30 = Warning / 40 = Error
|
# 10 = Debug / 20 = Info / 30 = Warning / 40 = Error
|
||||||
minLevel = logger.reverseNames[str(self.min_level).upper()]
|
minLevel = logger.reverseNames[str(self.min_level).upper()]
|
||||||
@ -1349,7 +1374,7 @@ class CMD_PostProcess(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" Starts the postprocess """
|
""" Starts the postprocess """
|
||||||
if not self.path and not sickbeard.TV_DOWNLOAD_DIR:
|
if not self.path and not sickbeard.TV_DOWNLOAD_DIR:
|
||||||
return _responds(RESULT_FAILURE, msg="You need to provide a path or set TV Download Dir")
|
return _responds(RESULT_FAILURE, msg="You need to provide a path or set TV Download Dir")
|
||||||
@ -1378,7 +1403,7 @@ class CMD_SickBeard(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display misc sickrage related information """
|
""" display misc sickrage related information """
|
||||||
data = {"sr_version": sickbeard.BRANCH, "api_version": self.version,
|
data = {"sr_version": sickbeard.BRANCH, "api_version": self.version,
|
||||||
"api_commands": sorted(_functionMaper.keys())}
|
"api_commands": sorted(_functionMaper.keys())}
|
||||||
@ -1401,7 +1426,7 @@ class CMD_SickBeardAddRootDir(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" add a parent directory to sickrage's config """
|
""" add a parent directory to sickrage's config """
|
||||||
|
|
||||||
self.location = urllib.unquote_plus(self.location)
|
self.location = urllib.unquote_plus(self.location)
|
||||||
@ -1452,14 +1477,14 @@ class CMD_SickBeardCheckScheduler(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" query the scheduler """
|
""" query the scheduler """
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
sqlResults = myDB.select("SELECT last_backlog FROM info")
|
sqlResults = myDB.select("SELECT last_backlog FROM info")
|
||||||
|
|
||||||
backlogPaused = sickbeard.searchQueueScheduler.action.is_backlog_paused() # @UndefinedVariable
|
backlogPaused = sickbeard.searchQueueScheduler.action.is_backlog_paused() # @UndefinedVariable
|
||||||
backlogRunning = sickbeard.searchQueueScheduler.action.is_backlog_in_progress() # @UndefinedVariable
|
backlogRunning = sickbeard.searchQueueScheduler.action.is_backlog_in_progress() # @UndefinedVariable
|
||||||
nextBacklog = sickbeard.backlogSearchScheduler.nextRun().strftime(dateFormat).decode(sickbeard.SYS_ENCODING)
|
nextBacklog = sickbeard.backlogSearchScheduler.nextrun().strftime(dateFormat).decode(sickbeard.SYS_ENCODING)
|
||||||
|
|
||||||
data = {"backlog_is_paused": int(backlogPaused), "backlog_is_running": int(backlogRunning),
|
data = {"backlog_is_paused": int(backlogPaused), "backlog_is_running": int(backlogRunning),
|
||||||
"last_backlog": _ordinal_to_dateForm(sqlResults[0]["last_backlog"]),
|
"last_backlog": _ordinal_to_dateForm(sqlResults[0]["last_backlog"]),
|
||||||
@ -1479,7 +1504,7 @@ class CMD_SickBeardDeleteRootDir(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" delete a parent directory from sickrage's config """
|
""" delete a parent directory from sickrage's config """
|
||||||
if sickbeard.ROOT_DIRS == "":
|
if sickbeard.ROOT_DIRS == "":
|
||||||
return _responds(RESULT_FAILURE, _getRootDirs(), msg="No root directories detected")
|
return _responds(RESULT_FAILURE, _getRootDirs(), msg="No root directories detected")
|
||||||
@ -1522,7 +1547,7 @@ class CMD_SickBeardGetDefaults(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" get sickrage user defaults """
|
""" get sickrage user defaults """
|
||||||
|
|
||||||
anyQualities, bestQualities = _mapQuality(sickbeard.QUALITY_DEFAULT)
|
anyQualities, bestQualities = _mapQuality(sickbeard.QUALITY_DEFAULT)
|
||||||
@ -1542,7 +1567,7 @@ class CMD_SickBeardGetMessages(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
messages = []
|
messages = []
|
||||||
for cur_notification in ui.notifications.get_notifications(self.request.remote_ip):
|
for cur_notification in ui.notifications.get_notifications(self.request.remote_ip):
|
||||||
messages.append({"title": cur_notification.title,
|
messages.append({"title": cur_notification.title,
|
||||||
@ -1560,7 +1585,7 @@ class CMD_SickBeardGetRootDirs(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" get the parent directories defined in sickrage's config """
|
""" get the parent directories defined in sickrage's config """
|
||||||
|
|
||||||
return _responds(RESULT_SUCCESS, _getRootDirs())
|
return _responds(RESULT_SUCCESS, _getRootDirs())
|
||||||
@ -1578,7 +1603,7 @@ class CMD_SickBeardPauseBacklog(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" pause the backlog search """
|
""" pause the backlog search """
|
||||||
if self.pause:
|
if self.pause:
|
||||||
sickbeard.searchQueueScheduler.action.pause_backlog() # @UndefinedVariable
|
sickbeard.searchQueueScheduler.action.pause_backlog() # @UndefinedVariable
|
||||||
@ -1597,7 +1622,7 @@ class CMD_SickBeardPing(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" check to see if sickrage is running """
|
""" check to see if sickrage is running """
|
||||||
self.set_header('Cache-Control', "max-age=0,no-cache,no-store")
|
self.set_header('Cache-Control', "max-age=0,no-cache,no-store")
|
||||||
if sickbeard.started:
|
if sickbeard.started:
|
||||||
@ -1615,7 +1640,7 @@ class CMD_SickBeardRestart(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" restart sickrage """
|
""" restart sickrage """
|
||||||
sickbeard.events.put(sickbeard.events.SystemEvent.RESTART)
|
sickbeard.events.put(sickbeard.events.SystemEvent.RESTART)
|
||||||
return _responds(RESULT_SUCCESS, msg="SickRage is restarting...")
|
return _responds(RESULT_SUCCESS, msg="SickRage is restarting...")
|
||||||
@ -1648,7 +1673,7 @@ class CMD_SickBeardSearchIndexers(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" search for show at tvdb with a given string and language """
|
""" search for show at tvdb with a given string and language """
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
@ -1770,7 +1795,7 @@ class CMD_SickBeardSetDefaults(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" set sickrage user defaults """
|
""" set sickrage user defaults """
|
||||||
|
|
||||||
quality_map = {'sdtv': Quality.SDTV,
|
quality_map = {'sdtv': Quality.SDTV,
|
||||||
@ -1829,7 +1854,7 @@ class CMD_SickBeardShutdown(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" shutdown sickrage """
|
""" shutdown sickrage """
|
||||||
sickbeard.events.put(sickbeard.events.SystemEvent.SHUTDOWN)
|
sickbeard.events.put(sickbeard.events.SystemEvent.SHUTDOWN)
|
||||||
return _responds(RESULT_SUCCESS, msg="SickRage is shutting down...")
|
return _responds(RESULT_SUCCESS, msg="SickRage is shutting down...")
|
||||||
@ -1854,15 +1879,15 @@ class CMD_Show(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display information for a given show """
|
""" display information for a given show """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
return _responds(RESULT_FAILURE, msg="Show not found")
|
return _responds(RESULT_FAILURE, msg="Show not found")
|
||||||
|
|
||||||
showDict = {}
|
showDict = {}
|
||||||
showDict["season_list"] = CMD_ShowSeasonList((), {"indexerid": self.indexerid}).run()["data"]
|
showDict["season_list"] = CMD_ShowSeasonList((), {"indexerid": self.indexerid}).run(rh)["data"]
|
||||||
showDict["cache"] = CMD_ShowCache((), {"indexerid": self.indexerid}).run()["data"]
|
showDict["cache"] = CMD_ShowCache((), {"indexerid": self.indexerid}).run(rh)["data"]
|
||||||
|
|
||||||
genreList = []
|
genreList = []
|
||||||
if showObj.genre:
|
if showObj.genre:
|
||||||
@ -1964,7 +1989,7 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" add a show in sickrage with an existing folder """
|
""" add a show in sickrage with an existing folder """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if showObj:
|
if showObj:
|
||||||
@ -1974,7 +1999,7 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
return _responds(RESULT_FAILURE, msg='Not a valid location')
|
return _responds(RESULT_FAILURE, msg='Not a valid location')
|
||||||
|
|
||||||
indexerName = None
|
indexerName = None
|
||||||
indexerResult = CMD_SickBeardSearchIndexers([], {indexer_ids[self.indexer]: self.indexerid}).run()
|
indexerResult = CMD_SickBeardSearchIndexers([], {indexer_ids[self.indexer]: self.indexerid}).run(rh)
|
||||||
|
|
||||||
if indexerResult['result'] == result_type_map[RESULT_SUCCESS]:
|
if indexerResult['result'] == result_type_map[RESULT_SUCCESS]:
|
||||||
if not indexerResult['data']['results']:
|
if not indexerResult['data']['results']:
|
||||||
@ -2078,7 +2103,7 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" add a show in sickrage with an existing folder """
|
""" add a show in sickrage with an existing folder """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if showObj:
|
if showObj:
|
||||||
@ -2139,7 +2164,7 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
newStatus = self.status
|
newStatus = self.status
|
||||||
|
|
||||||
indexerName = None
|
indexerName = None
|
||||||
indexerResult = CMD_SickBeardSearchIndexers([], {indexer_ids[self.indexer]: self.indexerid}).run()
|
indexerResult = CMD_SickBeardSearchIndexers([], {indexer_ids[self.indexer]: self.indexerid}).run(rh)
|
||||||
|
|
||||||
if indexerResult['result'] == result_type_map[RESULT_SUCCESS]:
|
if indexerResult['result'] == result_type_map[RESULT_SUCCESS]:
|
||||||
if not indexerResult['data']['results']:
|
if not indexerResult['data']['results']:
|
||||||
@ -2194,7 +2219,7 @@ class CMD_ShowCache(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" check sickrage's cache to see if the banner or poster image for a show is valid """
|
""" check sickrage's cache to see if the banner or poster image for a show is valid """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2236,7 +2261,7 @@ class CMD_ShowDelete(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" delete a show in sickrage """
|
""" delete a show in sickrage """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2273,7 +2298,7 @@ class CMD_ShowGetQuality(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" get quality setting for a show in sickrage """
|
""" get quality setting for a show in sickrage """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2302,9 +2327,9 @@ class CMD_ShowGetPoster(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" get the poster for a show in sickrage """
|
""" get the poster for a show in sickrage """
|
||||||
return {'outputType': 'image', 'image': WebRoot().showPoster(self.indexerid, 'poster')}
|
return {'outputType': 'image', 'image': rh.showPoster(self.indexerid, 'poster')}
|
||||||
|
|
||||||
|
|
||||||
class CMD_ShowGetBanner(ApiCall):
|
class CMD_ShowGetBanner(ApiCall):
|
||||||
@ -2325,9 +2350,9 @@ class CMD_ShowGetBanner(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" get the banner for a show in sickrage """
|
""" get the banner for a show in sickrage """
|
||||||
return {'outputType': 'image', 'image': WebRoot().showPoster(self.indexerid, 'banner')}
|
return {'outputType': 'image', 'image': self.showPoster(self.indexerid, 'banner')}
|
||||||
|
|
||||||
|
|
||||||
class CMD_ShowPause(ApiCall):
|
class CMD_ShowPause(ApiCall):
|
||||||
@ -2350,7 +2375,7 @@ class CMD_ShowPause(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" set a show's paused state in sickrage """
|
""" set a show's paused state in sickrage """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2381,7 +2406,7 @@ class CMD_ShowRefresh(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" refresh a show in sickrage """
|
""" refresh a show in sickrage """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2417,7 +2442,7 @@ class CMD_ShowSeasonList(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display the season list for a given show """
|
""" display the season list for a given show """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2457,7 +2482,7 @@ class CMD_ShowSeasons(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display a listing of episodes for all or a given show """
|
""" display a listing of episodes for all or a given show """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2538,7 +2563,7 @@ class CMD_ShowSetQuality(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" set the quality for a show in sickrage by taking in a deliminated
|
""" set the quality for a show in sickrage by taking in a deliminated
|
||||||
string of qualities, map to their value and combine for new values
|
string of qualities, map to their value and combine for new values
|
||||||
"""
|
"""
|
||||||
@ -2595,7 +2620,7 @@ class CMD_ShowStats(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display episode statistics for a given show """
|
""" display episode statistics for a given show """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2704,7 +2729,7 @@ class CMD_ShowUpdate(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" update a show in sickrage """
|
""" update a show in sickrage """
|
||||||
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(self.indexerid))
|
||||||
if not showObj:
|
if not showObj:
|
||||||
@ -2734,7 +2759,7 @@ class CMD_Shows(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display_is_int_multi( self.indexerid )shows in sickrage """
|
""" display_is_int_multi( self.indexerid )shows in sickrage """
|
||||||
shows = {}
|
shows = {}
|
||||||
for curShow in sickbeard.showList:
|
for curShow in sickbeard.showList:
|
||||||
@ -2769,7 +2794,7 @@ class CMD_Shows(ApiCall):
|
|||||||
showDict['next_ep_airdate'] = ''
|
showDict['next_ep_airdate'] = ''
|
||||||
|
|
||||||
showDict["cache"] = \
|
showDict["cache"] = \
|
||||||
CMD_ShowCache((), {"indexerid": curShow.indexerid}).run()["data"]
|
CMD_ShowCache((), {"indexerid": curShow.indexerid}).run(rh)["data"]
|
||||||
if not showDict["network"]:
|
if not showDict["network"]:
|
||||||
showDict["network"] = ""
|
showDict["network"] = ""
|
||||||
if self.sort == "name":
|
if self.sort == "name":
|
||||||
@ -2790,7 +2815,7 @@ class CMD_ShowsStats(ApiCall):
|
|||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, args, kwargs)
|
ApiCall.__init__(self, args, kwargs)
|
||||||
|
|
||||||
def run(self):
|
def run(self, rh):
|
||||||
""" display the global shows and episode stats """
|
""" display the global shows and episode stats """
|
||||||
stats = {}
|
stats = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user