'Receives a dir list and add them. Adds the ones with given TVDB IDs first, then forwards
along to the newShow page.'

def addExistingShows(self, shows_to_add, promptForSettings, **kwargs):

    if (not shows_to_add):
        shows_to_add = []
    elif (not isinstance(shows_to_add, list)):
        shows_to_add = [shows_to_add]
    shows_to_add = [unquote_plus(x) for x in shows_to_add]
    indexer_id_given = []
    dirs_only = []
    for cur_dir in shows_to_add:
        if (u'|' in cur_dir):
            split_vals = cur_dir.split(u'|')
            if (len(split_vals) < 3):
                dirs_only.append(cur_dir)
        if (u'|' not in cur_dir):
            dirs_only.append(cur_dir)
        else:
            (indexer, show_dir, indexer_id, show_name) = self.split_extra_show(cur_dir)
            if ((not show_dir) or (not indexer_id) or (not show_name)):
                continue
            indexer_id_given.append((int(indexer), show_dir, int(indexer_id), show_name))
    if (shows_to_add and config.checkbox_to_value(promptForSettings)):
        return self.newShow(shows_to_add[0], shows_to_add[1:])
    num_added = 0
    for cur_show in indexer_id_given:
        (indexer, show_dir, indexer_id, show_name) = cur_show
        if ((indexer is not None) and (indexer_id is not None)):
            sickbeard.showQueueScheduler.action.add_show(indexer, indexer_id, show_dir, default_status=sickbeard.STATUS_DEFAULT, quality=sickbeard.QUALITY_DEFAULT, season_folders=sickbeard.SEASON_FOLDERS_DEFAULT, subtitles=sickbeard.SUBTITLES_DEFAULT, anime=sickbeard.ANIME_DEFAULT, scene=sickbeard.SCENE_DEFAULT, default_status_after=sickbeard.STATUS_DEFAULT_AFTER)
            num_added += 1
    if num_added:
        ui.notifications.message(_(u'Shows    Added'), _(u'Automatically    added    {num_shows}    from    their    existing    metadata    files').format(num_shows=str(num_added)))
    if (not dirs_only):
        return self.redirect(u'/home/')
    return self.newShow(dirs_only[0], dirs_only[1:])
