示例#1
0
def test_song_hqlocation():
    import radio
    radio.visit_radio(state, config.radio_id)
    tracks = radio.get_radio_list(state, state['radio_type'], state['radio_id'])
    track = tracks[0]
    track.dump_info()
    print "hq location:", track.get_hq_location(state)
示例#2
0
def test_radio_list(state):
    import radio
    radio.visit_radio(state, config.radio_id)
    for x in xrange(2):
        tracks = radio.get_radio_list(state, state['radio_type'], state['radio_id'])
        for track in tracks:
            track.dump_info()
        time.sleep(5)
示例#3
0
def test_fav_radio(state):
    import radio
    fav_radios = radio.get_fav_radio(state, 1)
    for fav_radio in fav_radios:
        print "radio name:", fav_radio['radio_name']
        radio.visit_radio(state, fav_radio['radio_id'])
        tracks = radio.get_radio_list(state, state['radio_type'], state['radio_id'])
        tracks[0].dump_info()
示例#4
0
def test_similar_artists():
    import radio
    radio.visit_radio(state, config.radio_id)
    tracks = radio.get_radio_list(state, state['radio_type'], state['radio_id'])
    track = tracks[0]
    similar_artists = track.get_similar_artists(4)
    print similar_artists
    assert(len(similar_artists) == 4)
    for artist in similar_artists:
        assert('category' in artist)
        assert('name' in artist)
示例#5
0
文件: gui.py 项目: HenryHu/xmradio
    def station_clicked(self, station, idx):
        self.fav_model.set_highlight(idx)

        _station = station._station
        self.set_status(self.tr("Listening to radio %s (%s)") % (
            _station['radio_id'], _station['object_id']))
        self.current_station = _station
        self.mode = "station"

        radio_id = _station['radio_id']
        radio.visit_radio(self.state, radio_id)
        self.clear_playlist()
        self.fetch_from_station(_station)
        self.start_player()
示例#6
0
def play_radio(state, radio_id):
    radio.visit_radio(state, radio_id)
    while True:
        try:
            tracks = radio.get_radio_list(state, state['radio_type'], state['radio_id'])
        except:
            logger.exception("fail to get list of songs")
            time.sleep(ERROR_WAIT)
            continue
        if state['random']:
            random.shuffle(tracks)
        for track in tracks:
            play_track(state, track)
            # type 10 -> play from radio
            try:
                info.record_play(state, track.song_id, None, info.is_vip(state), "10")
            except:
                logger.exception("fail to record")
            time.sleep(1)
示例#7
0
def play_radio(state, radio_id):
    radio.visit_radio(state, radio_id)
    while True:
        try:
            tracks = radio.get_radio_list(state, state['radio_type'],
                                          state['radio_id'])
        except:
            logger.exception("fail to get list of songs")
            time.sleep(ERROR_WAIT)
            continue
        if state['random']:
            random.shuffle(tracks)
        for track in tracks:
            play_track(state, track)
            # type 10 -> play from radio
            try:
                info.record_play(state, track.song_id, None,
                                 info.is_vip(state), "10")
            except:
                logger.exception("fail to record")
            time.sleep(1)
示例#8
0
def test_related_info(state):
    import radio
    radio.visit_radio(state, config.radio_id)
    tracks = radio.get_radio_list(state, state['radio_type'], state['radio_id'])
    track = tracks[0]
    print track.get_related_info(state)