Export an iTunes playlist in play order using Automator

Apr 28, '08 07:30:02AM

Contributed by: digidan

Sometimes you want to do something like create a MP3 CD, but you need to do so with several iTunes playlists, in a particular play order. However, iTunes' MP3 CD burning support is rather limited. For example, it can burn a playlist in order -- but only one big playlist. On the other hand, it can burn a CD with the MP3s sorted into artist or album folders. It can't create multiple-directory CDs for CD players that support it, limiting it to one big list. You can burn an MP3 disc (with multiple folders/playlists) from the Finder or Toast, but they will both burn the files in alphabetical order. If you are trying to burn a CD with several directories of several playlists, in a certain play order, these limitations are very frustrating.

The normal solution to this problem is to rename each file from each playlist in the finder -- such as adding a number before the track name -- so that songs are displayed in the correct order for burning. This is very slow to do manually. So, I created an Automator workflow to do the work. Make sure that before running this workflow, you select all the songs you want to be exported.

While the Rename Finder Items action is pretty well known, I had no idea that it would work with iTunes like it does to keep the order straight. Interesting!

The setup (note that these steps are listed based on having View » Arrange Actions By set to Application):

  1. Automator » Ask for Confirmation (This may be Leopard only.). This asks if the user wishes to continue, since it may take a while to run.
  2. iTunes » Get Selected iTunes Items. This will select all songs that you've selected in iTunes, such as the songs in a playlist.
  3. Finder » Copy Finder Items. This will copy the song files to the Finder. Select a default folder, such as the Desktop. Check the "Show This Action When the Workflow Runs" box under Options to allow you to choose a folder to export a particular playlist into.
  4. Finder » Rename Finder Items (Make Finder Item Names Sequential). You should say Make Sequential in the top drop-down, and then select Add number to existing item name. Select Place number before name, Start numbers at 1, separated by dash (or underscore, etc), and make all numbers X digits long. X should be 1 to 3, depending on how many songs you have -- three digits will allow you to export more than 100 songs.
  5. Save your workflow to the scripts folder, or as an application to add to your Dock.
When run, the workflow will first copy the files to the selected Finder folder, then rename them. You can then burn the folder -- and any other folders of exported playlists -- to a disc, using the Finder or Toast. Problem solved!

I also want to point that the workflow will only run on the OS that it is created with -- Tiger or Leopard. It seems that the way the Automator Actions work varies between Tiger and Leopard, so if you have two or more Macs with Tiger and Leopard, you need to recreate the workflow using Automator on the OS you want it to run on. The name of the actions, and the options that you should select are the same in both OS. Go figure.

Comments (1)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080424194133862