'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 = [urllib.unquote_plus(x) for x in shows_to_add]
    promptForSettings = sickrage.srCore.srConfig.checkbox_to_value(promptForSettings)
    indexer_id_given = []
    dirs_only = []
    for cur_dir in shows_to_add:
        split_vals = cur_dir.split(u'|')
        if split_vals:
            if (len(split_vals) > 2):
                (indexer, show_dir, indexer_id, show_name) = self.split_extra_show(cur_dir)
                if all([show_dir, indexer_id, show_name]):
                    indexer_id_given.append((int(indexer), show_dir, int(indexer_id), show_name))
            else:
                dirs_only.append(cur_dir)
        else:
            dirs_only.append(cur_dir)
    if (promptForSettings and shows_to_add):
        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)):
            sickrage.srCore.SHOWQUEUE.addShow(indexer, indexer_id, show_dir, default_status=sickrage.srCore.srConfig.STATUS_DEFAULT, quality=sickrage.srCore.srConfig.QUALITY_DEFAULT, flatten_folders=sickrage.srCore.srConfig.FLATTEN_FOLDERS_DEFAULT, subtitles=sickrage.srCore.srConfig.SUBTITLES_DEFAULT, anime=sickrage.srCore.srConfig.ANIME_DEFAULT, scene=sickrage.srCore.srConfig.SCENE_DEFAULT, default_status_after=sickrage.srCore.srConfig.STATUS_DEFAULT_AFTER, archive=sickrage.srCore.srConfig.ARCHIVE_DEFAULT)
            num_added += 1
    if num_added:
        sickrage.srCore.srNotifications.message(u'Shows    Added', ((u'Automatically    added    ' + str(num_added)) + u'    from    their    existing    metadata    files'))
    if (not dirs_only):
        return self.redirect(u'/home/')
    return self.newShow(dirs_only[0], dirs_only[1:])
