<div class="gmail_quote">On Sat, Jan 10, 2009 at 11:54 AM, Brian Phillips <span dir="ltr"><<a href="mailto:brian.phillips@gmx.net">brian.phillips@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello everyone,<br>
<br>
For a month or so I've been hacking at this code for my friend and I who are<br>
both running Myth systems. It started out as the Perl script you see on a<br>
couple blogs and whatnot that maps your iTunes playlists into MythMusic.<br>
<br>
I wasn't happy with a couple of things that the script did, and so I started<br>
changing them here and there, and eventually most of the thing was gutted.<br>
My friend and I seem to like it, and he suggested I put it out there for<br>
others.<br>
<br>
Previous scripts have been more general in that they searched the MythMusic<br>
database for similar Artists and Song Name and Album and then they called<br>
that a match. I didn't like this behavior for a couple reasons. I could<br>
never get non-ascii characters in the ID3 tag to map properly. The script<br>
would just give up on those songs. Similarly, I have a few songs where the<br>
Album field is blank, but the Song Name and Artist are the same (different<br>
recordings, live shows, etc) and the previous scripts would simply match all<br>
these to the first finding of the song in the database.<br>
<br>
By matching on filename, we actually get the correct matches and the<br>
matching is much faster. Instead of accessing the database once for each<br>
song in your iTunes library, it accesses the database once for the entire<br>
library. We also don't have to worry about the ID3 tag containing<br>
"non-standard" characters, the songs will still map.<br>
<br>
A couple of gotchas though. I'm no character encoding genius, in fact I'm<br>
probably a character encoding idiot, but from my little research for this<br>
project I noticed iTunes will store non-ASCII characters just fine as<br>
escaped hex values in the iTunes library XML file. MythMusic, on the other<br>
hand, doesn't seem to store that information, being a Latin1 database. I'm<br>
also a PERL idiot, so I never figured out how to change the data correctly.<br>
Basically, if you have non-standard characters in the actual filename, these<br>
songs will probably not map. Sorry, but if someone knows how to do the<br>
proper conversions in Perl to make iTunes and MythMusic play nice, that<br>
would be a nice feature to add to the script. Also, if you find my<br>
explanations to be bogus, just remember I might not know what I'm talking<br>
about.<br>
<br>
Also, while I really don't believe this will ever be a problem, I might as<br>
well disclaim it. I've tested this script on my library (~1700 songs) and<br>
it works great. However, because this loads some of the music_songs<br>
database into a Perl variable before it starts matching, the memory<br>
footprint of this script could be larger than the previous Perl scripts.<br>
I'm interested in how even the largest of music libraries perform with this<br>
script.<br>
<br>
Well enough banter, let me know what you think of the script!<br>
<font color="#888888"><br>
Brian<br></font></blockquote><div><br></div><div>I haven't tried it yet but I think this could be pretty useful. I have to rework my iTunes stuff a little but hopefully I can try it. I'll let you know if I find anything.</div>
<div><br></div><div>On a related note may I recommend that you post this on the wiki under the how to section.</div><div><br></div><div>Thanks for the script. </div><div>steve <br></div></div>