• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AppleScript, Perl and iTunes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript, Perl and iTunes


  • Subject: AppleScript, Perl and iTunes
  • From: david <email@hidden>
  • Date: Tue, 3 Jan 2006 12:59:14 +0100

Sorry for this slightly OT posting.

1,5 year ago it was a posting at Mac OS X Hints <http://www.macosxhints.com/article.php?story=20040514091905395> that described how to automate entering genre data into iTunes based on Allmusic.com's 'tones'. If it worked as described it would be awesome. However, no one but the poster - who doesn't reply on mail sent to the address mentioned in this posting, seem to have got it working.

Anyone here who would be interested in taking a look at this and make it work?

I think quite a few people would be very interested in this.





The complete post:

---------------------

The script below attempts to automatically query the allmusic.com website to find Tones (see robg's note below) associated with an iTunes track. The Tones are then added to the comments field of the track. I've seen people express a desire for such a script, so thought I'd post what I've come up with -- but check the caveats below...

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:

1. 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.
2. 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.
3. The script is a simple screen scraper -- if allmusic.com changes its website it'll break the script.
4. 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.
5. Don't email me if this screws up your music library, (though I can't see how it would) - use at your own risk.
6. 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.
7. 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.

Anyway, here's the script. Like I said, just select a bunch of tracks in iTunes and run the script from the command line. It'll print out what it's doing as it runs.

[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.]
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: Re: Need help with image events droplet to save multiple files as png
  • Next by Date: Re: hdiutil burn
  • Previous by thread: Setting dates in iPhoto...
  • Next by thread: Optical Media Sizes
  • Index(es):
    • Date
    • Thread