Ejemplo n.º 1
0
def play_transcode_video(userid, path, name, md5, select_type=False):
    player = myplayer.Player()
    listitem = xbmcgui.ListItem(name)
    listitem.setInfo(type="Video", infoLabels={'Title': name})

    api = get_api(userid)
    if select_type:
        choice = xbmcutils.select('请选转码格式', TRANSCODE_TYPES)
        if choice < 0:
            return
        transcode_type = TRANSCODE_TYPES[choice]
    else:
        transcode_type = plugin.get_setting('transcode_type', str)

    params = dict((k, v[0]) for k, v in plugin.request.args.items())
    subtitle = params.get('subtitle')
    if subtitle:
        subtitle = [subtitle]
    else:
        subtitle = []

    api_res = api.get_subtitle(md5, name or '', path)
    if api_res['total_num'] > 0:
        for sub_record in api_res['records']:
            subtitle.append(sub_record['file_path'])

    player.play(api.get_transcode_url(path, transcode_type),
                listitem, sublist=subtitle)
Ejemplo n.º 2
0
def play_transcode_video(userid, path, name, md5, select_type=False):
    player = myplayer.Player()
    listitem = xbmcgui.ListItem(name)
    listitem.setInfo(type="Video", infoLabels={'Title': name})

    api = get_api(userid)
    if select_type:
        choice = xbmcutils.select('请选转码格式', TRANSCODE_TYPES)
        if choice < 0:
            return
        transcode_type = TRANSCODE_TYPES[choice]
    else:
        transcode_type = plugin.get_setting('transcode_type', str)

    params = dict((k, v[0]) for k, v in plugin.request.args.items())
    subtitle = params.get('subtitle')
    if subtitle:
        subtitle = [subtitle]
    else:
        subtitle = []

    api_res = api.get_subtitle(md5, name or '', path)
    if api_res['total_num'] > 0:
        for sub_record in api_res['records']:
            subtitle.append(sub_record['file_path'])

    player.play(api.get_transcode_url(path, transcode_type),
                listitem,
                sublist=subtitle)
Ejemplo n.º 3
0
def select_user():
    config = plugin.get_storage('config')
    users = config.get('users', {})
    if not users:
        return

    userid_list = users.keys()
    userid_list.insert(0, NULL_USER)
    choice = xbmcutils.select('请选择活动帐号', userid_list)
    if choice < 0:
        return

    config['current_user'] = userid_list[choice] if choice > 0 else None
    config.sync()

    xbmcutils.refresh()
Ejemplo n.º 4
0
def select_user():
    config = plugin.get_storage("config")
    users = config.get("users", {})
    if not users:
        return

    userid_list = users.keys()
    userid_list.insert(0, NULL_USER)
    choice = xbmcutils.select("请选择活动帐号", userid_list)
    if choice < 0:
        return

    config["current_user"] = userid_list[choice] if choice > 0 else None
    config.sync()

    xbmcutils.refresh()
Ejemplo n.º 5
0
def select_user():
    config = plugin.get_storage('config')
    users = config.get('users', {})
    if not users:
        return

    userid_list = users.keys()
    userid_list.insert(0, NULL_USER)
    choice = xbmcutils.select('请选择活动帐号', userid_list)
    if choice < 0:
        return

    config['current_user'] = userid_list[choice] if choice > 0 else None
    config.sync()

    xbmcutils.refresh()