Firefly Media Server Setup

From rigsbwiki

Jump to: navigation, search

Contents

Objectives

Share iTunes Libraries from a central location to compatible devices using open source tools.

  • Must be compatible with iTunes.
  • Must serve multiple iTunes libraries.

Notes

History

Previously, all of our iTunes media was stored on a FreeBSD file server and shared out via Netatalk (AFP) to the macs in the house. The macs would mount the share and each installation of iTunes was configured to store its media on this mounted share. This was a very messy solution As multiple users added files and worked with the share, the iTunes libraries would not always get updated resulting in inaccurate libraries being presented. Also, multiple iPods could not be synced properly. Last year, we bought a Mac Mini to serve as the main workstation in the house. It now stores all of our media and hosts the iTunes libraries that all of our iPods sync to. Before the DIY Time Capsule was setup, the Mini would rsync the various media files (iTunes, iPhoto, iMovie) to our CentOS server for backup. As an added bonus, I installed Firefly Media Server on the CentOS server and configured it to share the rsync'd copy of the iTunes library. I also created multiple libraries to share different content (For example it's really weird to be listening to Party Shuffle and one minute you have Metallica playing and then you get the Charlie Brown's Christmas album). I decided the best solution was to have the libraries shared directly from the Mini

Install and Configuration

  • Install XCode and MacPorts.
    • I installed XCode from the Leopard install DVD.
    • MacPorts can be found here.
  • Install mt-daapd and sqlite3 from MacPorts
    • mt-daapd installs an older version of Firefly and all of the dependencies. The dependencies are what we are after. When the nightly is installed, it overwrites the old version of mt-daapd.
sudo port install mt-daapd
sudo port install sqlite3
  • Compile and Install the latest Firefly nightly.
    • Nightlies can be found here.
tar xzvf mt-daapd-svn-1696.tar.gz
cd mt-daapd-svn-1696
./configure --prefix=/opt/local --with-gdbm-includes=/opt/local/include --with-gdbm-libs=/opt/local/lib --enable-sqlite3
make
sudo make install
  • Copy the sample config from the source directory.
cp conrtib/mt-daapd.conf /opt/local/etc/
  • Edit the sample config to share your iTunes library.

Hosting Multiple Libraries

  • The key is changing the port and source directory of your tunes and saving a config file for each library you want to share.

Setting launchd to start Firefly servers

  • I created the following files in /Library/LaunchDaemons
local.mini.mt-daapd_guitar.plist        local.mini.mt-daapd_kids.plist
local.mini.mt-daapd_holidays.plist      local.mini.mt-daapd_main.plist
  • Example of the plist files.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>KeepAlive</key>
        <false/>
        <key>Label</key>
        <string>local.mini.mt-daapd_main</string>
        <key>ProgramArguments</key>
        <array>
                <string>/opt/local/sbin/mt-daapd</string>
                <string>-c</string>
                <string>/opt/local/etc/mt-daapd_main.conf</string>
        </array>
        <key>QueueDirectories</key>
        <array/>
        <key>RunAtLoad</key>
        <true/>
        <key>WatchPaths</key>
        <array/>
</dict>
</plist>
  • Load the plist using launchctl.
sudo launchctl load /Library/LaunchDaemons/local.mini.mt-daapd_main.plist

Hints

  • I used Lingon to create and configure my launchd stuff.
  • I have 4 libraries shared out. Use iTunes to create the multiple libraries and associated folder structure.
Personal tools