Esempio n. 1
0
def get_lastfm_users_topartists(request,lastfm_username,page=1,period='overall'):
  if 'period' in request.GET:
    period=request.GET['period']
  top_artists=lastfm_manager.get_user_top_artists(lastfm_username,page,period)
  if(type(top_artists)==str):
    params={'lastfm_username':lastfm_username, 'page':page}
  else:
    params={'artists':top_artists,'lastfm_username':lastfm_username, 'page':page}
  return render_to_response('users_top_artists.html',params,context_instance=RequestContext(request))
Esempio n. 2
0
 def test_get_top_artists(self):
   response=lastfm_manager.get_user_top_artists("djkalli", "1", "overall")
   self.assertTrue(type(response)==dict, "The response should be a dict")
   self.assertEquals(response['topartists']['@attr']['user'],"djkalli")