コード例 #1
0
def unloved_track(username, info):
    '''
    When a user f***s the track
    '''
    network = get_network()
    network.session_key = userM.get_session_key(username)
    track = info.split("||")
    pylast.Track(track[0], track[1][1:-1], network).unlove()
コード例 #2
0
def get_rec_artists(username):
    '''
    Get user's recommendation artists from lastfm
    '''
    session_key = userM.get_session_key(username)
    user = get_user(username, session_key=session_key)
    rec_artists = user.get_recommended_artists(limit=100)
    return rec_artists
コード例 #3
0
def update_playing(username, this_track):
    # @todo(try except)
    try:
        network = get_network()
        network.session_key = userM.get_session_key(username)
        network.update_now_playing(artist=this_track.artist,
                                   title=this_track.title)
    except:
        pass
コード例 #4
0
def scrobble(username, last_track):
    '''
    Scrobble one user, and update playing song
    '''
    try:
        network = get_network()
        session_key = userM.get_session_key(username)
        network.session_key = session_key
        info = last_track.split('||')
        timestamp = int(time.time() - float(info[2]))
        network.scrobble(artist=info[0],
                         title=info[1][1:-1],
                         timestamp=timestamp)
    except:
        pass