iTunes Scripts for Public LibrariesHere is a script for iTunes that searches a public
library's online catalog with the selected track. Both a Mac version and a
Windows version are available. The actual scripts can be downloaded from the
link at the end of this article.
I've been using AppleScript with iTunes for a few
years now in our library. We have a Dual 1.25GHz PowerMac G4 that we use as an
MP3 server that holds about half of our collection of CD's (over 2000 albums out
of 4000 or so), and I've set up two 500MHz G3 iMacs to run as music kiosks for
our patrons. Patrons can tap into the server, listen to our collection on
headphones, then if they want to obtain a CD, they can either use the pulldown
script menu, or hit an F key to run the MusicSearch script.
The script was originally a modification of a script available for download from Apple's AppleScript site: http://www.apple.com/applescript/itunes/index.html I think it was either the CDNow script or the eMusic one that I started with. Apple also refers the reader to Doug's AppleScripts for iTunes , which is a super site for iTunes scripting. Once Apple released iTunes for Windows, they released the iTunes COM for Windows SDK for it. Here's the blurb straight off their developer website: "This SDK provides header files, documentation, and sample JScript files demonstrating how to use the iTunes for Windows COM interface. COM is the Microsoft technology, similar to AppleScript on Mac OS, that allows programmatic control of iTunes from languages like JScript, Visual Basic, C#, and C++. This SDK requires iTunes for Windows version 4.7 or later. [Nov 8, 2004]" With the SDK available, I thought I would try writing a similar script for Windows. It took me a while, and it made me appreciate AppleScript even more. Having said that, the Windows version and the AppleScript version together should help other Windows scripters figure out how to translate other existing AppleScripts for iTunes into Windows scripts. The AppleScript opens up Safari or Internet Explorer, plugs the song name, artist, and album into a keyword search and displays the results. From there, if the record says "on shelf" the patron can walk over to the collection and get it, or if it says "checked out", the patron can place a hold on the item and be notified via phone or e-mail when it comes in. The Windows version does the same using IE. I used Keyboard Maestro to do the F key shortcuts on Mac, and Keyboard Manager Deluxe for the Windows shortcuts. How to modify the MusicSearch scripts 1. Download the script you want to your desktop. Open the script in Script Editor on Mac, or notepad in Windows, by right-clicking on the icon and choosing "Open with...". 2. The heart of the script is the set search_url to stuff. The best way to become familiar with what it does is to run the script, while paying attention to how this part of the script gets translated into a URL in the browser. In the Mac version, I have a nested conditional clause to make the search_url, to handle those cases when the genre is classical or when the artist field just has "Various Artists". Tweak at your leisure. 3. Once you get the gist of it, go to your library's catalog, and run a keyword search on a popular song title, its artist, and its album. I've been using Cocaine, Eric Clapton, and Slowhand for my test keywords, since most library systems own that. Whatever it is, make sure your library owns it. One thing this script does well is locate cataloging errors. At times I need to modify the info coming from CDDB to match the MARC records coming from OCLC. At other times I need to modify the MARC records. When you have a successful hit, copy down the URL from the location window, and parse it accordingly. Different systems use different methods to concatenate the search string. You can see this in commented out portions of the AppleScript that my own catalog's method has changed. Usually there is a separate server address for the catalog, a keyword search command along with the keywords somehow concatenated, and some term or code restricting the search to your particular library or agency. The order of these segments depends on the catalog. Comment out my set search_url to assignment in the script, and replace it with your own. Sometimes the library catalog methods are obscure. Innovative Interfaces online catalogs have codes at the end of the URL that are a mystery to me, but you need them if your library uses that system. Files for Downloading Posted: Fri - March 18, 2005 at 10:10 AM |
Quick Links
Calendar
Categories
Archives
XML/RSS Feed
Contact Me
E-mail: ckupec@mac.com
Extreme Tracking Web Counter
Statistics
Total entries in this blog:
Total entries in this category: Published On: Mar 19, 2008 08:30 AM |
||||||||||||||