mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixed addshow and addexisting Api commands to work with indexer
This commit is contained in:
parent
f8ec897010
commit
c2e3cd8689
@ -1784,6 +1784,7 @@ class CMD_Show(ApiCall):
|
|||||||
class CMD_ShowAddExisting(ApiCall):
|
class CMD_ShowAddExisting(ApiCall):
|
||||||
_help = {"desc": "add a show in sickbeard with an existing folder",
|
_help = {"desc": "add a show in sickbeard with an existing folder",
|
||||||
"requiredParameters": {"indexerid": {"desc": "thetvdb.com unique id of a show"},
|
"requiredParameters": {"indexerid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"indexer": {"desc": "Indexer to use 1:thetvdb.com 2:tvrage.com"},
|
||||||
"location": {"desc": "full path to the existing folder for the show"}
|
"location": {"desc": "full path to the existing folder for the show"}
|
||||||
},
|
},
|
||||||
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
||||||
@ -1797,6 +1798,7 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
# required
|
# required
|
||||||
self.location, args = self.check_params(args, kwargs, "location", None, True, "string", [])
|
self.location, args = self.check_params(args, kwargs, "location", None, True, "string", [])
|
||||||
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", [])
|
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", [])
|
||||||
|
self.indexer, args = self.check_params(args, kwargs, "indexer", None, True, "int", [])
|
||||||
# optional
|
# optional
|
||||||
self.initial, args = self.check_params(args, kwargs, "initial", None, False, "list",
|
self.initial, args = self.check_params(args, kwargs, "initial", None, False, "list",
|
||||||
["sdtv", "sddvd", "hdtv", "rawhdtv", "fullhdtv", "hdwebdl",
|
["sdtv", "sddvd", "hdtv", "rawhdtv", "fullhdtv", "hdwebdl",
|
||||||
@ -1821,7 +1823,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([], {"indexerid": self.indexerid}).run()
|
indexerResult = CMD_SickBeardSearchIndexers([], {"indexerid": self.indexerid, "indexer": self.indexer}).run()
|
||||||
|
|
||||||
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']:
|
||||||
@ -1858,14 +1860,15 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
if iqualityID or aqualityID:
|
if iqualityID or aqualityID:
|
||||||
newQuality = Quality.combineQualities(iqualityID, aqualityID)
|
newQuality = Quality.combineQualities(iqualityID, aqualityID)
|
||||||
|
|
||||||
sickbeard.showQueueScheduler.action.addShow(int(self.indexerid), self.location, SKIPPED, newQuality,
|
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), self.location, SKIPPED, newQuality,
|
||||||
int(self.flatten_folders)) #@UndefinedVariable
|
int(self.flatten_folders)) #@UndefinedVariable
|
||||||
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
||||||
|
|
||||||
|
|
||||||
class CMD_ShowAddNew(ApiCall):
|
class CMD_ShowAddNew(ApiCall):
|
||||||
_help = {"desc": "add a new show to sickbeard",
|
_help = {"desc": "add a new show to sickbeard",
|
||||||
"requiredParameters": {"indexerid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
|
"requiredParameters": {"indexerid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
||||||
|
"indexer": {"desc": "Indexer to use 1:thetvdb.com 2:tvrage.com"}
|
||||||
},
|
},
|
||||||
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
||||||
"location": {"desc": "base path for where the show folder is to be created"},
|
"location": {"desc": "base path for where the show folder is to be created"},
|
||||||
@ -1886,6 +1889,7 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
def __init__(self, args, kwargs):
|
def __init__(self, args, kwargs):
|
||||||
# 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", [])
|
||||||
|
self.indexer, args = self.check_params(args, kwargs, "indexer", None, True, "int", [])
|
||||||
# optional
|
# optional
|
||||||
self.location, args = self.check_params(args, kwargs, "location", None, False, "string", [])
|
self.location, args = self.check_params(args, kwargs, "location", None, False, "string", [])
|
||||||
self.initial, args = self.check_params(args, kwargs, "initial", None, False, "list",
|
self.initial, args = self.check_params(args, kwargs, "initial", None, False, "list",
|
||||||
@ -1965,7 +1969,7 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
newStatus = self.status
|
newStatus = self.status
|
||||||
|
|
||||||
indexerName = None
|
indexerName = None
|
||||||
indexerResult = CMD_SickBeardSearchTVDB([], {"indexerid": self.indexerid}).run()
|
indexerResult = CMD_SickBeardSearchIndexers([], {"indexerid": self.indexerid, "indexer": self.indexer}).run()
|
||||||
|
|
||||||
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']:
|
||||||
@ -1991,7 +1995,7 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
else:
|
else:
|
||||||
helpers.chmodAsParent(showPath)
|
helpers.chmodAsParent(showPath)
|
||||||
|
|
||||||
sickbeard.showQueueScheduler.action.addShow(int(self.indexerid), showPath, newStatus, newQuality,
|
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), showPath, newStatus, newQuality,
|
||||||
int(self.flatten_folders), self.subtitles,
|
int(self.flatten_folders), self.subtitles,
|
||||||
self.lang) #@UndefinedVariable
|
self.lang) #@UndefinedVariable
|
||||||
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
||||||
|
Loading…
Reference in New Issue
Block a user