Search the iTunes Music Store for the Current Song
Search the iTunes Music Store using info from the currently playing track.
You can search the iTunes Music Store (iTMS) using the handy link arrows associated with each track in the library. But this AppleScript hack lets you search the iTMS for the currently playing song, even if it’s playing from a stream.
The Code
The script gets tag info from the currently playing track and displays it in a listbox so the user can choose which tags to use as search criteria. The script then affixes the chosen data to a URL, which is sent to iTunes.
-- get info from current track tell application "iTunes" if player state is not stopped then if class of current track is not URL track then tell current track to set {alb, art, nom, com} to ¬ {album, artist, name, composer} else if current stream title is not "" then set {art, nom} to my text_to_list(current stream title, " - ") set {alb, com} to {"", ""} else display dialog "Can't get data from stream." buttons ¬ {"Cancel"} default button 1 with icon 0 giving up after 30 end if end if else display dialog "No track currently playing." buttons {"Cancel"} ¬ default button 1 with icon 0 giving up after 30 end if end tell -- build list to display in choose from list box set theOptions to {"Song:" & tab & nom, "Artist:" & tab & art, ¬ "Album:" & tab & alb, "Composer:" & tab & com} -- display choose from ...
Get iPod and iTunes Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.