Bob's Notepad

Notes on projects I have done and things I have learned saved for my reference and for the world to share

Saturday, September 08, 2007

MythMusic with iTunes

Now that I am putting more effort into MythTV being the control of entertainment in my house, I've begun working on the MythMusic application. Currently I use iTunes on my iMac for my music library which syncs with my iPod and scrobbles tracks to The last thing I want is another application that I need to keep synced. Here are things I found to make life a little easier/

Trick #1: Share your iTunes Music folder via NFS

On my Mac I moved my iTunes store folder to /music-lib/ rather than the directory it uses by default. My primary reason for doing this was nothing more than the default folder contains a space in the name and this makes things a little harder for NFS. Once all your MP3 files are there, we need to set up the NFS share.... which really isn't all that hard. I used the following guide to do this:

Note: On Windows you could substitute this process to use Samba and adjust accordingly

Now you need to mount that share on all applicable MythTV machines. Currently I use Mythbuntu and I have a primary backend machine and 2 front end only machines. First thing you'll need to do is "apt-get install nfs-client" to allow Mythbuntu to connect to an NFS share. Once that's installed, create an empty directory to mount your music in. I created /mnt/music/ for my systems. Now add the following line into your /etc/fstab file on all of your myth machines:

SERVER:/music-lib /mnt/music nfs
(Substitue SERVER with your iTunes' machines IP address and adjust the share names as needed)

Now what's left is to go into the mythmusic settings and change the recordings directory to /mnt/music.

You're ready to listen to music!

Trick #2: iTunes Playlists

So MythMusic has an extreme lack of intuitive playlist editting.... actually, you can't even call it a playlist editor. I want an easy was to use my iTunes playlists. Two people have done an amazing job at a perl script that takes care of a conversion and imports the iTunes playlists into your mythconverg database.

Grab that perl script and throw it on the machine that serves as your mythtv backend. On mythbuntu you need to install XML:Parser which can be done by "apt-get install libxml-parser-perl". Edit the variables at the top of that script and do a chmod +x on the perl script. If you have multiple machines, you will need to run the script different times with the hostname set as each of the myth machines you want the playlists to be active on.

Before you run that script, you need to make sure the iTunes library XML file is in your music-lib directory. I renamed mine to exclude spaces and then copied it to the music-lib directory on my iMac.

Run the script and you should now have playlists in MythMusic.

Trick #3: Automate Trick #2

I have a lot of smart playlists and I am often creating new playlists and, of course, always adding new music to my library. I don't want to have to do this everytime I make an update so I automated the process. I created a script on my iMac to copy the "real" iTunes XML file into the music-lib directory every hour. OSX has dropped the use of cron and replaced it with launchd. Here is a guide you can use to get this set up:

Once that's set up, you need to set up a crontab on your myth system(s) to run the perl script. If you do this hourly, make sure you set your iTunes computer to copy the file before the crontab runs on your myth machines. For instance, make your itunes machine run on minuet 05 and the myth machines run on 08.

Now you're set.... things should automatically update for you.

Trick #4: Scrobble to your account

I use an awful lot and if I start using MythMusic over iTunes, I lose that scrobbling. I have not completed this yet (or even really began looking at it) but here is a link where you can get a patch. I need to figure out how to apply this on an active mythbuntu system. I'll report back when/if I come up with something :)

Labels: , , , , , ,

Reference Link


Post a Comment

<< Home