michielovertoom.com

Somafm playlists • 2 Jan 2010

Somafm.com is one of my favourite internet radio stations. I wrote a little program which will download all the channels they offer (about 20), so I can start my media player with it directly, instead of having to go via their website.

Still to do: I have to rewrite the program to use lxml instead of BeautifulSoup.

Download the python program or an example playlist.

# Download internet radio playlists from somafm.com, # ready to open and play in a mediaplayer (like VLC or XMMS). # # Written by Michiel Overtoom, motoom@xs4all.nl, november 2009 - january 2010. import urllib2 import BeautifulSoup import re def download_playlist(name): ''' Retrieve a playlist from somafm.com and save to a local file. The channel name should be a bare name, such as "bootliquor" or "lush". ''' doc = urllib2.urlopen("http://www.somafm.com/startstream=%s.pls" % name) contents = doc.read() f = open("somafm.%s.pls" % name,"wt") f.write(contents) f.close() # Retrieve the somafm.com homepage and pry the channel names from it. if __name__ == "__main__": # isolate 'doomed' from a string as '<a href="/play/doomed56">'. re_channelname = re.compile("play/([a-z]*)") doc = urllib2.urlopen("http://www.somafm.com") soup = BeautifulSoup.BeautifulSoup(doc) channels = set() for a in soup.findAll("a"): href = a['href'] m = re_channelname.search(href) if m: channels.add(m.group(1)) # Download a playlist for every channel found. for channel in channels: print "Downloading '%s' playlist" % channel try: download_playlist(channel) except urllib2.HTTPError: print "This channel is nonexistent; ignoring"

Some of my other favourite internet radio stations are frisky (playlist), proton (playlist), schizoid (psy, chill, progressive) and digitally imported.

Comments

Ellen • 17 May 2010

Did you know that Jamie Zawinksy (of Club DNA, in San Francisco) also has a internet radio broadcast? Live!

doug-hoherty@hotmail.com • 17 May 2010

not only that, also a live video webcast, see http://www.dnalounge.com/webcast/

murkk • 8 Jun 2010

It's DNA Lounge, not club dna!

John • 12 Aug 2010

Soma FM is also located in San Francisco. Apparently, SoMa is a neighbourhood in SF. See http://en.wikipedia.org/wiki/South_of_Market

a • 25 Apr 2011

hve u checked out reciva.com

flying.flynn@yahoo.com.flynn • 23 Oct 2012

Dear god, of course soma is a neighborhood in sf.

Ivan • 6 Dec

FF, some of us non-SF types may not have known SoMa was an SF neighborhood. So, it's not "of course" for everyone.

Leave a comment

name (required)



content last edited on October 31, 2010, 13:38 - rendered in 3.26 msec