Beispiel #1
0
def change_radio_order(id, **kwargs):
    if not id or len(unicode(id)) == 0:
        return False

    order = load_radio_order(profile_id=1)
    id = unicode(id)

    selected = int(gui.numeric(_.SELECT_ORDER, order[id]))
    double = None
    double_query = ''

    if selected >= 0:
        for currow in order:
            if id == unicode(currow):
                continue

            if int(order[currow]) == int(selected):
                double = currow
                break

        order[id] = selected

    save_radio_order(profile_id=1, order=order)

    if double:
        double_query = '&double={double}&primary={primary}'.format(
            double=double, primary=id)

    xbmc.executeJSONRPC(
        '{"jsonrpc":"2.0","id":1,"method":"GUI.ActivateWindow","params":{"window":"videos","parameters":["plugin://'
        + unicode(ADDON_ID) + '/?_=radio_order_picker_menu' + double_query +
        '"]}}')
Beispiel #2
0
def plugin_ask_for_creds(creds):
    username = gui.numeric(message=_.ASK_USERNAME,
                           default=creds['username']).strip()

    if not len(username) > 0:
        gui.ok(message=_.EMPTY_USER, heading=_.LOGIN_ERROR_TITLE)

        return {'result': False, 'username': '', 'password': ''}

    password = gui.numeric(message=_.ASK_PASSWORD).strip()

    if not len(password) > 0:
        gui.ok(message=_.EMPTY_PASS, heading=_.LOGIN_ERROR_TITLE)

        return {'result': False, 'username': '', 'password': ''}

    return {'result': True, 'username': username, 'password': password}
Beispiel #3
0
def plugin_ask_for_creds(creds):
    email_or_pin = settings.getBool(key='email_instead_of_customer')

    if email_or_pin:
        if unicode(creds['username']).isnumeric():
            creds['username'] = ''

        username = gui.input(message=_.ASK_USERNAME2,
                             default=creds['username']).strip()
    else:
        if not unicode(creds['username']).isnumeric():
            creds['username'] = ''

        username = gui.numeric(message=_.ASK_USERNAME,
                               default=creds['username']).strip()

    if not len(username) > 0:
        if email_or_pin:
            gui.ok(message=_.EMPTY_USER2, heading=_.LOGIN_ERROR_TITLE)
        else:
            gui.ok(message=_.EMPTY_USER, heading=_.LOGIN_ERROR_TITLE)

        return {'result': False, 'username': '', 'password': ''}

    if email_or_pin:
        password = gui.input(message=_.ASK_PASSWORD2, hide_input=True).strip()
    else:
        password = gui.numeric(message=_.ASK_PASSWORD).strip()

    if not len(password) > 0:
        if email_or_pin:
            gui.ok(message=_.EMPTY_PASS2, heading=_.LOGIN_ERROR_TITLE)
        else:
            gui.ok(message=_.EMPTY_PASS, heading=_.LOGIN_ERROR_TITLE)

        return {'result': False, 'username': '', 'password': ''}

    return {'result': True, 'username': username, 'password': password}
Beispiel #4
0
def change_order(id, type_tv_radio, **kwargs):
    if not id or len(str(id)) == 0:
        return False

    if type_tv_radio == 'live':
        order = load_order(profile_id=1)
    else:
        order = load_radio_order(profile_id=1)

    id = str(id)
    type_tv_radio = str(type_tv_radio)

    selected = gui.numeric(_.SELECT_ORDER, order[id])
    double = None
    double_query = ''

    if selected and selected >= 0:
        for currow in order:
            if id == str(currow):
                continue

            if int(order[currow]) == int(selected):
                double = currow
                break

        order[id] = selected

    if type_tv_radio == 'live':
        save_order(profile_id=1, order=order)
    else:
        save_radio_order(profile_id=1, order=order)

    if double:
        double_query = '&double={double}&primary={primary}'.format(
            double=double, primary=id)

    method = 'GUI.ActivateWindow'
    json_rpc(
        method, {
            "window":
            "videos",
            "parameters": [
                'plugin://' + str(ADDON_ID) + '/?_=order_picker_menu' +
                double_query + '&type_tv_radio=' + type_tv_radio
            ]
        })