Difference between revisions of "Streaming Internet Audio Using Mplayer"
(Created page with 'This article is to provide information on how to integrate Internet Radio into Mythtv. This is based on Fm radio but I wanted to post details on how to make it work for Inte…')
m (moved Streaming Audio to Streaming Internet Audio Using Mplayer: This title is generic, and since mythmusic supports shoutcast/http streaming now, it would be better used to describe that process.)
Revision as of 20:06, 14 November 2010
This article is to provide information on how to integrate Internet Radio into Mythtv. This is based on Fm radio but I wanted to post details on how to make it work for Internet Radio too.
- 1 Article from 10,000 feet
- 2 What is required
- 3 Hacking it together
- 4 Setting up the MythTV GUI
- 5 Additional Setup and Usage Notes
- 6 Screen shots
Article from 10,000 feet
What this article is...
This article IS about:
- Setting up Myth to play streams via Mplayer
- How-To use programs that other people wrote (and are not affiliated with MythTV)
- How-To integrate everything with the default MythTV menu theme
What this article is not...
This article IS NOT:
- How-To perfectly integrate with your particular MythTV GUI (we only cover the default menu theme)
- A Streaming Plug-in for MythTV
What is required
Only a working installation of MythTV and mplayer is required
Hacking it together
OK, now we are going to write a couple of über-simple shell scripts that we will use to make MythTV work with mlayer. You will notice that these are simple, novice scripts that are pretty crude. This hasn't been called it a "hack" for nothing.
We need to create a couple of files so find a nice place you can create and execute them from. Personally, I put them in ~/.mythtv
# vi inetradio
#!/bin/sh ## Play Internet Radio Streams on MythtV if [ "$1" = "gs" ]; then mplayer http://somafm.com/startstream=groovesalad.pls elif [ "$1" = "sa" ]; then mplayer http://somafm.com/startstream=secretagent.pls elif [ "$1" = "xm" ]; then mplayer http://somafm.com/startstream=christmas.pls else exit 1 fi exit 0
Odiously you are going to want to change the stations here
Now you will want to make this executable:
# chmod a+x inetradio
Now, pull up a command window and run one of the commands we just "made"
$ ./inetradio sa
Did you hear your stream?
Setting up the MythTV GUI
At this point, you should be able to play your streams from the command line with no user intervention... that's 1/2 the battle. Now, we are going to hack a couple of buttons onto the default menu theme.
Backup the default theme
# cd /usr/share/mythtv/themes/defaultmenu # tar cfvz default_backup.tar.gz *.xml
I use the v option because it's an easy way to verify (VIA verbose) what files were put into the tar ball.
Hack the default theme
I'm only going to show you the 2 required changes to get this hack to work.
I added the following to my library.xml file.
# cd /usr/share/mythtv # vi library.xml
<button> <type>FM</type> <text>Internet radio</text> <action>MENU inetradio.xml</action> </button>
Then, I created the inetradio.xml file (be sure to add all of the stations you want access to):
# vi inetradio.xml
<mythmenu name="INETRADIOMENU"> <button> <type>INETRADIO</type> <text>SomaFM Groove Salad</text> <action>EXEC ~/.mythtv/inetradio gs</action> </button> <button> <type>INETRADIO</type> <text>SomaFM Secret Agent</text> <action>EXEC ~/.mythtv/inetradio sa</action> </button> <button> <type>INETRADIO</type> <text>SomaFM Xmas Lounge</text> <action>EXEC ~/.mythtv/inetradio xm</action> </button> </mythmenu>
OK, now the tag definitions for the above xml file
- "button" tells the theme to paint a button on the screen
- "type" tells the theme what image to use for the button
- "text" tells MythTV what button text to put on the screen
- "action" tells MythTV what to do when you select the button