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

Merge pull request #1035 from Hellowlol/deleteshowboolapi

Add removefiles to api show.delete
This commit is contained in:
echel0n 2014-12-07 01:32:41 -08:00
commit 882950f661
2 changed files with 16 additions and 5 deletions

View File

@ -85,6 +85,10 @@ addOption("logs", "Info", "&min_level=info");
addOption("logs", "Warning", "&min_level=warning"); addOption("logs", "Warning", "&min_level=warning");
addOption("logs", "Error", "&min_level=error"); addOption("logs", "Error", "&min_level=error");
addOption("show.delete", "Optional Param", "", 1);
addOption("show.delete", "removefiles", "&removefiles=0");
addOption("show.delete", "removefiles", "&removefiles=1");
addOption("postprocess", "Optional Param", "", 1); addOption("postprocess", "Optional Param", "", 1);
addOption("postprocess", "C:\\PATH\\TO\\DIR", "&path=C:\\Temp"); addOption("postprocess", "C:\\PATH\\TO\\DIR", "&path=C:\\Temp");
addOption("postprocess", "return_data", "&return_data=1"); addOption("postprocess", "return_data", "&return_data=1");

View File

@ -2286,6 +2286,7 @@ class CMD_ShowDelete(ApiCall):
"optionalParameters": { "optionalParameters": {
"tvdbid": {"desc": "thetvdb.com unique id of a show"}, "tvdbid": {"desc": "thetvdb.com unique id of a show"},
"tvrageid": {"desc": "tvrage.com unique id of a show"}, "tvrageid": {"desc": "tvrage.com unique id of a show"},
"removefiles":{"desc": "Deletes the files, there is no going back!"},
} }
} }
@ -2293,6 +2294,7 @@ class CMD_ShowDelete(ApiCall):
# required # required
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", []) self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", [])
# optional # optional
self.removefiles, args = self.check_params(args, kwargs, "removefiles", 0, False, "int", [0,1])
# super, missing, help # super, missing, help
ApiCall.__init__(self, handler, args, kwargs) ApiCall.__init__(self, handler, args, kwargs)
@ -2306,7 +2308,12 @@ class CMD_ShowDelete(ApiCall):
showObj) or sickbeard.showQueueScheduler.action.isBeingUpdated(showObj): # @UndefinedVariable showObj) or sickbeard.showQueueScheduler.action.isBeingUpdated(showObj): # @UndefinedVariable
return _responds(RESULT_FAILURE, msg="Show can not be deleted while being added or updated") return _responds(RESULT_FAILURE, msg="Show can not be deleted while being added or updated")
showObj.deleteShow() if sickbeard.USE_TRAKT and sickbeard.TRAKT_SYNC:
# remove show from trakt.tv library
sickbeard.traktCheckerScheduler.action.removeShowFromTraktLibrary(showObj)
showObj.deleteShow(bool(self.removefiles))
return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has been deleted") return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has been deleted")