Well after some experimentation and playing around I have found some new information out regarding listening to iheartradio from the command line in Linux.
Newer versions of mplayer have support to play the rtmp:// protocol eliminating the need for rtmpdump.
Quick Recap on how to grab the rtmp:// url from an iheartradio stream
- Go to
http://p2.STATION_ID.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen_live; where station id is the call letters (ex: wtfx-fm)
- The attribute primary_location in <stream> contains the rtmp url
NOTE: The RTMP URL changes every 5-10 minutes! You must fetch the new url everytime.
To play the stream with mplayer:
mplayer "rtmp://cp21366.live.edgefcs.net/live/Lou_KY_WTFX-FM_OR..." -novideo
-novideo option is very improtant otherwise mplayer will take 5+ minutes trying to find video for the stream (there is none).
This is all great, but this is a lot of work everytime you want to listen to a iheartradio stream. Therefore I have coded up a script.
- Asks you for the station id (ex: wtfx-fm)
- Asks how long the stream should play for
- Check for song information every 10 seconds
- Not Perfect (Alpha Quality)
import xml.etree.ElementTree as ET
#Location of Stream to be SAVED
station=raw_input("Enter Station ID [" + DefaultStation + "]: ")
if not station:
print "Error - Invalid Station ID or Web Server Problem - Try Again"
TIME=int(raw_input("Time Stream will Play (in minutes): "))
print "Error - Invalid Time - Try Again"
mp=subprocess.Popen(['/usr/bin/mplayer', rtmpurl, '-novideo', '-ao', 'alsa', '-quiet'], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
endTime = datetime.datetime.now() + datetime.timedelta(minutes=TIME)
while datetime.datetime.now() < endTime:
if not SongInfo == OldSongInfo:
OldSongInfo = SongInfo
print SongInfo + " - " + SongInfo
I got this script working on the N900 by downloading the Maemo 5 SDK and compiling the mplayer binary from a recent svn snapshot. Luckily, I didn't run into any problems. Although mplayer works with the N900, without any patches, it is not flawless. For example, video gets jittery and skips when the backlight switches off. I would recommend leaving mplayer form extra installed and storing the mplayer you compiled in /opt. With audio playback I do not have any issues, especially with the iheartradio rtmp stream!