示例#1
0
文件: Utils.py 项目: videoprsnsa/ru
def fetch_data(force=False, page=False, section=False, offset=0):
    if page == 'configuration':
        return megogo2xbmc.getconfiguration()
    elif page == 'tarification':
        return megogo2xbmc.gettarification()
    elif page == 'Main':
        response = megogo2xbmc.main_page(force)
    elif page and section:
        response = megogo2xbmc.getvideodata(force, page, section)
    else:
        response = megogo2xbmc.get_page(force, page, offset)

    if not response:
        return []
    try:
        if len(response['data']['video_list']) == 0:
            return []
    except:
        pass
    if page == 'Main' and section == 'recommended':
        return megogo2xbmc.HandleMainPage(response['data'], 'recommended')
    elif page == 'Main' and section == 'slider':
        return megogo2xbmc.HandleMainPage(response['data'], 'sliders')
    elif page.startswith('subscription') or page.startswith('premieres') or page.startswith('video?category_id=') or page.startswith('user/') or page.startswith('video/collection') or page.startswith('search'):
        return megogo2xbmc.HandleMainPage(response['data'], 'video_list')
    elif page.startswith('collections'):
        return megogo2xbmc.HandleMainPage(response['data'], 'collections')
    elif page.startswith('tv/channels'):
        return megogo2xbmc.HandleMainPage(response['data'], 'channels')
    elif page == 'tv?limit=200':
        return megogo2xbmc.HandleTVPackeges(response['data'], 'packages')
    elif page.startswith('video/episodes'):
        return response['data']
    else:
        return megogo2xbmc.HandleVideoResult(response['data'])
示例#2
0
文件: Utils.py 项目: videoprsnsa/ru
def get_subscribe_tariffs(title):
    if title == 'svod':
        product = 'main'
    elif title == 'TV':
        product = 'tv'

    tariffs = []

    data = megogo2xbmc.gettarification()
    if data:
        for arr in data:
            if arr['product'] == product:
                tariffs.append(arr)
        return tariffs
    else:
        return None