Play Shoutcast MP3 radio stream with Python?

Posted by Zachary Brown on Stack Overflow See other posts from Stack Overflow or by Zachary Brown
Published on 2010-05-19T17:10:38Z Indexed on 2010/05/19 17:20 UTC
Read the original article Hit count: 270

Filed under:
|
|
|
|

I have managed to create an online radio station using Shoutcast and Sam Broadcaster. Now, I am wanting to build my own player for that radio station. I am not sure where to begin, I have googled, but no luck. I am using Python 2.6 on Microsoft Windows.

I have managed to capture the stream and save it as an MP# on the hard disk, just not sure what to do with it next. I tried playback of the file, but it always pulls up errors. This is the code I have so far:

import urllib

target = open("broadcast.mp3")
conn = urllib.urlopen("http://78.159.104.175:80")
while True:
     target.write(con.read(5200))

Any help would be greatly appreciated!

© Stack Overflow or respective owner

Related posts about python

Related posts about shoutcast