예제 #1
0
def allPossibleShowNames(show):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.
    
    show: a TVShow object that we should get the names of
    
    Returns: a list of all the possible show names
    """

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.indexerid)]

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(' ' + curCountry):
                newShowNames.append(curName.replace(' ' + curCountry, ' (' + country_list[curCountry] + ')'))
            elif curName.endswith(' (' + curCountry + ')'):
                newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))

    showNames += newShowNames

    return showNames
예제 #2
0
def allPossibleShowNames(show):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.
    
    show: a TVShow object that we should get the names of
    
    Returns: a list of all the possible show names
    """

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.indexerid)]

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(' ' + curCountry):
                newShowNames.append(curName.replace(' ' + curCountry, ' (' + country_list[curCountry] + ')'))
            elif curName.endswith(' (' + curCountry + ')'):
                newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))

    showNames += newShowNames

    return showNames
예제 #3
0
def allPossibleShowNames(show):

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.tvdbid)]

    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname != None:
        showNames.append(show.tvrname)

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(' '+curCountry):
                newShowNames.append(curName.replace(' '+curCountry, ' ('+country_list[curCountry]+')'))
            elif curName.endswith(' ('+curCountry+')'):
                newShowNames.append(curName.replace(' ('+curCountry+')', ' ('+country_list[curCountry]+')'))

    showNames += newShowNames

    return showNames
예제 #4
0
def allPossibleShowNames(show):

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.tvdbid)]

    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname != None:
        showNames.append(show.tvrname)

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(' ' + curCountry):
                newShowNames.append(
                    curName.replace(' ' + curCountry,
                                    ' (' + country_list[curCountry] + ')'))
            elif curName.endswith(' (' + curCountry + ')'):
                newShowNames.append(
                    curName.replace(' (' + curCountry + ')',
                                    ' (' + country_list[curCountry] + ')'))

    showNames += newShowNames

    return showNames
예제 #5
0
def allPossibleShowNames(show, season=-1):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.
    
    show: a TVShow object that we should get the names of
    
    Returns: a list of all the possible show names
    """

    showNames = get_scene_exceptions(show.tvdbid, season=season)
    if not showNames:  # if we dont have any season specific exceptions fallback to generic exceptions
        season = -1
        showNames = get_scene_exceptions(show.tvdbid, season=season)
    if season in [-1, 1]:
        showNames.append(show.name)
    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname != None and season in [-1, 1]:
        showNames.append(show.tvrname)
    newShowNames = []

    for curName in set(showNames):
        newShowNames.append(curName)
        newShowNames.append(curName.replace(' ', ''))

    showNames = newShowNames

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    # only for none anime
    if not show.is_anime:
        for curName in set(showNames):
            if not curName:
                continue
            for curCountry in country_list:
                if curName.endswith(' ' + curCountry):
                    newShowNames.append(
                        curName.replace(' ' + curCountry,
                                        ' (' + country_list[curCountry] + ')'))
                elif curName.endswith(' (' + curCountry + ')'):
                    newShowNames.append(
                        curName.replace(' (' + curCountry + ')',
                                        ' (' + country_list[curCountry] + ')'))
        showNames += newShowNames

    return showNames
def allPossibleShowNames(show, season=-1):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.
    
    show: a TVShow object that we should get the names of
    
    Returns: a list of all the possible show names
    """

    showNames = get_scene_exceptions(show.tvdbid, season=season)
    if not showNames: # if we dont have any season specific exceptions fallback to generic exceptions
        season = -1
        showNames = get_scene_exceptions(show.tvdbid, season=season)
    if season in [-1, 1]:
        showNames.append(show.name)    
    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname != None and season in [-1, 1]:
        showNames.append(show.tvrname)
    newShowNames = []
    
    for curName in set(showNames):
        newShowNames.append(curName)
        newShowNames.append(curName.replace(' ', ''))
    
    showNames = newShowNames

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    # only for none anime
    if not show.is_anime:
        for curName in set(showNames):
            if not curName:
                continue
            for curCountry in country_list:
                if curName.endswith(' '+curCountry):
                    newShowNames.append(curName.replace(' '+curCountry, ' ('+country_list[curCountry]+')'))
                elif curName.endswith(' ('+curCountry+')'):
                    newShowNames.append(curName.replace(' ('+curCountry+')', ' ('+country_list[curCountry]+')'))
        showNames += newShowNames

    return showNames
예제 #7
0
def allPossibleShowNames(show):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.
    
    show: a TVShow object that we should get the names of
    
    Returns: a list of all the possible show names
    """

    showNames = [show.name]
    for name in get_scene_exceptions(show.tvdbid):
        if not name in showNames:
            showNames.append(name)

    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname != None:
        showNames.append(show.tvrname)

    if show.custom_search_names != "" and show.custom_search_names != None:
        for custom_name in show.custom_search_names.split(","):
            showNames.append(custom_name)

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(" " + curCountry):
                newShowNames.append(curName.replace(" " + curCountry, " (" + country_list[curCountry] + ")"))
            elif curName.endswith(" (" + curCountry + ")"):
                newShowNames.append(curName.replace(" (" + curCountry + ")", " (" + country_list[curCountry] + ")"))

    showNames += newShowNames

    return showNames
예제 #8
0
def allPossibleShowNames(show):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.

    show: a TVShow object that we should get the names of

    Returns: a list of all the possible show names
    """

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.tvdbid)]

    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname is not None:
        showNames.append(show.tvrname)

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(' ' + curCountry):
                newShowNames.append(
                    curName.replace(' ' + curCountry,
                                    ' (' + country_list[curCountry] + ')'))
            elif curName.endswith(' (' + curCountry + ')'):
                newShowNames.append(
                    curName.replace(' (' + curCountry + ')',
                                    ' (' + country_list[curCountry] + ')'))

    showNames += newShowNames
    # at this point we could have duplicates due to case-ing, prune dupes
    return uniqify(showNames, lambda x: x.lower())
예제 #9
0
def allPossibleShowNames(show):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.

    show: a TVShow object that we should get the names of

    Returns: a list of all the possible show names
    """

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.tvdbid)]

    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname is not None:
        showNames.append(show.tvrname)

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList (and vice versa)
    for curName in set(showNames):
        if not curName:
            continue
        for curCountry in country_list:
            if curName.endswith(' ' + curCountry):
                newShowNames.append(curName.replace(' ' + curCountry, ' (' + country_list[curCountry] + ')'))
            elif curName.endswith(' (' + curCountry + ')'):
                newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))

    showNames += newShowNames
    # at this point we could have duplicates due to case-ing, prune dupes
    return uniqify(showNames, lambda x: x.lower())
예제 #10
0
def allPossibleShowNames(show, season=None):
    """
    Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
    country codes on the end, eg. "Show Name (AU)", and any scene exception names.
    
    show: a TVShow object that we should get the names of
    
    Returns: a list of all the possible show names
    """

    showNames = [show.name]
    showNames += [name for name in get_scene_exceptions(show.tvdbid)]

    # if we have a tvrage name then use it
    if show.tvrname != "" and show.tvrname != None:
        showNames.append(show.tvrname)

    newShowNames = []

    country_list = countryList
    country_list.update(dict(zip(countryList.values(), countryList.keys())))

    # if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
    # any countries defined in common.countryList
    # (and vice versa)
    # only for none anime
    if not show.anime:
        for curName in set(showNames):
            if not curName:
                continue
            for curCountry in country_list:
                if curName.endswith(' ' + curCountry):
                    newShowNames.append(
                        curName.replace(' ' + curCountry,
                                        ' (' + country_list[curCountry] + ')'))
                elif curName.endswith(' (' + curCountry + ')'):
                    newShowNames.append(
                        curName.replace(' (' + curCountry + ')',
                                        ' (' + country_list[curCountry] + ')'))

    showNames += newShowNames

    newShowNames = []
    # Season Names
    if season != None and show.seasons_name:
        if season == "all":
            seasons = range(1, len(show.seasons_name) + 1)
        elif isinstance(season, int):
            seasons = [season]
        else:
            seasons = season

        for season in seasons:

            try:
                season_name = show.seasons_name[season]
            except:
                season_name = ""

            for showName in showNames:
                newShowNames.append(showName + season_name)

        showNames = newShowNames  # If season is specified, return only the specified season name

    return showNames