Firefly Music Server

Jukebox Hero


The Firefly Media Server makes streaming music and Internet radio onto your home network for iTunes or Banshee clients as easy as pie.

By Martin Loschwitz

Imagine a scenario in which you have two stationary PCs on your network, and you also use a laptop as a portable workstation. An older PC acts as a gateway, print, and file server. Your music collection is spread across the hard disks of the three workstations, and if you happen to be working on your laptop, you can only access the songs on the local disk.

To be able to access the whole collection, all three computers would need to be up and running. Furthermore, using Samba or NFS shares for access is not your idea of a convenient approach.

iTunes has a neat solution for this problem - any iTunes-compatible client on the network can use DAAP, a protocol developed by Apple for sharing music, to access shared tracks.

If you have iTunes on your computer, every iTunes user on the local network will see your shared music, and can tune in at the click of the mouse. However, iTunes will only run on Mac OS or Windows, so you would have to use a machine with one of these operating systems, store your music collection on that machine, and leave it switched on 24/7 to guarantee access for the other clients. Firefly [1], however, provides you with you a convenient workaround.

The Firefly Media Server provides a free implementation of the DAAP protocol and acts just like an iTunes client. It scans the hard disk for tracks and publishes information about the tracks on the local network. DAAP-compatible programs on the network evaluate the offer and display it for the user to see. To listen to a track, a user just needs to click the track in his player, and Firefly will serve it up over the wire. You could describe this approach as a kind of "streaming on demand".

If you were to move your track collection from the other computers on the network to your router, which will typically be up 24/7, and then install the Firefly Media Server on the router, you do not need to run another server machine to access the central audio library from any other machine on the network.


GLOSSARY
DAAP: Digital Audio Access Protocol. A protocol developed by Apple that which is based on HTTP and supports sharing of audio files with clients on a network. Since Apple has not released official documentation, the specification is based on reverse engineering. Programs that support DAAP include Amarok, Banshee, and Rhythmbox.

Low-Budget Multimedia Server

If you are interested in installing a Firefly Media Server, but don't have suitable hardware, try the NSLU2 by Linksys. The device, which you can use to connect external hard disks to your network, is available from hardware stores for about US$ 75; you also need an external data store. You can use Unslung or OpenSlug to convert the SLU2 to Linux, and install Firefly as described previously. This gives you a miniature computer that will not make any noise at all for just US$ 200. The best thing is that the SLU2 can do more than just provide reliable multimedia services.

Firefly Installation

Firefly went through a renaming phase recently - the project's original name was mt-daapd - and Firefly is still recovering from the experience. As a result, most current distributions do not have prebuilt packages for Firefly, so you must build Firefly from the source code.

Download the current, prepacked "nightly" snapshot [2]. Look for a link such as mt-daapd-svn-Build.tar.gz, where Build represents the four-digit build number. Unpack the sources, change to the directory that is created by this step, and then follow the normal steps: ./configure, make, and make install. After completing these steps, the Firefly Media Server (mt-daapd) should reside in /usr/local.

Configuration

The file with the configuration settings is located in /usr/local/etc, and called mt-daapd.conf (see Listing 1). You can keep the defaults for most values, but you will need to modify the settings for admin_pw (administrator password) and servername (descriptive name of server). For mp3_dir, enter the folder in which you store your track collection, and for db_type (music database format), type sqlite3. After saving the configuration file, you can launch Firefly as follows:

/usr/local/sbin/mt-daapd -c/usr/local/etc/mt-daapd.conf

It can take a while before the iTunes clients on your network can see the new multimedia server. Before Firefly starts publishing its services, it first scans the mp3_dir to check for existing tracks and creates a database.

Listing 1: mt-daapd.conf
01 # mt-daapd.conf (example)
02
03 [general]
04 web_root = /usr/local/share/mt-daapd/admin-root
05 port = 3689
06 admin_pw = mt-daapd
07
08 db_type = sqlite3
09 db_parms = /var/db/mt-daapd
10
11 mp3_dir = /home/mp3
12 servername = iTunes server
13
14 runas = daapd # distribution independent
15 extensions = .mp3,.m4a,.m4p
16
17 ssc_codectypes = ogg,flac,alac
18 ssc_prog =  /usr/local/bin/mt-daapd-ssc.sh
19
20 logfile = /var/log/mt-daapd.log
21 scan_type = 2
22
23 [plugins]
24 plugin_dir =  /usr/local/share/mt-daapd/plugins
25 plugins = rsp.so,ssc-script.so
Tip

You should use the fast search mechanism to update the Firefly database, if possible. This will save you a huge amount of time in comparison to setting up a new database.

Web Interface

Firefly includes a web interface for point-and-click configuration of the streaming server. To access the server, open the URL http://server IP address:3689 in your browser. Leave the username field empty on authentication, and type the password you specified as admin_pw in the configuration file for Password. This should take you to the Firefly welcome page (see Figure 1), which provides you with an overview of the major functions.

Figure 1: The Firefly web interface supports convenient access to statistics and the music server configuration.

The function you will probably need the most is the one for telling the Firefly Media Server to check for new tracks. Start Scan tells the server to search for new material, whereas Start Full Scan deletes the existing database and sets up a new one. The main page of the web interface also has a collection of statistics, such as the number of listeners online right now, or how many tracks the Firefly server has streamed to clients since the last reboot.

The navigation system is on the left, and it takes you to the web interface's other functions. The Smart Playlists function is similar to iTunes' "Intelligent Playlists". With some help from a wizard, and the ID3 data for your collection, you can store playlists based on arbitrary criteria. For example, you can tell Firefly to compile a playlist of songs from the years 1960 through 1969.

Configuration takes you to the multimedia server settings. Note that the account on which mt-daapd is running will need write permissions for /usr/local/etc in order for you to change any settings.

Music and Streams

Once you have your Firefly server up and running, it's smooth sailing. Simply launch iTunes on a computer on your network and the Firefly server shows up in the list of shares on the left. Click the entry to tell iTunes to load the index off the server, and display a list of available tracks. You can then click a track to play it in iTunes.

Web radio stations that broadcast MP3 data (also known as streams) over the network are becoming increasingly popular. iTunes has a list of Radio stations with various offerings, and the SHOUTcast website [3] has a list of popular stations.

The Firefly server can act as a "Relay" for these radio stations. You just need to tell Firefly where to find the stream you want to listen to, and then you are able to access mt-daapd from any machine on the network to listen to your choice of music via the local gateway.

To set this feature up, store a file called name.url in the directory that holds your music collection, where name should be an intuitive name for the station in question. Next, add a line of the format bit rate, name, address to the file. For example, to listen to Wolf.FM [4], you would create a file called wolffm.url, and then you add the following lines, based on the details found on the station website:

64,Wolf.FM -- The hottest mix,http://sc1.abacast.com:8035/

You also need to modify the extensions line in the Firefly server configuration file, adding an entry for .url. Then restart the Firefly server, and use the web interface to run a file scan.

After completing the scan, the Fireflay playlist will have an entry that readsWolf.FM - The hottest mix. You can then click to connect.

Banshee for iTunes

DAAP won't be much use to you if you just have Linux and don't actually own a Mac or a Windows PC. Enter the Banshee utility - the DAAP client was originally developed for Foresight Linux, but now also works on other distributions. The project homepage [5] has prebuilt packages for openSUSE, Ubuntu, Gentoo, and Fedora Core 4. If you have any other distribution, your mileage may vary [6].

The Banshee user interface is modeled, in part, on iTunes. The player will recognize DAAP streams automatically, just like its role model, and it will display icons to match on the left of the button bar. Again, you can click an icon to play a track (Figure 2).

Figure 2: Banshee is aiming to become an "Amarok" for GNOME. It already has support for the DAAP protocol.

Conclusions

A combination of the Firefly media server with iTunes or Banshee is perfect for streaming music across your home network. In connection with SSH port forwarding, you could even route the Firefly signal across a VPN network, thus gaining the ability to access your private music collection anywhere, anytime.

On a parting note, hardware dealers now have compact devices such as the Roku SoundBridge (Figure 3), which you can use as a front-end for the Firefly Media Server, thus replacing a legacy stereo. Expect to pay about US$ 130 at your local hardware store.

Figure 3: The Roku SoundBridge and Firefly can replace a legacy stereo.
INFO
[1] Firefly: http://fireflymediaserver.org
[2] Nightly snapshot: http://nightlies.mt-daapd.org
[3] Overview of SHOUTcast radio stations: http://www.shoutcast.com/
[4] Information on Wolf.FM: http://www.wolffm.com/pls/wolffm.pls
[5] Banshee packages: http://banshee-project.org/Getting_Started
[6] Building Banshee: http://banshee-project.org/Banshee_Source