Setting up an iTunes server in FreeBSD
From Section6wiki
Contents |
Setting up an iTunes server in FreeBSD
DaapD
DaapD is an open source Apple iTunes Server that allows you to share your audio files with other iTunes clients on your network using the Apple's DAAP (Digital Audio Access) Protocol.
Setting up the server is a pretty simple and straight-forward task. First, change to the ports directory for DaapD and compile it:
root@host # cd /usr/ports/audio/daapd/ root@host # make install clean
After completion, go to /usr/local/etc and rename the daapd.conf.sample to daapd.conf and open it in your favorite editor. Change ServerName and DBName and also include the path to your audio directory:
Port 3689 ServerName My iTunes Server DBName My iTunes Database Password Root /usr/audio/mp3s Cache Timescan 2 Rescan 0
Rendezvous
Now we are going to install Apple's Rendezvous Responder service. The mDNSResponder port is now available in the FreeBSD ports tree. Simply go to the /usr/ports/net/mDNSResponder directory and install this port:
root@host # cd /usr/ports/net/mDNSResponder/ root@host # make install clean
The newest version of the mDNSResponder port comes with its own rc.d startup script, but if you are using an older version, you might want to create the following mdns.sh script yourself:
==mdns.sh==
#!/bin/sh
mdns_enable=${mdns_enable-"NO"}
mdns_flags="-f /usr/local/etc/mdns.conf"
. /etc/rc.subr
name="mdns"
rcvar=`set_rcvar`
mdns_user="daapd"
mdns_group="daapd"
prefix="/usr/local"
logdir="/var/log"
mdnsBin="${prefix}/bin/mDNSResponderPosix"
mdnsLog="${logdir}/mdns.log"
required_files="${mdnsCfg}"
command="${mdnsBin}"
command_args="${mdns_flags} >>${mdnsLog} 2>&1 &"
load_rc_config $name
run_rc_command "$1"
Simply place this startup script in /usr/local/etc/rc.d and add the follwing entry to /etc/rc.conf</conf>
mdns_enable="YES" daapd_enable="YES"
The only thing we have to do now, is change the configuration file for <tt> mDNSResponder. Go to /usr/local/etc/ and edit/create a file called mdns.conf.
Here is an example mdns.conf file:
My iTunes Server _daap._tcp. 3689
The newline after _daap._tcp. is necessary. Save the file and we are done. Of course, we might want to start the server up. Both (Daap and Rendezvous) should automatically start when you reboot your server, but of course you can start them manually:
# /usr/local/etc/rc.d/daapd.sh start # /usr/local/etc/rc.d/mdns.sh start
At this point you should be able to open an iTunes client and find your server on your local network. Remember that even though the Rendezvous protocol will work across a WAN, the newer iTunes clients only function on local subnets.
Some notes about id3 tags, daapd, and iTunes
You may notice that when you import your initial mp3 collection, and even when you try to edit id3 tags, daapd may report different information than what iTunes reported (this is especially so with genre listings). This is because there are multiple standards for id3 tags and daapd doesn't seem to report them correctly if they're in a format above id3v2.2.
The reason for this (from what I can tell) is that either iTunes and/or daapd prefers id3v2.2. The Mp3 tags iTunes writes are in id3v2.2 format, and it also puts some custom tags of its comments. It may also be that id3lib is having a hard time with higher versions, though that doesn't make much sense since I'd think it likely id3lib supports all versions as does the tools it comes with. It should be noted that AAC (or mp4) files don't seem to have problems in my experience because tagging is built into the standard.
That said, the easiest way to get things like any genre name you want (not the genres linked to numbers) and to fix your tags so the artist info, etc is correct is to use a tool like Mp3Rage for OS X and convert all the tags to id3v2.2. Any tool that can convert tags to id3v2.2 will work.
If the above doesn't work (and there's a chance it won't, especially if you bought the mp3s from an online service), another way to do it is to to do the following:
First, back up the mp3s you're going to modify. We won't assume any liability for loss of music here. Use id3v2 to strip the id3 tags from your mp3s like so:
id3v2 -D *mp3
Note: If you use id3v2 to modifiy your id3 tags you likely won't get the results you want. id3v2 doesn't seems to prefer to write tags in the highest version it supports which is either id3v2.3 or 2.4.
Next import that directory of mp3s with the stripped tags into your Mac (or PC) and use iTunes to re-enter all the id3 tags again from scratch. This may be a pain, but it's the only way I've found that gets results.
Put that directory of mp3s back into your daapd music tree, daapd should now read the tags correctly.

