home
software
resumé
contact

March 22, 2006

MythTV/iTunes Compatibility

I use MythTV to power my home theatre system. It has some great features, like commercial auto-skip and (with MythBurn) DVD burning.

It also includes MythMusic, an interface for playing MP3 and AAC files. Unfortunately, MythMusic does not include a DAAP client, and thus cannot play iTunes music directly. It is, however, possible to share music between iTunes and MythTV, playlists and all.

Before beginning, you might want to check the "Show entire music tree" option in Playback Settings (under Media Settings). This option makes MythMusic infinitely more useful, because it's not necessary to create a new playlist just to play a specific album.

The easiest way to share music between iTunes and MythMusic is to copy the iTunes folder from the client computer (in ~/Music/) to the MythTV server, then put an alias back to the folder on the server in its place. (The folder will have to be shared with Netatalk, Samba, NFS, or WebDAV so that OS X can access it.) This way, you can still synchronize your iPod with the library, but all the music resides on the MythTV box.

MythTV cannot natively read the iTunes Music Library XML format, however, and thus it is necessary to find a workaround to use iTunes playlists. This perl script will clear all playlists in the MythMusic database, then populate it with playlists found in the iTunes Music Library XML file. (iTunes automatically saves this in its folder.) Simply modify the variables at the top of the script and it ought to work. It takes about 10 seconds to handle 7000 or so songs on my 1.4 GHz Pentium M.

This script does not preserve playlists created in MythMusic, but really, the interface is so cumbersome that no one in their right mind would want to create a playlist in MythMusic anyway.

Update: A reader has posted an update to this script here that works with MythTV 0.20. There is also a newer PHP script that performs a similar function.

Posted by Simon at March 22, 2006 02:19 PM
Comments

I have my iTunes folder shared and mounted under /myth/music but I think this should work. I am surprised that the MythMusic interface is so hard to use.

Posted by: chip at November 19, 2006 09:19 AM

Exactly the setup I wanted to lay out in my new appartment. Was just dreading the shifting of files et al.

Thanks a lot.

Myth UI for music sorting is spartan to say the least, otherwise it's a great open source project which deserves our support in a world where companies (even Apple) are making parts of there products not play well together with other technologies.

J.

Posted by: Joe8 at March 15, 2007 09:18 AM

This no longer seems to work with MythTV .20 :(

Posted by: Brad at May 7, 2007 07:15 PM

Responding to my own post here, but someone posted an update to the script that works with MythTV .20 here:
http://www.mickelson.org/2006/11/07/mythmusic-mac-os-x-and-itunes/

I still get errors with it, but it does seem to work. Here is the start of the error log when I run it:
DBD::mysql::db do failed: Unknown column 'playlistid' in 'where clause' at mythtv-itunes_brad_20.pl line 76.
Could not map UnderWorld - Twist (A Hundred Days Off) ID:
... (apparently generates that error for every file)

Posted by: Brad at May 7, 2007 07:43 PM

His update works. There's a bug (see post above). Change line 76 from
$dbh->do("DELETE FROM music_playlists WHERE playlistid > 2");
to
$dbh->do("DELETE FROM music_playlists WHERE playlist_id > 2");

(note underscore)

Mine got two errors..one because it ignored a period in an artists name...still got the vast majority, though.

Posted by: Shad at May 11, 2007 12:16 PM
Post a comment










Please retype the code above.


Remember personal info?