Hello everyone,
For a month or so I've been hacking at this code for my friend and I who are
both running Myth systems. It started out as the Perl script you see on a
couple blogs and whatnot that maps your iTunes playlists into MythMusic.
I wasn't happy with a couple of things that the script did, and so I started
changing them here and there, and eventually most of the thing was gutted.
My friend and I seem to like it, and he suggested I put it out there for
others.
Previous scripts have been more general in that they searched the MythMusic
database for similar Artists and Song Name and Album and then they called
that a match. I didn't like this behavior for a couple reasons. I could
never get non-ascii characters in the ID3 tag to map properly. The script
would just give up on those songs. Similarly, I have a few songs where the
Album field is blank, but the Song Name and Artist are the same (different
recordings, live shows, etc) and the previous scripts would simply match all
these to the first finding of the song in the database.
By matching on filename, we actually get the correct matches and the
matching is much faster. Instead of accessing the database once for each
song in your iTunes library, it accesses the database once for the entire
library. We also don't have to worry about the ID3 tag containing
"non-standard" characters, the songs will still map.
A couple of gotchas though. I'm no character encoding genius, in fact I'm
probably a character encoding idiot, but from my little research for this
project I noticed iTunes will store non-ASCII characters just fine as
escaped hex values in the iTunes library XML file. MythMusic, on the other
hand, doesn't seem to store that information, being a Latin1 database. I'm
also a PERL idiot, so I never figured out how to change the data correctly.
Basically, if you have non-standard characters in the actual filename, these
songs will probably not map. Sorry, but if someone knows how to do the
proper conversions in Perl to make iTunes and MythMusic play nice, that
would be a nice feature to add to the script. Also, if you find my
explanations to be bogus, just remember I might not know what I'm talking
about.
Also, while I really don't believe this will ever be a problem, I might as
well disclaim it. I've tested this script on my library (~1700 songs) and
it works great. However, because this loads some of the music_songs
database into a Perl variable before it starts matching, the memory
footprint of this script could be larger than the previous Perl scripts.
I'm interested in how even the largest of music libraries perform with this
script.
Well enough banter, let me know what you think of the script!
Brian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythtv-itunes-filename-match.pl
Type: application/octet-stream
Size: 15056 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20090110/b70a48a6/attachment.obj