Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Listen to multiple samples from the iTunes Music Store Apps
I thought it'd be great to shop for new music on the iTunes Music Store (iTMS) while working. If I hear a song I like, I can switch over to iTunes and add the song to my cart. But, to my surprise the iTMS greys out the repeat/shuffle icons, effectively limiting you to playing only one sample at a time.

I found that by using the OS's idle handler, one can effectivley tell iTunes to "play the next track" from a list -- as long as it's before the currently-playing sample has finished. The script itself is stupid easy, but there is a catch to making it work, so keep your eyes peeled.

First, open Applications: AppleScript: Script Editor, and paste the following into it:
on idle
  tell application "iTunes"
    next track
  end tell
  return 29
end idle
I'm not a programmer, so feel free to correct my assertion here: Using the idle handler in this manner allows the AppleScript to release hold of its CPU cycles until the command is explicitly called (every 29 seconds in this case, so as not to let the sample reach its end). So, it's not like having this script running constantly adversely affects system performance.

Here's the catch to make this work: The script must be saved as a 'Stay Open' application. When saving the script, choose Application as the file format, and make sure the Stay Open box is checked.

With the script in place, here's the drill:
  1. Perform a search in the iTMS that returns a list of music you'd like to listen to. For example, I searched 'Rolling Stones,' and had 75 songs returned.
  2. Start playing the first track
  3. Before that track finishes its 30 second sample, launch the script.
That's it. The script will immediately switch to the next track. But, from there on, you'll get the next track every 29 seconds. I'm sure it's trivial to add a search query into the AppleScript itself, so there's not so much legwork to this hint. But that's a project for someone else with more skills than I.
    •    
  • Currently 3.00 / 5
  You rated: 2 / 5 (4 votes cast)
 
[18,061 views]  

Listen to multiple samples from the iTunes Music Store | 9 comments | Create New Account
Click here to return to the 'Listen to multiple samples from the iTunes Music Store' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Listen to multiple samples from the iTunes Music Store
Authored by: mark hunte on Feb 23, '05 09:34:00AM

God I can not believe I did not think of that :) nice one. You are my hero.
I have always wanted ti be able to do this.

I change it a bit so you just have to select your first track ( not play ) and then run the script. Which will play selection and go on to next at 29 seconds.
I have noticed though that sometimes the first time you connect to iTMS there is a 1 second delay so you only get 28 seconds. (trying to fix)

---
mh



[ Reply to This | # ]
Listen to multiple samples from the iTunes Music Store
Authored by: mark hunte on Feb 23, '05 09:35:06AM
God I can not believe I did not think of that :) nice one. You are my hero. I have always wanted ti be able to do this. I change it a bit so you just have to select your first track ( not play ) and then run the script. Which will play selection and go on to next at 29 seconds. I have noticed though that sometimes the first time you connect to iTMS there is a 1 second delay so you only get 28 seconds. (trying to fix)
 on idle
	tell application "iTunes"
		if (the player state is not playing) then
			play
		else
			my P_next()
		end if
		
	end tell
end idle
on P_next()
	tell application "iTunes"
		next track
	end tell
end P_next
return 29.9

---
mh

[ Reply to This | # ]

Listen to multiple samples from the iTunes Music Store
Authored by: dan55304 on Feb 23, '05 09:58:45AM

I've used iTunesMSP for years to do the same thing.

http://www.macupdate.com/info.php/id/11955



[ Reply to This | # ]
Doug Adams's site
Authored by: tocoolcjs on Feb 23, '05 04:09:32PM

Sorry if I'm a bit mean but...

Have you ever heard of the awsome site Doug Adams hosts with about a gagillion iTunes AppleScripts?

They've had that script since 2003! http://www.malcolmadams.com/itunes/scripts/ss.php?sp=itunesmsp

(same as above but better script source)



[ Reply to This | # ]
Doug Adams's site
Authored by: cudaboy_71 on Feb 24, '05 01:32:18PM

ya...i found that 1 day after i submitted the hint to macosxhints. maybe i just *LIKE* reinventing the wheel ;)

in my defense, the script there is saved as 'run only'. so, at least now you can see what the code is and improve upon it if you like.

---
if it aint broke, break it!



[ Reply to This | # ]
Doug Adams's site
Authored by: foo4thought on Feb 24, '05 02:13:23PM

The only mean aspect of your post is the reference to "better script source."

Especially after your link leads to no script source code at all - it's compiled as a run-only application.

i.e., I can't compare the two scripts, but the posted source code looks more than adequate for the task; is it missing something?



[ Reply to This | # ]
Doug Adams's site
Authored by: tocoolcjs on Feb 24, '05 02:45:25PM
The script here is not as functional. Also, Doug's site is a source for scripts (run only is still a script). And most scripts there are open.

[ Reply to This | # ]
Listen to multiple samples from the iTunes Music Store
Authored by: the_13th_saint on Feb 24, '05 05:01:20AM

I seem to remember a long time ago I adding a bunch of songs I wanted to buy to a playlist (wishlist) I made and then adding that playlist to my ipod sync list and playing them o_O I'm not at my computer that has my itunes library to try this with but I'll check on it again this weekend.



[ Reply to This | # ]
Tooting my own ITMS horn
Authored by: joemaller on Mar 03, '05 03:11:49PM
I might have been the first to do this shortly after the ITMS debuted at the end of April 2003, predating by nearly a month Philipp Ringli's ITMS players (the MacUpdate and Doug's AppleScripts players are both his).

My script was ridiculously simple (and unlocked):
on idle
    tell application "iTunes" to play (next track)
    return 30
end idle

It's a neat little trick. Back in 2003 I was surprised no one had done it before me.

Fiddling with random word searches can get lists longer than one album. ITMS searches seem to limit results to 75 songs, so the best you can do is 37.5 minutes of uninterrupted samples, but if you don't mind listening to 30 seconds samples that probably won't bug you too much. Some interesting results are searches for colors (red, blue, green, etc), common words (love, war, brother, sister, etc). It would be fun to add something to the script to rebuild a random ITMS search list every so often. Free short-attention span radio.

Thank you cudaboy. It's good to see people are still making and sharing stuff like this.



[ Reply to This | # ]