Monday, December 18, 2006

Upgrading mt-daapd to firefly

Ever since I ordered the soundbridge I spent a lot of time on forums about mt-daapd and the soundbridge. I found out that the pinnacle soundbridge (available in my country) does not work with the mt-daapd music server I am currently running (0.2.4). I decided not to wait until the SB arrives but to update my server with a more uptodate version of the server. So that if the SB arrives it is truly plug and play. And not "plug -updating my server- and play".

Unfortunately it did not go as smooth as I hoped it would go. First I downloaded the most recent version of firefly, firefly is the software formally knows as mt-daapd. Version 0.2.4 is the last official stable version of firefly. Unfortunately this version may not be compatible with the Pinnacle soundbridge, with the ROKU soundbrigde it should work fine.
So I decided to upgrade to a development version You can find these development "nightly" versions here. As I am still running a ubuntu dapper Linux server, I downloaded the Debian (.deb) package. And typed
sudo dpkg --install mt-daapd_0.9-svn-1450_i386(2).deb
Unfortunately it gave back a list with all kinds of packages that were missing. After an hour I managed to install all the missing packages. And tried another install of the firefly server.

Although the installation went smooth It still did not work. Mt-daapd was clearly running (find all the processes running on your server by typing "top") but it did not show up in my I-tunes. After a while I found out the problem was that, although I re-installed the software, it was still using my old mt-daap.conf file. after overwriting the the old mt-daapd.conf file and restarting the server it showed up in I-tunes and seemed to work perfectly.

I was pretty proud that I all got it working. Unfortunately my mt-daapd.log file was showing loads of errors.
2006-12-17 15:09:58 (00004000): Firefly Version svn-1450: Starting with debuglevel 2
Starting rendezvous daemon
Starting signal handler
Signal handler started
Error: enum_begin failed (error 1): Misc SQL Error: no such table: config
Can't get db version. New database?
Initializing database
Error: enum_begin failed (error 1): ?
Starting web server from /usr/share/mt-daapd/admin-root on port 3689
Registering rendezvous names
Serving 1234 songs. Startup complete in 4 seconds
The database errors confused me, I could not remember that I ever installed a database to support mt-daapd. After a while I found out that firefly was dependend on sqlite database. So I installed the sqlite database
sudo apt-get install sqlite
. After re-installing firefly it finally stopped showing all the errors.

The updated software has some really nice new features, like making playlists with the web interface without restarting the server and it even has a java-applet to play you music from your browser. But more about this in the next post.
From now on I will sum up the links to pages that I found usefull for the topic of the post.

download firefly development
firefly forum
rokulab soundbridge forums

Friday, December 08, 2006

Ordered the soundbridge

Since I am so happy with my mtdaapd server. I decided to buy a Roku soundbridge. With the soundbridge I am able to listen to my music over my network without having to turn my pc on and it is compatible with the daap-music server installed on my ubuntu linux server. It looks like this
The soundbridge is capable of streaming my music and I can also listen to many digital radio station. Once I got it I will write a review here. Check the website here.

Tuesday, December 05, 2006

Play counter mt-daapd part 2

Yesterday I told about the counter of my daap-server. I altered the code a bit and now it is smaller.
$myFile = "mt-daapd.log";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));

$address = array('/','/','/') ;
$name = array(john, Joe, Lisa);
for ( $counter = 0; $counter <= 2; $counter += 1) {

if (preg_match_all($address[$counter], $theData, $user)) {
echo $name[$counter]," ", count($user[0]), "
} else {
echo $name[$counter]," did not play any songs";

Monday, December 04, 2006

mt-daapd play counter


Since a couple of months I use the mt-daapd software to make my server share my music collection over my local network. I posted about this a while ago. Since I live with 8 people in a house I was very curious if anybody besides me was using the music server, and how often do they play songs. I found out that the admin pages show how many songs are played but not who has played them.

than I found out that the daap-server could keep a log of all actions going on. The log looks like this
2006-12-02 23:17:48: Session 0: Streaming file help.mp3' to (offset 0)
2006-12-02 23:17:49: Session 0: Streaming file 'yesterday.mp3' to (offset 0)
2006-12-02 23:19:54: Session 0: Streaming file 'imagine.mp3' to (offset 0)
Since I installed my php server I thought it must be possible to write some php code to count the ip-adresses of the different users. It took a while but finally it worked.
The php code is probably not as efficient as possible. If you know an easier way please comment:

$myFile = "mt-daapd.log";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));

if (preg_match_all("/", $theData, $john)) {
echo "John ", count($john[0]), "
} else {
echo "John did not play any songs";
if (preg_match_all("/", $theData, $jef)) {
echo "jef ", count($jef[0]), "
} else {
echo "Jef did not play any songs";

if (preg_match_all("/", $theData, $lisa)) {
echo "Lisa ", count($lisa[0]);
} else {
echo "Lisa did not play any songs";

mysql phpmyadmin

Actually I promised to talk about installing mysql and phpmyadmin. Unfortunately it has been a while ago since I installed these packages and I do not remember much of it. Since there are so many really good howto`s on these two packages I will not discuss them here. If you encounter problems please visit if you have trouble installing either-one of the packages these people can certainly help you.