Exemplo n.º 1
0
def authenticate(state):
    if not info.authenticated(state):
        username = raw_input("username: "******"password: ")
        login.login_console(state, username, password)
Exemplo n.º 2
0
 def authenticate(self):
     if not info.authenticated(self.state):
         self.login_win = LoginWin(self.state, self)
         self.run()
     self.auth_ok()
Exemplo n.º 3
0
    assert(page >= 1)
    fav_radio_url = fav_radio_url_temp % page
    fav_radio_ret = urllib2.urlopen(fav_radio_url).read()
    fav_radio_parsed = json.loads(fav_radio_ret)

    if not fav_radio_parsed['status']:
        raise Exception('fail to get favourite radios. %s' % fav_radio_parsed['message'])
    fav_radios = fav_radio_parsed['data']
    # unknown
    prev_fav = fav_radios['prev']
    next_fav = fav_radios['next']
    logger.debug("prev, next: %s %s" % (prev_fav, next_fav))

    fav_radios = fav_radios['data']
    return fav_radios

if __name__ == '__main__':
    import init
    import config
    state = init.init()
    if not info.authenticated(state):
        import login
        login.login_console(state, config.username, config.password)
    visit_radio(state, config.radio_id)
    import time
    for x in xrange(10):
        tracks = get_radio_list(state, state['radio_type'], state['radio_id'])
        for track in tracks:
            track.dump_info()
        time.sleep(5)
Exemplo n.º 4
0
    fav_radio_ret = urllib2.urlopen(fav_radio_url).read()
    fav_radio_parsed = json.loads(fav_radio_ret)

    if not fav_radio_parsed['status']:
        raise Exception('fail to get favourite radios. %s' %
                        fav_radio_parsed['message'])
    fav_radios = fav_radio_parsed['data']
    # unknown
    prev_fav = fav_radios['prev']
    next_fav = fav_radios['next']
    logger.debug("prev, next: %s %s" % (prev_fav, next_fav))

    fav_radios = fav_radios['data']
    return fav_radios


if __name__ == '__main__':
    import init
    import config
    state = init.init()
    if not info.authenticated(state):
        import login
        login.login_console(state, config.username, config.password)
    visit_radio(state, config.radio_id)
    import time
    for x in xrange(10):
        tracks = get_radio_list(state, state['radio_type'], state['radio_id'])
        for track in tracks:
            track.dump_info()
        time.sleep(5)
Exemplo n.º 5
0
def authenticate(state):
    if not info.authenticated(state):
        username = raw_input("username: "******"password: ")
        login.login_console(state, username, password)