O'Reilly logo

Linux Multimedia Hacks by Kyle Rankin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #80. Browse Streaming Radio Stations

Install streamtuner and browse through a large directory of public streaming radio stations.

A complaint you might often hear among music fans is "there's nothing good on the radio." While the truth of that statement is largely a matter of musical taste, it is true that the further your tastes stray from the mainstream, the less likely they will be served by mainstream radio stations. Streaming radio over the Internet is one solution to the problem. Because it's very easy for someone to set up their own streaming music radio station, there are thousands of such stations available, which means you have a very good chance of finding one or more that appeals to your eclectic tastes. (Find information on making your own radio stream in [Hack #84] ). Now that you know the perfect song for you is out there somewhere, how do you find it without some sort of stream station directory listing? Use streamtuner, a Linux program that lists and organizes various streaming radio stations and makes it easy for you to filter through them to find streams that match your taste.

To install streamtuner, first check with your distribution's packaging tool and see whether it has already been packaged. If not, visit the official streamtuner page at http://www.nongnu.org/streamtuner and either download one of the unofficial packages for your distribution, or download and compile the source code according to the installation instructions. After it is installed, launch it from your panel menu or type streamtuner in a console.

The initial GUI has a toolbar with a number of common actions and below it a row of tabs (see Figure 4-1). These tabs organize each of the different networks of streaming audio servers into their own tabs along with your bookmarks and any local streams. streamtuner provides plug-ins for streaming networks such as SHOUTcast, Live365, Xiph, basic.ch, and a number of others. Each of these streaming networks host (often large) numbers of streams organized by genre.

streamtuner main window

Figure 4-1. streamtuner main window

While all of these networks stream audio, they sometimes do so in different ways. Click the corresponding tab for a network and for most networks streamtuner will download the latest list of streams and display a list of genres on the left and a list of streams for that genre on the right. Since some streaming networks don't offer a direct feed in this way, they may not show all of this information and may instead offer links to web pages that contain further information about a stream. Click the Update button in the toolbar to refresh the list of streams for a network. For some networks (such as punkcast.com) streamtuner will only display links to the particular stream's web site. Click on the link and streamtuner will open it in your configured web browser.

Tip

Some of the tabs will provide columns that list artist, album, and other information about the particular stream. Right-click on one of the columns (such as Description) and choose Stream Columns to configure which of the columns to show and which to hide.

By default, streamtuner is configured to use xmms as its media player. To use a different application for your streams, click Edit → Preferences and choose Applications from the preferences window. This window allows you to configure the default commands that streamtuner will run to listen to a stream, a playlist, open a web page, and a number of other options. Most Linux media players that support streaming audio will support a stream passed as an argument on the command line, so to change xmms to your media player, just replace xmms in the preferences window with the command-line name of your application.

The preferences window also lets you configure other streamtuner options. Click Network to configure a proxy server if your network uses one, or click Plugins to set specific options for the installed streamtuner plug-ins. These preferences vary for each plug-in but often allow you to configure settings such as how many streams to load per category.

With streamtuner configured for your music player, choose one of the network tabs, select a stream from the list, and click Tune In to start listening to the stream (or just double-click on a stream name). If the Browse button in the toolbar is enabled, you can click on that button to visit the stream's web page in your browser. Select a different stream and click Tune In to switch to the new stream. When you find a stream that you like, right-click the stream and select Add Bookmark to add the stream to the Bookmark tab so you can easily find the stream at a later date.

Tip

streamtuner can also act as a frontend to your local music collection. Point streamtuner to the directory where you store your music files in the preferences window, and then click the Local tab. streamtuner will list all of the directories and files within your music directory and allow you to tune into one or multiple files.

streamtuner also provides a frontend to the streamripper program. If the Record button is enabled and streamripper is installed, you can actually record the streaming audio directly to MP3 files. The exact streamripper command-line arguments can be configured in streamtuner's preferences window, but by default it will open streamripper in your default terminal and save the files in your home directory (or the directory you launched streamtuner from). To find out more about how to configure streamripper, check out [Hack #81] .

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required