当前位置: 首页>>代码示例>>Python>>正文


Python countryList.values函数代码示例

本文整理汇总了Python中sickbeard.common.countryList.values函数的典型用法代码示例。如果您正苦于以下问题:Python values函数的具体用法?Python values怎么用?Python values使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了values函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: allPossibleShowNames

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
开发者ID:Dahlgren,项目名称:SickRage,代码行数:33,代码来源:show_name_helpers.py

示例2: sceneToNormalShowNames

def sceneToNormalShowNames(name):
    """
    Takes a show name from a scene dirname and converts it to a more "human-readable" format.

    name: The show name to convert

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

    if not name:
        return []

    name_list = [name]

    # use both and and &
    new_name = re.sub('(?i)([\. ])and([\. ])', '\\1&\\2', name, re.I)
    if new_name not in name_list:
        name_list.append(new_name)

    results = []

    for cur_name in name_list:
        # add brackets around the year
        results.append(re.sub('(\D)(\d{4})$', '\\1(\\2)', cur_name))

        # add brackets around the country
        country_match_str = '|'.join(countryList.values())
        results.append(re.sub('(?i)([. _-])(' + country_match_str + ')$', '\\1(\\2)', cur_name))

    results += name_list

    return list(set(results))
开发者ID:089git,项目名称:Sick-Beard,代码行数:32,代码来源:show_name_helpers.py

示例3: allPossibleShowNames

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
开发者ID:stephanehenry27,项目名称:Sickbeard-anime,代码行数:46,代码来源:show_name_helpers.py

示例4: allPossibleShowNames

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
开发者ID:khalos,项目名称:Sick-Beard,代码行数:43,代码来源:show_name_helpers.py

示例5: allPossibleShowNames

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())
开发者ID:PermaNulled,项目名称:SickBeard-XG,代码行数:36,代码来源:show_name_helpers.py


注:本文中的sickbeard.common.countryList.values函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。