Now that I have a NAS at home, I plan to place stuff that takes up a lot of space that doesn’t get used so often on there. However, with that comes the issue of file access. Since my NAS is linux based – ubuntu server edition to be exact – I can access files via ssh, sftp, ftp, sshfs (map the drive), samba, etc. I should probably write a blog post about sshfs and samba soon.
However, what if I want to listen to music in my music player, say itunes on Mac/Windows or rhythmbox (or amarok, bashee, etc) on Linux? The good thing about itunes and these bloated music players are that they have a database of all your music files, so finding the song is fairly quick (type in artist name or song title). Double clicking the files on the mounted drive is no problem, but having this “search and play” capabilities is quite useful. Luckily, there are many solutions to this, one of which is the DAAP method. Read here for an overview.
Game plan is as follow:
- Set up music server on NAS.
- Be able to access the songs in itunes or the likes on remote servers in the same network.
- Be able to access the songs in itunes or the likes on remote servers when on a different network, say at school (or at work).
The first point is fairly easy on Ubuntu: install Firefly Music Server (formerly known as mt-daapd). Following these instructions, I did
<pre class="src src-sh">sudo apt-get install mt-daapd
sudo apt-get install libid3tag0 sudo apt-get install avahi-utils ## needed for remote access sudo adduser media su media mkdir /home/media/music exit
Place music in
/home/media/music or create a symlink to the music folder.
<pre class="src src-sh">sudo /etc/init.d/mt-daapd start
sudo update-rc.d mt-daapd defaults
Now, from that computer, go to
http://ip.address:3689 (username and password is mt-daapd). On this site, we can set up the configuration. Set username/password, password to listen, and music folder. Then scan the files. (Might have to do
sudo /etc/init.d/mt-daapd start).
From here, computers on the network should be able to see the music server in itunes or rhythmbox (point 2) and play music (after entering music password). NOTE: I initially thought that you had to “Open Audio Stream…” or the likes on the music players, but that is for internet radio or something; DAAP servers will broadcast the music server to the network.
To do point 3, the first thing to do is set up port forwarding on the router (3689 to 3689 on the music server). The remaining part is a bit tricky. First, you have to do ssh tunneling so that the remote music server appears to be on the same network as your computer/laptop. Then we have to forward the “broadcast” from the DAAP server (the server that itunes sees, for example).
<pre class="src src-sh">ssh firstname.lastname@example.org -N -f -L local.ip:6689:localhost:3689
avahi-publish-address -v -H “name of your host”.local -s “My daap share” _daap._tcp. 6689 & ## find name of host from echo $HOSTNAME
Now, itunes or other clients on the remote server should see “My daap share” on the Shared list. NOTE: currently, Linux players such as rhythmbox and banshee can’t play music this way. I’m sure a fix should be coming soon. If a mac is also on the same network as this current linux client, it will see the shared daap server and connect and play music.
For a Mac client, instructions can be found here:
<pre class="src src-sh">dns-sd -P <span style="color: #ffa07a;">"Home iTunes"</span> _daap._tcp local 3689 localhost 127.0.0.1 <span style="color: #ffa07a;">"Arbitrary text record"</span> &
ssh -C -N -f -L 3689:localhost:3689 email@example.com
Itunes should be able to see the remote daap server.
For a Windows machine, I’m sure one would have to rely on RendezvousProxy, following these instructions. I will test this out soon (setting this up for my girlfriend).