'Add a new show to SiCKRAGE'

def run(self):

    showObj = findCertainShow(sickrage.srCore.SHOWLIST, int(self.indexerid))
    if showObj:
        return _responds(RESULT_FAILURE, msg=u'An    existing    indexerid    already    exists    in    database')
    if (not self.location):
        if (sickrage.srCore.srConfig.ROOT_DIRS != u''):
            root_dirs = sickrage.srCore.srConfig.ROOT_DIRS.split(u'|')
            root_dirs.pop(0)
            default_index = int(sickrage.srCore.srConfig.ROOT_DIRS.split(u'|')[0])
            self.location = root_dirs[default_index]
        else:
            return _responds(RESULT_FAILURE, msg=u'Root    directory    is    not    set,    please    provide    a    location')
    if (not os.path.isdir(self.location)):
        return _responds(RESULT_FAILURE, msg=((u"'" + self.location) + u"'    is    not    a    valid    location"))
    quality_map = {u'sdtv': Quality.SDTV, u'sddvd': Quality.SDDVD, u'hdtv': Quality.HDTV, u'rawhdtv': Quality.RAWHDTV, u'fullhdtv': Quality.FULLHDTV, u'hdwebdl': Quality.HDWEBDL, u'fullhdwebdl': Quality.FULLHDWEBDL, u'hdbluray': Quality.HDBLURAY, u'fullhdbluray': Quality.FULLHDBLURAY, u'unknown': Quality.UNKNOWN}
    newQuality = int(sickrage.srCore.srConfig.QUALITY_DEFAULT)
    iqualityID = []
    aqualityID = []
    if isinstance(self.initial, collections.Iterable):
        for quality in self.initial:
            iqualityID.append(quality_map[quality])
    if isinstance(self.archive, collections.Iterable):
        for quality in self.archive:
            aqualityID.append(quality_map[quality])
    if (iqualityID or aqualityID):
        newQuality = Quality.combineQualities(iqualityID, aqualityID)
    newStatus = sickrage.srCore.srConfig.STATUS_DEFAULT
    if self.status:
        for status in statusStrings.statusStrings:
            if (statusStrings[status].lower() == str(self.status).lower()):
                self.status = status
                break
        if (self.status not in statusStrings.statusStrings):
            raise ApiError(u'Invalid    Status')
        if (int(self.status) not in (WANTED, SKIPPED, IGNORED)):
            return _responds(RESULT_FAILURE, msg=u'Status    prohibited')
        newStatus = self.status
    default_ep_status_after = sickrage.srCore.srConfig.STATUS_DEFAULT_AFTER
    if self.future_status:
        for status in statusStrings.statusStrings:
            if (statusStrings[status].lower() == str(self.future_status).lower()):
                self.future_status = status
                break
        if (self.future_status not in statusStrings.statusStrings):
            raise ApiError(u'Invalid    Status')
        if (int(self.future_status) not in (WANTED, SKIPPED, IGNORED)):
            return _responds(RESULT_FAILURE, msg=u'Status    prohibited')
        default_ep_status_after = self.future_status
    indexerName = None
    indexerResult = CMD_SiCKRAGESearchIndexers([], {indexer_ids[self.indexer]: self.indexerid}).run()
    if (indexerResult[u'result'] == result_type_map[RESULT_SUCCESS]):
        if (not indexerResult[u'data'][u'results']):
            return _responds(RESULT_FAILURE, msg=u'Empty    results    returned,    check    indexerid    and    try    again')
        if ((len(indexerResult[u'data'][u'results']) == 1) and (u'name' in indexerResult[u'data'][u'results'][0])):
            indexerName = indexerResult[u'data'][u'results'][0][u'name']
    if (not indexerName):
        return _responds(RESULT_FAILURE, msg=u'Unable    to    retrieve    information    from    indexer')
    indexer = indexerResult[u'data'][u'results'][0][u'indexer']
    showPath = os.path.join(self.location, sanitizeFileName(indexerName))
    if sickrage.srCore.srConfig.ADD_SHOWS_WO_DIR:
        sickrage.srCore.srLogger.info(((u'Skipping    initial    creation    of    ' + showPath) + u'    due    to    config.ini    setting'))
    else:
        dir_exists = makeDir(showPath)
        if (not dir_exists):
            sickrage.srCore.srLogger.error(((u'API    ::    Unable    to    create    the    folder    ' + showPath) + u",    can't    add    the    show"))
            return _responds(RESULT_FAILURE, {u'path': showPath}, ((u'Unable    to    create    the    folder    ' + showPath) + u",    can't    add    the    show"))
        else:
            chmodAsParent(showPath)
    sickrage.srCore.SHOWQUEUE.addShow(int(indexer), int(self.indexerid), showPath, default_status=newStatus, quality=newQuality, flatten_folders=int(self.flatten_folders), lang=self.lang, subtitles=self.subtitles, anime=self.anime, scene=self.scene, default_status_after=default_ep_status_after, archive=self.archive_firstmatch)
    return _responds(RESULT_SUCCESS, {u'name': indexerName}, (indexerName + u'    has    been    queued    to    be    added'))
