Details
- Current Version
- 2008.03
- Language
- Python 2.3+
- Downloads
- Version 2008.03 Source
- Downloads
- Type hg clone http://hg.asynchrono.us/scrob-ws at the command prompt to get a copy of the development source code.
- Source Code Web View
John M is a Linux fan in Lowell, MA.
I work at at a company writing software. I fool around with Free and Open Source software for fun & profit.
I was big into Last.fm and you can still see some of what I listen to there. I can also be found using github and recently sourcehut as well as bitbucket (historically). I don't care for most popular social media sites. If I have an account on one or the other it's probably either old and unused or was created just for tinkering.
Links to things I like, use, or otherwise feel is worth sharing. Things I'd like to see get more popular.
Last.fm/Audioscrobbler provides webservices so that you can get at some of your music statistics. I wrote a python library to provide easy (in my eyes) access to the data. The library uses the XML processing library that comes in the python standard library.
The distribution is set up to be expandable, but the main, and only current module is scrobxlib. Use import scrobxlib to load it.
The following are some short simple examples of how to use the library.
In the first example, I request the top artist for a particular user. In this case, I use myself as an example. Once I have the data, I get the top artist's name.
>>> import scrobxlib >>> top_artists = scrobxlib.topArtists( 'phlogistonjohn' ) >>> top_artists[0]['name'] u'Melvins' >>> # the returned value is a list of dict objects. >>> top_artists[0] {'playcount': u'1370', 'url': u'http://www.last.fm/music/Melvins', 'mbid': u'9ccfbc94-a4f4-42f7-b6f5-d903ab77cccb', 'name': u'Melvins', 'rank': u'1'}
Here, I want to learn the names of my last.fm friends.
>>> friends = scrobxlib.friends( 'phlogistonjohn' ) >>> [ fr['name'] for fr in friends ] [u'katmully19', u'pottlukk']
In the last example I will list the names of four artists that are similar to my top artist, the Melvins.
>>> similar = scrobxlib.similar( 'Melvins' ) >>> [ it['name'] for it in similar[0:4] ] [u'Fant\xf4mas', u'High on Fire', u'Melvins/Lustmord', u'Kyuss']
NOTE: Special thanks to Mark Woodson for his additions to the library.
© Copyright 2009-2020 John Mulligan
Every blog page or article on this site is available under the CC-BY-SA license unless otherwise noted.