Note
This is no longer maintained and the information below is outdated. At least the free streams cannot be played with this anymore. This page is here for historical reasons only.

difmplay is a shell script to ease playing music from Digitally Imported (DI.FM), SKY.FM, and JAZZRADIO.com Internet radio stations. Both free and premium streams are supported. Playing the premium streams requires paid subscription.

difmplay provides both command line and menu driven interfaces to select the channel and the bitrate. difmplay constructs an URL matching the choices, and passes the URL to the selected audio player application. This way one doesn’t need to keep bookmarks of the playlist URLs for different channels and bitrates just to avoid visiting (and in case of premium, logging in) the DI, SKY, or JAZZRADIO website everytime one wants to play some music.

Usage

The following is practically a slightly expanded version of difmplay’s built-in help message. There is no man page or other documentation, and due to simplicity of difmplay, these docs should be enough.

difmplay [option]... [channel]

Channel may be omitted if interactive menu will be used or if the default channel has been specified in the configuration file.

Option Description

-b bitrate

Set the bitrate as kbit/s for the premium subscription. 256 is MP3. 128, 64, and 40 are AAC. The default is 256. If the premium ID is not set, this option is ignored and the free stream is played.

-i premium

Set the premium ID (a hexadecimal string) needed to construct URLs for premium streams. You can find this string by looking at the URLs of the channels when logged in DI, SKY, or JAZZRADIO website.

-p player

Set the command to use as the audio player. It has to accept an URL to the playlist (.pls) as the last argument. Wordsplitting is applied to player, which makes it possible to pass additional command line options to the player program. The default is mplayer -playlist.

-m

Display a menu using dialog to select the channel and bitrate. The default selections can be specified in the config file or on the command line.

-n

Don’t display a menu even if config file has MENU=yes or the -m option was already used.

-l

Display the list of available channels. Multi-column output is used when printing to a terminal. Otherwise single-column output is used.

-u

Download a new channel list to ~/.difmplay_channels. It’s recommended to delete ~/.difmplay_channels or run difmplay -u everytime you have updated difmplay.

-h

Display the help message. It’s practically the same as the usage information on this web page.

Configuration file

Because setting everything on the command line is frustrating, difmplay reads the default settings from ~/.difmplayrc if it exists. It must be a sh script that sets zero or more variables listed below. If the same setting is set on both command line and in configuration file, the value on the command line takes effect.

  • BITRATE sets the default bitrate just like the -b option.

  • PREMIUM sets the premium ID just like the -i option.

  • PLAYER sets the audio player application to use just like the -p option.

  • MENU indicates if interactive menu should be displayed. Valid values are yes and no. The default is to not show the menu.

  • CHANNEL sets the default channel to play or preselect from the menu if no channel is specified on the command line.

  • MY_CHANNELS and MY_URLS allow defining custom Internet radio channels (outside DI, SKY, and JAZZRADIO). MY_CHANNELS must contain a white space separated list of channel names that don’t conflict with the predefined DI.fm and SKY.fm channel names. MY_URLS must contain a white space separated list of playlist URLs matching the channel names.

Example
# Default channel
CHANNEL=eurodance

# Use bigger cache to make sure it doesn't skip.
PLAYER='mplayer -cache 512 -cache-min 50 -playlist'

# Always ask what to play via interactive menu.
# This can be overriden with the -n option.
MENU=yes

Licensing

difmplay has been put into the public domain. You can do whatever you want with difmplay.

Download

difmplay (2014-08-19)

Put it to some directory in PATH and make it executable (chmod +x difmplay). difmplay has been used on GNU/Linux and OpenBSD and probably works on many other operating systems too.

Dependencies

Some audio player is needed to actually play the streams. Most players should work, including most players with graphical user interface. The player just needs to accept an URL to a .pls playlist as its last command line argument. The default is MPlayer.

To use interactive menus to select the settings, you need dialog. Many GNU/Linux distributions include it in their default install.

Displaying multi-column channel list requires column command. It originates from BSD but is available on all GNU/Linux systems too.

Updating the channel list requires curl.