LINUXUSER Firefly Audio Streaming

Firefly Music Server JUKEBOX HERO The Firefly makes streaming music and onto your home network for iTunes or

Banshee clients as easy as pie. BY MARTIN LOSCHWITZ

magine a scenario in which you have collection is spread across the hard disks The provides a two stationary PCs on your network, of the three workstations, and if you free implementation of the DAAP proto- Iand you also use a laptop as a porta- happen to be working on your laptop, col and acts just like an iTunes client. It ble workstation. An older PC acts as a you can only access the songs on the scans the hard disk for tracks and pub- gateway, print, and file server. Your local disk. lishes information about the tracks on music To be able to access the whole collec- the local network. DAAP-compatible tion, all three computers would need programs on the network evaluate the to be up and running. Furthermore, offer and display it for the user to see. using Samba or NFS shares for ac- To listen to a track, a user just needs to cess is not your idea of a conve- click the track in his player, and Firefly nient approach. will serve it up over the wire. You could iTunes has a neat solu- describe this approach as a kind of tion for this problem – “streaming on demand”. any iTunes-compatible If you were to move your track collec- client on the network tion from the other computers on the can use DAAP, a pro- network to your router, which will typi- tocol developed by cally be up 24/ 7, and then install the Apple for sharing music, to access Low-Budget Multimedia shared tracks. Server If you have If you are interested in installing a Firefly iTunes on your Media Server, but don’t have suitable computer, every hardware, try the NSLU2 by Linksys. iTunes user on the The device, which you can use to con- local network will see nect external hard disks to your net- your shared music, work, is available from hardware stores and can tune in at for about US$ 75; you also need an ex- the click of the ternal data store. You can use Unslung mouse. However, or OpenSlug to convert the SLU2 to iTunes will only run , and install Firefly as described on Mac OS or Win- previously. This gives you a miniature dows, so you would computer that will not make any noise at all for just US$ 200. The best thing is have to use a ma- that the SLU2 can do more than just pro- chine with one of vide reliable multimedia services. these operating sys- tems, store your music collection on GLOSSARY that machine, and DAAP: Digital Audio Access Protocol. A leave it switched on protocol developed by Apple that which 24/ 7 to guarantee is based on HTTP and supports sharing access for the of audio files with clients on a network. other clients. Fire- Since Apple has not released official fly [1], however, documentation, the specification is provides you with based on reverse engineering. Pro- you a convenient grams that support DAAP include Ama- workaround. rok, , and .

78 ISSUE 77 APRIL 2007 Firefly Audio Streaming LINUXUSER

It can take a while before the iTunes cli- ents 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. 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 user- name 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 The function you will probably need server configuration. the most is the one for telling the Firefly Media Server to check for new tracks. Firefly Media Server on the router, you mt-daapd.conf (see Listing 1). You can Start Scan tells the server to search for do not need to run another server ma- keep the defaults for most values, but new material, whereas Start Full Scan chine to access the central audio library you will need to modify the settings for deletes the existing database and sets up from any other machine on the network. admin_pw (administrator password) and a new one. The main page of the web in- servername (descriptive name of server). terface also has a collection of statistics, Firefly Installation For mp3_dir, enter the folder in which such as the number of listeners online Firefly went through a renaming phase you store your track collection, and for right now, or how many tracks the Fire- recently – the project’s original name db_type (music database format), type fly server has streamed to clients since was mt-daapd – and Firefly is still recov- sqlite3. After saving the configuration the last reboot. ering from the experience. As a result, file, you can launch Firefly as follows: The navigation system is on the left, most current distributions do not have and it takes you to the web interface’s prebuilt packages for Firefly, so you /usr/local/sbin/mt-daapd -cU other functions. The Smart must build Firefly from the source code. /usr/local/etc/mt-daapd.conf function is similar to iTunes’ “Intelligent Download the current, prepacked Playlists”. With some help from a wiz- “nightly” snapshot [2]. Look for a link such as mt-daapd-svn-Build.tar.gz, Listing 1: mt-daapd.conf where Build represents the four-digit 01 # mt-daapd.conf (example) 15 extensions = .,.m4a,.m4p build number. Unpack the sources, 02 16 change to the directory that is created by this step, and then follow the normal 03 [general] 17 ssc_codectypes = ,,alac steps: ./configure, make, and make in- 04 web_root = /usr/local/share 18 ssc_prog = stall. After completing these steps, the /mt-daapd/admin-root /usr/local/bin/mt-daapd-ssc. Firefly Media Server (mt-daapd) should 05 port = 3689 sh reside in /usr/local. 06 admin_pw = mt-daapd 19 Configuration 07 20 logfile = /var/log/mt-daapd. log The file with the configuration settings is 08 db_type = sqlite3 21 scan_type = 2 located in /usr/local/etc, and called 09 db_parms = /var/db/mt-daapd 22 10 Tip 23 [plugins] 11 mp3_dir = /home/mp3 24 plugin_dir = You should use the fast search mecha- 12 servername = iTunes server nism to update the Firefly database, if /usr/local/share/mt-daapd/ 13 possible. This will save you a huge plugins amount of time in comparison to setting 14 runas = daapd # distribution 25 plugins = rsp.so,ssc-script.so up a new database. independent

WWW.LINUX - MAGAZINE.COM ISSUE 77 APRIL 2007 79 LINUXUSER Firefly Audio Streaming

file, adding an entry for .url. Then restart the Firefly server, and use the web inter- face to run a file scan. After completing the scan, the Fireflay will have an entry that reads- Wolf.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 Ban- shee utility – the DAAP client was origi- nally developed for Foresight Linux, but now also works on other distributions. The project homepage [5] has prebuilt packages for openSUSE, Ubuntu, Gen- too, and Fedora Core 4. If you have any Figure 2: Banshee is aiming to become an “” for GNOME. It already has support for other distribution, your mileage may the DAAP protocol. vary [6]. The Banshee user interface is ard, and the ID3 data for your collection, to find the stream you want to listen modeled, in part, on iTunes. The player you can store playlists based on arbitrary to, and then you are able to access will recognize DAAP streams automati- criteria. For example, you can tell Firefly mt-daapd from any machine on the net- cally, just like its role model, and it will to compile a playlist of songs from the work to listen to your choice of music display icons to match on the left of the years 1960 through 1969. via the local gateway. button bar. Again, you can click an icon Configuration takes you to the multi- To set this feature up, store a file to play a track (Figure 2). media server settings. Note that the ac- called name.url in the directory that count on which mt-daapd is running will holds your music collection, where Conclusions need write permissions for /usr/local/etc name should be an intuitive name for A combination of the Firefly media in order for you to change any settings. the station in question. Next, add a line server with iTunes or Banshee is perfect of the format bit rate, name, address to for streaming music across your home Music and Streams the file. For example, to listen to Wolf. network. In connection with SSH port Once you have your Firefly server up FM [4], you would create a file called forwarding, you could even route the and running, it’s smooth sailing. Simply wolffm.url, and then you add the follow- Firefly signal across a VPN network, launch iTunes on a computer on your ing lines, based on the details found on thus gaining the ability to access your network and the Firefly server shows up the station website: private music collection anywhere, in the list of shares on the left. Click the anytime. entry to tell iTunes to load the index off 64,Wolf.FM -- The hottest mix,U On a parting note, hardware dealers the server, and display a list of available http://sc1.abacast.com:8035/ now have compact devices such as the tracks. You can then click a track to play SoundBridge (Figure 3), which it in iTunes. You also need to modify the extensions you can use as a front-end for the Firefly Web radio stations that broadcast MP3 line in the Firefly server configuration Media Server, thus replacing a legacy data (also known as stereo. Expect to pay about US$ 130 at streams) over the your local hardware store. ■ network are becom- ing increasingly INFO popular. iTunes has [1] Firefly: http:// fireflymediaserver. org a list of Radio sta- [2] Nightly snapshot: tions with various http:// nightlies. mt-daapd. org offerings, and the [3] Overview of SHOUTcast radio sta- SHOUTcast website tions: http:// www. shoutcast. com/ [3] has a list of pop- [4] Information on Wolf.FM: ular stations. http:// www. wolffm. com/ pls/ wolffm. pls The Firefly server can act as a “Relay” [5] Banshee packages: http:// banshee-project. org/ Getting_Started for these radio sta- tions. You just need Figure 3: The Roku SoundBridge and Firefly can replace a legacy [6] Building Banshee: http:// to tell Firefly where stereo. banshee-project. org/ Banshee_Source

80 ISSUE 77 APRIL 2007 WWW.LINUX - MAGAZINE.COM