Esempio n. 1
0
def map_playable(streams, quality):
    stream = None
    for q in [quality
              ] + [i for i in ['SQ', 'EQ', 'HQ', 'MQ'] if i is not quality]:
        stream = hof.find(lambda s: match(s, q), streams)
        if stream:
            break
    return {'path': stream.get('url')}
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 map_playable(streams, quality):
    stream = None
    for q in [quality] + [i for i in ['SQ', 'EQ', 'HQ', 'MQ'] if i is not quality]:
        stream = hof.find(lambda s: match(s, q), streams)
        if stream:
            break
    return {
        'path': stream.get('url')
    }
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')]