1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Added failed download API.

This commit is contained in:
Tab Bennedum 2014-11-25 13:33:33 -05:00
parent a3c733d686
commit 924dc04a07
2 changed files with 36 additions and 0 deletions

View File

@ -51,6 +51,7 @@ addList("Command", "Scene Exceptions", "?cmd=exceptions", "exceptions");
addList("Command", "History", "?cmd=history", "history"); 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", "PostProcess", "?cmd=postprocess", "postprocess", "", "","action"); addList("Command", "PostProcess", "?cmd=postprocess", "postprocess", "", "","action");
addList("Command", "Logs", "?cmd=logs", "logs"); addList("Command", "Logs", "?cmd=logs", "logs");
@ -321,6 +322,15 @@ addOption("history-limit", "Optional Param", "", 1);
addOption("history-limit", "Show Only Downloaded", "&type=downloaded"); addOption("history-limit", "Show Only Downloaded", "&type=downloaded");
addOption("history-limit", "Show Only Snatched", "&type=snatched"); addOption("history-limit", "Show Only Snatched", "&type=snatched");
addOption("failed", "Optional Param", "", 1);
//addOptGroup("failed", "Limit Results");
addList("failed", "Limit Results (2)", "&limit=2", "failed-limit");
addList("failed", "Limit Results (25)", "&limit=25", "failed-limit");
addList("failed", "Limit Results (50)", "&limit=50", "failed-limit");
//endOptGroup("failed");
addOption("failed-limit", "Optional Param", "", 1);
addOption("exceptions", "Optional Param", "", 1); addOption("exceptions", "Optional Param", "", 1);
#for $curShow in $sortedShowList: #for $curShow in $sortedShowList:
addOption("exceptions", "$curShow.name", "&indexerid=$curShow.indexerid"); addOption("exceptions", "$curShow.name", "&indexerid=$curShow.indexerid");

View File

@ -1260,6 +1260,31 @@ class CMD_HistoryTrim(ApiCall):
return _responds(RESULT_SUCCESS, msg="Removed history entries greater than 30 days old") return _responds(RESULT_SUCCESS, msg="Removed history entries greater than 30 days old")
class CMD_Failed(ApiCall):
_help = {"desc": "display failed downloads",
"optionalParameters": {"limit": {"desc": "limit returned results"}
}
}
def __init__(self, handler, args, kwargs):
# required
# optional
self.limit, args = self.check_params(args, kwargs, "limit", 100, False, "int", [])
# super, missing, help
ApiCall.__init__(self, handler, args, kwargs)
def run(self):
""" display failed downloads """
myDB = db.DBConnection('failed.db', row_type="dict")
ulimit = min(int(self.limit), 100)
if ulimit == 0:
sqlResults = myDB.select("SELECT * FROM failed")
else:
sqlResults = myDB.select("SELECT * FROM failed LIMIT ?", [ulimit])
return _responds(RESULT_SUCCESS, sqlResults)
class CMD_Logs(ApiCall): class CMD_Logs(ApiCall):
_help = {"desc": "view sickrage's log", _help = {"desc": "view sickrage's log",
@ -2807,6 +2832,7 @@ _functionMaper = {"help": CMD_Help,
"history": CMD_History, "history": CMD_History,
"history.clear": CMD_HistoryClear, "history.clear": CMD_HistoryClear,
"history.trim": CMD_HistoryTrim, "history.trim": CMD_HistoryTrim,
"failed": CMD_Failed,
"logs": CMD_Logs, "logs": CMD_Logs,
"sb": CMD_SickBeard, "sb": CMD_SickBeard,
"postprocess": CMD_PostProcess, "postprocess": CMD_PostProcess,