May 18, '04 08:55:00AM • Contributed by: alexg@ebi.ac.uk
The script is written in Perl and requires WWW::Mechanize and Mac::AppleScript::Glue to be installed. The script goes through all the currently selected iTunes tracks (tracks highlighted in blue). For each track, it first queries allmusic.com to find the artist. If there are Tones associated with the artist, it remembers these. It then tries to find the album. If it finds the album, then it uses the Tones associated with the album, rather than those associated with the artist. All tracks in a given album will have the same Tones. The Tones are applied to the comment field of the track by adding them onto whatever comments are already present.
Read the rest of the hint for some caveats and the script...
Caveats:
- If the tags in your tracks do not exactly match those in allmusic.com, the script will not find anything. There is some facility on the website for fuzzy matching, but this is not implemented in the script in any way.
- Usually when you search allmusic.com by artist, you get back a list of artists that sound like the thing you searched for (the fuzzy matching I mentioned above). The script will simply search the top artist in this list. In 99% of cases I've found this is correct, but with some common names ('Air' for instance), you may get the wrong Tones.
- The script is a simple screen scraper -- if allmusic.com changes its website it'll break the script.
- allmusic.com will presumably not be happy about people downloading their data. They make money by people using their website and viewing ads. I couldn't find any notices forbidding automated downloads, but I didn't look that hard :). If allmusic ask you to stop using the script, please respect that.
- Don't email me if this screws up your music library, (though I can't see how it would) - use at your own risk.
- I've run through quite a few of my tracks and it seems to work reasonably. Don't expect it to find everything in allmusic.com perfectly, though (particularly things with weird names), and don't expect allmusic.com to have Tones for every one of your albums.
- It'll give a bunch of warnings as it runs:
v-string in use/require non-portable at /Library/Perl/Mac/AppleScript/Glue.pm line 234.
at the start is due to a change in the way Perl deals with version numbers. It'll also say:Unknown input type 'textfield' at /Library/Perl/WWW/Mechanize.pm line 1335 a lot.
Neither are fatal (or even harmful) and can be ignored or patched (just add textfield to the appropriate part of WWW::Mechanize). This is left as an exercise for the reader.
[robg adds: Tones are like genres on steroids. For instance, the Tones for Paul Simon's Graceland are 'Whimsical, Summery, Exuberant, Organic, Cheerful, Laid-Back/Mellow, Happy, Poignant, Rousing, Playful, Fun, Reflective.' Having Tones attached to your songs will allow you to create some very targeted playlists. I've also mirrored the script on the macosxhints' server, in case the original goes away at some point. I have not tried this yet, but intend to once I have some time to update my Perl installation.]
