'Add a new show to SickRage'

def run(self):

    show_obj = Show.find(sickbeard.showList, int(self.indexerid))
    if show_obj:
        return _responds(RESULT_FAILURE, msg=u'An    existing    indexerid    already    exists    in    database')
    if (not self.location):
        if (sickbeard.ROOT_DIRS != u''):
            root_dirs = sickbeard.ROOT_DIRS.split(u'|')
            root_dirs.pop(0)
            default_index = int(sickbeard.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 ek(os.path.isdir, self.location)):
        return _responds(RESULT_FAILURE, msg=((u"'" + self.location) + u"'    is    not    a    valid    location"))
    new_quality = int(sickbeard.QUALITY_DEFAULT)
    i_quality_id = []
    a_quality_id = []
    if self.initial:
        for quality in self.initial:
            i_quality_id.append(QUALITY_MAP[quality])
    if self.archive:
        for quality in self.archive:
            a_quality_id.append(QUALITY_MAP[quality])
    if (i_quality_id or a_quality_id):
        new_quality = Quality.combineQualities(i_quality_id, a_quality_id)
    new_status = sickbeard.STATUS_DEFAULT
    if self.status:
        for status in statusStrings:
            if (statusStrings[status].lower() == str(self.status).lower()):
                self.status = status
                break
        if (self.status not in statusStrings):
            raise ApiError(u'Invalid    Status')
        if (int(self.status) not in (WANTED, SKIPPED, IGNORED)):
            return _responds(RESULT_FAILURE, msg=u'Status    prohibited')
        new_status = self.status
    default_ep_status_after = sickbeard.STATUS_DEFAULT_AFTER
    if self.future_status:
        for status in statusStrings:
            if (statusStrings[status].lower() == str(self.future_status).lower()):
                self.future_status = status
                break
        if (self.future_status not in 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
    indexer_name = None
    indexer_result = CMDSickBeardSearchIndexers([], {indexer_ids[self.indexer]: self.indexerid, u'lang': self.lang}).run()
    if (indexer_result['result'] == result_type_map[RESULT_SUCCESS]):
        if (not indexer_result['data'][u'results']):
            return _responds(RESULT_FAILURE, msg=u'Empty    results    returned,    check    indexerid    and    try    again')
        if ((len(indexer_result['data'][u'results']) == 1) and (u'name' in indexer_result['data'][u'results'][0])):
            indexer_name = indexer_result['data'][u'results'][0][u'name']
    if (not indexer_name):
        return _responds(RESULT_FAILURE, msg=u'Unable    to    retrieve    information    from    indexer')
    indexer = indexer_result['data'][u'results'][0][u'indexer']
    show_path = ek(os.path.join, self.location, sanitize_filename(indexer_name))
    if sickbeard.ADD_SHOWS_WO_DIR:
        logger.log(((u'Skipping    initial    creation    of    ' + show_path) + u'    due    to    config.ini    setting'))
    else:
        dir_exists = helpers.makeDir(show_path)
        if (not dir_exists):
            logger.log(((u'API    ::    Unable    to    create    the    folder    ' + show_path) + u",    can't    add    the    show"), logger.ERROR)
            return _responds(RESULT_FAILURE, {u'path': show_path}, ((u'Unable    to    create    the    folder    ' + show_path) + u",    can't    add    the    show"))
        else:
            helpers.chmodAsParent(show_path)
    sickbeard.showQueueScheduler.action.add_show(int(indexer), int(self.indexerid), show_path, default_status=new_status, quality=new_quality, season_folders=int(self.season_folders), lang=self.lang, subtitles=self.subtitles, anime=self.anime, scene=self.scene, default_status_after=default_ep_status_after)
    return _responds(RESULT_SUCCESS, {u'name': indexer_name}, (indexer_name + u'    has    been    queued    to    be    added'))
