itunes from the command line

Hi everyone,

I found online a script someone had written that allows you to control your itunes from the command-line, which is very useful for me as I can ssh to my main computer (which has airtunes via airport express) from my laptop and start and stop certain playlists…

Anyway, I added something to the script to have it return all of my playlists to the command line so I can know which ones that I can switch to…

right now, they are being returned like a normal list would be “depeche mode, new order, xymox” etc… And I was wondering if anyone knows a good way that I can have then returned in a 3 column view spaced out… like:

“depeche mode new order xymox”

I tried doing something with text item delimiters, but it wasn’t working very well with the osascript -e stuff…

Any thoughts?

here is the script:

hi partick,

I’d suggest using awk - something like this:

          "list" ) osascript -e "tell application \"iTunes\" to return name of playlists" | perl -pe 's/, /\n/g' | awk -F'\n' '
          	BEGIN {nl=1}
          	{if (nl == 3)
          		{printf "%-50s\n",substr($1,1,48);
          		nl=1}
          	 else
          		{printf "%-50s",substr($1,1,48);
          		nl++}
          	 next}';
		   
           break ;;

Hope that helps :slight_smile:

D.

thank you so much!