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') ]
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
def build_mixed_collection(kind, collection_id, lang): return [ mapper.map_generic_item(item) for item in api.collection(kind, collection_id, lang) ]
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) ]
def build_magazines(lang): return [mapper.map_generic_item(item) for item in api.magazines(lang)]
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')]
def build_mixed_collection(kind, collection_id, lang): return [mapper.map_generic_item(item) for item in api.collection(kind, collection_id, lang)]
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)]
def build_last_chance(lang): return [mapper.map_generic_item(item) for item in api.home_category('lastChance', lang)]
def build_most_viewed(lang): return [mapper.map_generic_item(item) for item in api.home_category('mostViewed', lang)]
def build_newest(lang): return [mapper.map_generic_item(item) for item in api.home_category('mostRecent', lang)]