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

Merge pull request #69 from joshjowen/master

Fixed issue #49
This commit is contained in:
echel0n 2014-04-26 00:17:52 -07:00
commit 4cf5dc0fba

View File

@ -1783,7 +1783,7 @@ class CMD_Show(ApiCall):
class CMD_ShowAddExisting(ApiCall):
_help = {"desc": "add a show in sickbeard with an existing folder",
"requiredParameters": {"indexerid": {"desc": "thetvdb.com unique id of a show"},
"requiredParameters": {"tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com id"},
"location": {"desc": "full path to the existing folder for the show"}
},
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
@ -1794,9 +1794,19 @@ class CMD_ShowAddExisting(ApiCall):
}
def __init__(self, args, kwargs):
if "tvdbid" in args or "tvdbid" in kwargs:
_INDEXER_INT = 1
_INDEXER = "tvdbid"
elif "tvrageid" in args or "tvrageid" in kwargs:
_INDEXER_INT = 2
_INDEXER = "tvrageid"
else:
_INDEXER_INT = None
_INDEXER = None
# required
self.indexerid, args = self.check_params(args, kwargs, _INDEXER, None, True, "int", [])
self.indexer = _INDEXER_INT
self.location, args = self.check_params(args, kwargs, "location", None, True, "string", [])
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", [])
# optional
self.initial, args = self.check_params(args, kwargs, "initial", None, False, "list",
["sdtv", "sddvd", "hdtv", "rawhdtv", "fullhdtv", "hdwebdl",
@ -1821,7 +1831,7 @@ class CMD_ShowAddExisting(ApiCall):
return _responds(RESULT_FAILURE, msg='Not a valid location')
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 not indexerResult['data']['results']:
@ -1858,14 +1868,14 @@ class CMD_ShowAddExisting(ApiCall):
if iqualityID or 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
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
class CMD_ShowAddNew(ApiCall):
_help = {"desc": "add a new show to sickbeard",
"requiredParameters": {"indexerid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
"requiredParameters": {"tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com id"}
},
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
"location": {"desc": "base path for where the show folder is to be created"},
@ -1884,8 +1894,18 @@ class CMD_ShowAddNew(ApiCall):
'sv': 8, 'sl': 30}
def __init__(self, args, kwargs):
if "tvdbid" in args or "tvdbid" in kwargs:
_INDEXER_INT = 1
_INDEXER = "tvdbid"
elif "tvrageid" in args or "tvrageid" in kwargs:
_INDEXER_INT = 2
_INDEXER = "tvrageid"
else:
_INDEXER_INT = None
_INDEXER = None
# required
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, True, "int", [])
self.indexerid, args = self.check_params(args, kwargs, _INDEXER, None, True, "int", [])
self.indexer = _INDEXER_INT
# optional
self.location, args = self.check_params(args, kwargs, "location", None, False, "string", [])
self.initial, args = self.check_params(args, kwargs, "initial", None, False, "list",
@ -1965,7 +1985,7 @@ class CMD_ShowAddNew(ApiCall):
newStatus = self.status
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 not indexerResult['data']['results']:
@ -1991,7 +2011,7 @@ class CMD_ShowAddNew(ApiCall):
else:
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,
self.lang) #@UndefinedVariable
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")