FreeBSD iTunes Server
Setting up an iTunes server on FreeBSD
I recently stumbled across an outdated link describing how to set up iTunes style sharing of a music library. This interested me because our family music collection resides on a FreeBSD file server. My music has been stored on a server since back in the dark ages when I managed our music with command line apps. Then iTunes came along and I re-ripped all our CDs into iTunes. This worked just great for years.
The iPod came along and I bought one for I and the Mrs. and all was well. So long as I kept upgrading iPods when new ones came out, I could fit our growing collection of music on one mac and have it backed up on the iPod. The problem with this solution is that the music is on one computer but our house has several. I solved that by moving my ~/Music/iTunes to the file server. By storing the music on the file server, every mac has ready access to it.
Access is set up via an automount entry so that when iTunes accesses the shared music directory, it gets mounted.
$ cat /etc/fstab storage:/Shared /Volumes/Shared url rw,net,automounted,url==afp://matt:*****@storage/Shared 0 0
Then create links to /Volumes/Shared/[storage]/Shared/iTunes in each users ~/Music/iTunes and voila, everyone sees the family music library. On machines that I don't want making changes, I simply change the mount to ro instead of rw.
Our original CDs are all archived away, waiting for the rainy day when I want to rip them into the latest whiz-bang compression format. To reduce the space consumed, I junked all the jewel cases and store them in sleeves. Since we only use the actual CDs once every few years, we have approximately 0% incentive to buy new ones. I buy individual songs on iTunes (mostly) and Amazon (rarely). For albums that have at least 4 good songs, I buy the CD on half.com and other second hand markets.
Perhaps soon I'll upgrade my file server with enough space to do this with my DVDs. Everyone with children knows exactly why.
Serving without iTunes
the circuitous route
I recently began listening to my iTunes home music collection at work. I do so with a simple ssh command and a little bit of network magic. The network magic is adding a redirection rule to my firewall that directs ssh traffic from my office to my mac at home. Then I ssh to my home server like so:
ssh -L3689:imac24:3689 home.simerson.net
This tunnels traffic from my local machine to iTunes on my mac at home. Then a little bit of mDNSResponder magic broadcasts the new service via Bonjour and it shows up in iTunes on my mac here at work. Voila, I can play anything from my home library here at the office. So long as I'm logged in and iTunes is running on my mac at home.
The astute reader will recall that my music libraries live on the file server. So this method requires that I connect through my firewall to my mac, which then connects to the fileserver to get the files. Too bad I can't serve the media files directly off the file server. :)
the direct route
I first installed mt-daapd from ports (audio/mt-daapd). The version in ports does mostly work. After firing it up I was able to browse to it with iTunes but that version doesn't parse the iTunes Library file and organize my music into playlists. So, I headed off the internet and found the latest version is now the Firefly Media Server. After reading through a number of the articles, I finally figured out that I needed a nightly build to support parsing the iTunes database.
I downloaded mt-daapd-svn-1586. It requires sqlite to be installed so I installed sqlite3 (databases/sqlite3). After that it was a simple matter of delivering the correct ./configure string to compile and install:
./configure --enable-sqlite3 --with-id3tag=/usr/local && make install
this is my /usr/local/etc/mt-daapd.conf config file.
[general] web_root = /usr/local/share/mt-daapd/admin-root port = 3689 admin_pw = ******** db_type = sqlite3 db_parms = /usr/local/var/cache/mt-daapd mp3_dir = /usr/Shared/iTunes servername = Simerson Tunes runas = daapd playlist = /usr/local/etc/mt-daapd.playlist extensions = .mp3,.m4a,.m4p ssc_codectypes = ogg,flac,alac ssc_prog = /usr/local/bin/mt-daapd-ssc.sh logfile = /var/log/mt-daapd.log scan_type = 2 process_itunes = 1 [plugins] plugin_dir = /usr/local/share/mt-daapd/plugins
Unfortunately, it doesn't show some of the metadata that iTunes does. Most notably, I don't get song ratings, and the playlist information is flattened. Smart playlists aren't smart, they are just playlists with static contents. This is understandable because they are parsing the XML file that iTunes generates, and IIRC, it doesn't have most of that metadata.
But I'm able to browse the music collection via any iTunes and share it to myself at work, without my iMac and iTunes in the middle.