コード例 #1
0
def build_sub_category_by_title(category_code, sub_category_title, lang):
    category = api.category(category_code, lang)
    sub_category = hof.find(
        lambda i: utils.sanitize_string(i.get('title')) == sub_category_title,
        category)

    return [
        mapper.map_generic_item(item) for item in sub_category.get('teasers')
    ]
コード例 #2
0
def build_weekly(lang):
    programs = hof.flatten([api.daily(date, lang) for date in utils.past_week()])

    def keep_video_item(item):
        video = hof.get_property(item, 'video')

        if video is None: return False
        return hof.get_property(item, 'kind') not in _useless_kinds

    videos_filtered = [hof.get_property(item, 'video') for item in programs if keep_video_item(item)]

    videos_mapped = [mapper.map_generic_item(item) for item in videos_filtered]
    videos_mapped.sort(key=lambda item: hof.get_property(item, 'info.aired'), reverse=True)

    return videos_mapped
コード例 #3
0
def build_mixed_collection(kind, collection_id, lang):
    return [
        mapper.map_generic_item(item)
        for item in api.collection(kind, collection_id, lang)
    ]
コード例 #4
0
def build_sub_category_by_code(sub_category_code, lang):
    return [
        mapper.map_generic_item(item)
        for item in api.subcategory(sub_category_code, lang)
    ]
コード例 #5
0
def build_magazines(lang):
    return [mapper.map_generic_item(item) for item in api.magazines(lang)]
コード例 #6
0
def build_sub_category_by_title(category_code, sub_category_title, lang):
    category = api.category(category_code, lang)
    sub_category = hof.find(lambda i: utils.sanitize_string(
        i.get('title')) == sub_category_title, category)

    return [mapper.map_generic_item(item) for item in sub_category.get('teasers')]
コード例 #7
0
def build_mixed_collection(kind, collection_id, lang):
    return [mapper.map_generic_item(item) for item in api.collection(kind, collection_id, lang)]
コード例 #8
0
def build_sub_category_by_code(sub_category_code, lang):
    return [mapper.map_generic_item(item) for item in api.subcategory(sub_category_code, lang)]
コード例 #9
0
def build_magazines(lang):
    return [mapper.map_generic_item(item) for item in api.magazines(lang)]
コード例 #10
0
def build_last_chance(lang):
    return [mapper.map_generic_item(item) for
            item in api.home_category('lastChance', lang)]
コード例 #11
0
def build_most_viewed(lang):
    return [mapper.map_generic_item(item) for
            item in api.home_category('mostViewed', lang)]
コード例 #12
0
def build_newest(lang):
    return [mapper.map_generic_item(item) for
            item in api.home_category('mostRecent', lang)]