mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-16 06:15:09 -05:00
Added backlog API.
This commit is contained in:
parent
924dc04a07
commit
1e8c0abac4
@ -52,6 +52,7 @@ addList("Command", "History", "?cmd=history", "history");
|
|||||||
addOption("Command", "History.Clear", "?cmd=history.clear", "", "", "action");
|
addOption("Command", "History.Clear", "?cmd=history.clear", "", "", "action");
|
||||||
addOption("Command", "History.Trim", "?cmd=history.trim", "", "", "action");
|
addOption("Command", "History.Trim", "?cmd=history.trim", "", "", "action");
|
||||||
addList("Command", "Failed", "?cmd=failed", "failed");
|
addList("Command", "Failed", "?cmd=failed", "failed");
|
||||||
|
addOption("Command", "Backlog", "?cmd=backlog");
|
||||||
addList("Command", "PostProcess", "?cmd=postprocess", "postprocess", "", "","action");
|
addList("Command", "PostProcess", "?cmd=postprocess", "postprocess", "", "","action");
|
||||||
|
|
||||||
addList("Command", "Logs", "?cmd=logs", "logs");
|
addList("Command", "Logs", "?cmd=logs", "logs");
|
||||||
|
@ -37,7 +37,7 @@ 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 SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
from sickbeard.common import SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
||||||
from common import Quality, qualityPresetStrings, statusStrings
|
from common import Quality, Overview, qualityPresetStrings, statusStrings
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
@ -1286,6 +1286,45 @@ class CMD_Failed(ApiCall):
|
|||||||
|
|
||||||
return _responds(RESULT_SUCCESS, sqlResults)
|
return _responds(RESULT_SUCCESS, sqlResults)
|
||||||
|
|
||||||
|
class CMD_Backlog(ApiCall):
|
||||||
|
_help = {"desc": "display backlogged episodes"}
|
||||||
|
|
||||||
|
def __init__(self, handler, args, kwargs):
|
||||||
|
# required
|
||||||
|
# optional
|
||||||
|
# super, missing, help
|
||||||
|
ApiCall.__init__(self, handler, args, kwargs)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
""" display backlogged episodes """
|
||||||
|
|
||||||
|
shows = []
|
||||||
|
|
||||||
|
myDB = db.DBConnection(row_type="dict")
|
||||||
|
for curShow in sickbeard.showList:
|
||||||
|
|
||||||
|
showEps = []
|
||||||
|
|
||||||
|
sqlResults = myDB.select(
|
||||||
|
"SELECT * FROM tv_episodes WHERE showid = ? ORDER BY season DESC, episode DESC",
|
||||||
|
[curShow.indexerid])
|
||||||
|
|
||||||
|
for curResult in sqlResults:
|
||||||
|
|
||||||
|
curEpCat = curShow.getOverview(int(curResult["status"]))
|
||||||
|
if curEpCat and curEpCat in (Overview.WANTED, Overview.QUAL):
|
||||||
|
showEps.append(curResult)
|
||||||
|
|
||||||
|
if showEps:
|
||||||
|
shows.append({
|
||||||
|
"indexerid": curShow.indexerid,
|
||||||
|
"show_name": curShow.name,
|
||||||
|
"status": curShow.status,
|
||||||
|
"episodes": showEps
|
||||||
|
})
|
||||||
|
|
||||||
|
return _responds(RESULT_SUCCESS, shows)
|
||||||
|
|
||||||
class CMD_Logs(ApiCall):
|
class CMD_Logs(ApiCall):
|
||||||
_help = {"desc": "view sickrage's log",
|
_help = {"desc": "view sickrage's log",
|
||||||
"optionalParameters": {"min_level ": {
|
"optionalParameters": {"min_level ": {
|
||||||
@ -2833,6 +2872,7 @@ _functionMaper = {"help": CMD_Help,
|
|||||||
"history.clear": CMD_HistoryClear,
|
"history.clear": CMD_HistoryClear,
|
||||||
"history.trim": CMD_HistoryTrim,
|
"history.trim": CMD_HistoryTrim,
|
||||||
"failed": CMD_Failed,
|
"failed": CMD_Failed,
|
||||||
|
"backlog": CMD_Backlog,
|
||||||
"logs": CMD_Logs,
|
"logs": CMD_Logs,
|
||||||
"sb": CMD_SickBeard,
|
"sb": CMD_SickBeard,
|
||||||
"postprocess": CMD_PostProcess,
|
"postprocess": CMD_PostProcess,
|
||||||
|
Loading…
Reference in New Issue
Block a user