Friday 13 January 2006

Myth2iPod

Found a nice little project called Myth2iPod that transcodes MythTV .nuv files to iPod video and provides them as a subscribable podcast feed.

Unfortunately it relies on the xvid support in the latest version of ffmpeg (only available through CVS), that doesn't want to compile on my FC3 machine. Will post if and when I get it working.

Monday 9 January 2006

Upgraded to Rails v1.0

Managed the upgrade to version 1 without any major hitches. Just two notable differences...

  • The AJAX stuff is fixed (which stopped us from upgrading to the last release).
  • ActiveRecord has slightly stricter constraints on creation of new objects with has_and_belongs_to_many relationships.

The ActiveRecord change means that you can't create a new object and it's join table based relationships without first saving the main object. If object has_and_belongs_to_many relations, then... object = Object.new object.relations << relation object.save needed changing to... object = Object.create object.relations << relation

It makes some sense, since the identity of object has not yet been created, but it's a bit of a shame that the ORM layer can't hide these issues from you.

Monday 2 January 2006

Make your own Linux iTunes Server

Make your own Linux iTunes Server

This walkthrough is based on Fedora Core 3 which I'm running on my MythTV Server. If you find any innaccuracies, please let me know and I'll fix 'em.

Install daapd using APT

Make sure you have Dag's repository set up for apt (you might wish to set up a Yum repo instead as Yum is included by default with Fedora).

My repo file looks like this...

# cat /etc/apt/sources.list.d/dries.list
rpm http://apt.sw.be dries/fedora/fc3/i386 dries
rpm-src http://apt.sw.be dries/fedora/fc3/i386 dries

Make sure you are up to date then get the daapd package, the howl package (needed for mDNSRepsonder) and their depencencies...

# apt-get update
# apt-get dist-upgrade
# apt-get install daapd
# apt-get install howl

Configuration

Create a config file like this one

# cat /etc/daapd.conf
Port            3689
ServerName      MythMusic
DBName          daapd music
Password
Root            /av/audio
Cache           /var/spool/daapd/cache
Timescan        2
Rescan          0

Change /av/audio to the location of your music collection, and create the folder /var/spool/daapd/cache as root (if you don't do this, the files will be rescanned by the server each time you run daapd). If you want to secure your audio files, put a password in the obvious gap.

Start daapd as a Service

Create a file called /etc/rc.d/init.d/daapd with the following contents

# cat /etc/init.d/daapd
#!/bin/sh
#
# A startup script for the daapd DAAP server
#
# chkconfig: 345 98 2
# description: This script is used to start the daapd \
# server as a background process.\
#
# Usage /etc/init.d/daapd start|stop|reload|restart|status

# Source function library.
. /etc/rc.d/init.d/functions

DAAP_CONF=/etc/daapd.conf
DAAP_LOG=/var/log/daapd/access_log
prog=DAAP
exe=/usr/bin/daapd

start() {
        echo -n "Starting $prog: "
        if [ -f /var/lock/subsys/daapd ] ; then
                echo_failure
                echo
                exit 1;
        fi
        daemon $exe -c $DAAP_CONF >> $DAAP_LOG &
        RETVAL=$?
        [ $RETVAL = 0 ] && touch /var/lock/subsys/daapd && echo_success
        echo
        return $RETVAL
}

stop() {
        echo -n "Stopping $prog: "
        killproc $exe
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/daapd /var/run/daapd.pid
}

reload()
{
        echo -n $"Reloading $prog:"
        killproc $exe -HUP
        RETVAL=$?
        echo
}


case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload)
        reload
        ;;
restart)
        stop
        start
        ;;
status)
        status $exe
        RETVAL=$?
        ;;
*)
        echo "Usage: daapd {start|stop|reload|restart|status}"
        exit 1
esac

Create the log folder so that the service can write a log file.

# mkdir -p /var/log/daapd

Now you should be able to start daapd as a service...

# service daapd start
Starting DAAP:              [  OK  ]

It may be some time before you can access this service if you have a large collection, as it will not respond until it has indexed the files.

mDNSResponder Configuration

In order for iTunes to detect the new playlists, you need to setup mDNSResponder to broadcast the presence of the service. Add the following line to the end of the mDNSResponser config file.

# tail -1 /etc/howl/mDNSResponder.conf
MythMusic _daap._tcp.     local.  3689

Start mDNSResponder

# service mDNSResponder start
Starting mDNSResponder...   [  OK  ]

Any copies of iTunes residing on your local network should now have a shared music folder containing your entire music collection, including any playlists found in the same folder.

Merry Christmas

...and a happy new year to you all.

Penny gave me an 60GB iPod Video for Christmas, which I have been playing with constantly.

So far, I've got my main MythTV server running an iTunes server (DAAP), so that anyone using iTunes on my LAN can browse my MP3 collection. It was pretty easy using Dag's APT repo.

My next little project will be to get MythTV automatically converting certain TV programs to iPod compatible MP4 video files.