1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 03:22:22 -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

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>API Builder</title>
<script type="text/javascript" charset="utf-8">
@ -22,7 +22,7 @@ sbRoot = "$sbRoot";
</style>
<script type="text/javascript">
var hide_empty_list=true;
var hide_empty_list=true;
var disable_empty_list=true;
addListGroup("api", "Command");
@ -85,6 +85,10 @@ addOption("logs", "Info", "&min_level=info");
addOption("logs", "Warning", "&min_level=warning");
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", "C:\\PATH\\TO\\DIR", "&path=C:\\Temp");
addOption("postprocess", "return_data", "&return_data=1");

View File

@ -1952,7 +1952,7 @@ class CMD_Show(ApiCall):
showDict["anime"] = showObj.anime
showDict["airs"] = str(showObj.airs).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ')
showDict["dvdorder"] = showObj.dvdorder
if showObj.rls_require_words:
showDict["rls_require_words"] = showObj.rls_require_words.split(", ")
else:
@ -1962,7 +1962,7 @@ class CMD_Show(ApiCall):
showDict["rls_ignore_words"] = showObj.rls_ignore_words.split(", ")
else:
showDict["rls_ignore_words"] = []
showDict["scene"] = showObj.scene
showDict["archive_firstmatch"] = showObj.archive_firstmatch
@ -2286,6 +2286,7 @@ class CMD_ShowDelete(ApiCall):
"optionalParameters": {
"tvdbid": {"desc": "thetvdb.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
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", [])
# optional
self.removefiles, args = self.check_params(args, kwargs, "removefiles", 0, False, "int", [0,1])
# super, missing, help
ApiCall.__init__(self, handler, args, kwargs)
@ -2306,7 +2308,12 @@ class CMD_ShowDelete(ApiCall):
showObj) or sickbeard.showQueueScheduler.action.isBeingUpdated(showObj): # @UndefinedVariable
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")