Mercurial > hg > camir-aes2014
diff core/magnatagatune/fm_retrieve_album.py @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/magnatagatune/fm_retrieve_album.py Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,23 @@ +# gets data from the last.fm webservice and + +import pylast +import sys +import fm_network + +network = fm_network.get_network() + +# now you can use that object every where +srch = network.search_for_artist(sys.argv[1]) + + +# did we find any ? +if (int(srch.get_total_result_count()) == False): + print('-1, None') + +else: + + #print first 200 results + albums = srch.get_next_page() + for album in albums: + mbid = unicode(album.get_mbid()) + print(album.get_name().encode('utf-8','ignore') + ', ' + mbid.encode('utf-8','ignore'))