Welcome to Boredom

Show entries from:

2009

2008

2007

2006

2005

Last.fm

Having a few spare minutes, I've added a template tag to my site that shows the last 10 songs I've listened to on last.fm.

@register.inclusion_tag('blog/lastfm_tracks.html')
def latest_tracks():
    url = 'http://ws.audioscrobbler.com/1.0/user/DReynolds/recenttracks.txt'
    response = urllib2.urlopen(url)
    songs = []
    for line in response.read().split('\n'):
        if not re.match(r"^$", line):
            songdetail = re.split(",", line)[1]
            artist, song = re.split(" \xe2\x80\x93 ",  songdetail)
            songs.append({'artist' : artist, 'song' : song})
    return {'songs' : songs}

Categories: Django, Music, Tech, Web Design

Posted on Wed 25th June 2008 by david

Edited on Wed 25th June 2008

Comments


On Thu 25th February 2010, ShingSminizer commented:

The action taken to local and national disasters is noble but it's a damn shame that so many citizens take advantage of the negative situations.

I mean everytime there is an earthquake, a flood, an oil spill - there's always a group of heartless people who rip off tax payers.

This is in response to reading that 4 of Oprah Winfreys "angels" got busted ripping off the system. Shame on them! http://www.cbsnews.com...


On Sun 7th March 2010, oscillagoto commented:

http://haitifeed.files.wordpress.com/2010/01/2-haiti-earthquake-jan-12-2009.jpeg

Hurricanes, Earthquakes and Floods belong to nature - but kindness belongs to humans.

Seeing is believing - so please don't be blind. These people need your help!

Help the children!
http://www.google.com/...


On Tue 9th March 2010, Fapcrummacire commented:

http://stores.lunaroasters.com/catalog/ChildrensLogo_WEB300.gif

Large companies and private folk are donating to help others. Are you doing anything to help?

Pick a charity and Give! http://salvationarmy.org http://www.redcross.org/ http://www.amnesty.org/


Post a comment