Mercurial > hg > camir-aes2014
comparison core/magnatagatune/fm_retrieve_artist.py @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 # gets data from the last.fm webservice and | |
2 | |
3 import pylast | |
4 import sys | |
5 import fm_network | |
6 | |
7 network = fm_network.get_network() | |
8 | |
9 # now you can use that object every where | |
10 artistsrch = network.search_for_artist(sys.argv[1]) | |
11 | |
12 # did we find any ? | |
13 if int(artistsrch.get_total_result_count()) == False: | |
14 print('-1, None') | |
15 | |
16 else: | |
17 | |
18 #print alternatives | |
19 artists = artistsrch.get_next_page() | |
20 for artist in artists: | |
21 mbid = unicode(artist.get_mbid()) | |
22 print(artist.get_name().encode('utf-8','ignore') + ', ' + mbid.encode('utf-8','ignore')) | |
23 |