wolffd@0: # gets data from the last.fm webservice and wolffd@0: wolffd@0: import pylast wolffd@0: import sys wolffd@0: import fm_network wolffd@0: wolffd@0: network = fm_network.get_network() wolffd@0: wolffd@0: # now you can use that object every where wolffd@0: artistsrch = network.search_for_artist(sys.argv[1]) wolffd@0: wolffd@0: # did we find any ? wolffd@0: if int(artistsrch.get_total_result_count()) == False: wolffd@0: print('-1, None') wolffd@0: wolffd@0: else: wolffd@0: wolffd@0: #print alternatives wolffd@0: artists = artistsrch.get_next_page() wolffd@0: for artist in artists: wolffd@0: mbid = unicode(artist.get_mbid()) wolffd@0: print(artist.get_name().encode('utf-8','ignore') + ', ' + mbid.encode('utf-8','ignore')) wolffd@0: