Esempio n. 1
0
def compareUsersTopArtists(user, otherUser, periodInput):
    topArtistsListUser = lastfm_network.get_user(user).get_top_artists(period=periodInput, limit = 100)
    topArtistsListOtherUser = lastfm_network.get_user(otherUser).get_top_artists(period=periodInput, limit= 100)

    formattedArtistListUser = []
    for artist in topArtistsListUser:
        formattedArtistListUser.append(artist.item)

    formattedArtistListOtherUser = []
    for artist in topArtistsListOtherUser:
        formattedArtistListOtherUser.append(artist.item)

    commonTopArtistsList = list(set.intersection(set(formattedArtistListUser), set(formattedArtistListOtherUser)))
    return commonTopArtistsList
Esempio n. 2
0
def compareUsersTopTracks(user, otherUser, periodInput):
    topTracksListUser = lastfm_network.get_user(user).get_top_tracks(period = periodInput, limit = 150)
    topTracksListOtherUser = lastfm_network.get_user(otherUser).get_top_tracks(period=periodInput, limit=150)

    formattedTrackListUser = []
    for track in topTracksListUser:
        formattedTrackListUser.append(track.item.title)

    formattedTrackListOtherUser = []
    for track in topTracksListOtherUser:
        formattedTrackListOtherUser.append(track.item.title)

    commonTopTracksList = list(set.intersection(set(formattedTrackListUser), set(formattedTrackListOtherUser)))
    return commonTopTracksList
Esempio n. 3
0
def playCount(user):
    playCount = lastfm_network.get_user(user).get_playcount()
    return '{:,}'.format(playCount) ### formats number with comma
Esempio n. 4
0
def getTopArtist(user, periodInput):
    topTracksList = lastfm_network.get_user(user).get_top_artists(period=periodInput, limit=25)
    return topTracksList
Esempio n. 5
0
def getNowPlaying(user):
    now_playing = [lastfm_network.get_user(user).get_now_playing()]
    return now_playing
Esempio n. 6
0
def getTracksTimeInterval(timeFrom, timeTo, user):
    trackList = lastfm_network.get_user(user).get_recent_tracks(cacheable=False, limit=None, time_from=timeFrom, time_to=timeTo)
    return trackList