iTunes iPod Playlist

Hi

Is there anyway for Applescript to create a playlist in iTunes of all the songs on a manually synched Ipod?

I am hoping this is possible so that I can have a record in iTunes of what songs are on my iPod even when it is not connected.

Thanks

Hi,

this does it, but it is pretty slow.
It grabs the correspondent tracks of iTunes’ main library and puts them into a (new) playlist named as the iPod

tell application "iTunes"
	set iPodSource to 1st source whose kind is iPod
	set iPodplaylist to name of iPodSource
	if (playlist iPodplaylist exists) then
		delete every track of playlist iPodplaylist
	else
		make new playlist with properties {name:iPodplaylist}
	end if
	repeat with i in tracks of library playlist 1 of iPodSource
		set {nm, ti, br} to {name, time, bit rate} of i
		duplicate (get 1st track of library playlist 1 whose name is nm and time is ti and bit rate is br) to playlist iPodplaylist
	end repeat
end tell

Thanks Stefan

I tired running your script and get the error on the first track as follows:

Can’t get <> 1 of <> 1 of application “iTunes” whose name of it = “Night Life” and time of it = “3:49” and bit rate of it = 192.

I have all my songs on the Computer in Apple lossless. The iPod receives them manually converted into AAC. I have about 60% of my iTunes music on my iPod at any one time.
Might this be the problem because the bit rate will be different on the songs between iTunes and iPod, even if they are the “same” song?

Thanks

The script works only, if the same song is on the iPod and in the iTunes library,
because a playlist on the computer can only contain existing tracks.
But you can try to omit the bit rate parameter, may be it’s sufficient to have the same name and time

here is the changed repeat block, I added an extra try block to avoid error messages, if any track is not available


...
repeat with i in tracks of library playlist 1 of iPodSource
   set {nm, ti} to {name, time} of i
   try
      duplicate (get 1st track of library playlist 1 whose name is nm and time is ti) to playlist iPodplaylist
   end try
end repeat
...

Thanks Stefan

I get it now. Have done this with your script which works so far:

tell application "iTunes"
	set iPodSource to 1st source whose kind is iPod
	set iPodplaylist to name of iPodSource
	if (playlist iPodplaylist exists) then
		delete every track of playlist iPodplaylist
	else
		make new playlist with properties {name:iPodplaylist}
	end if
	repeat with i in tracks of library playlist 1 of iPodSource
		set {nm, ti, alb, artst, albartist, cpsr, trck} to {name, time, album, artist, album artist, composer, track number} of i
		duplicate (get 1st track of library playlist 1 whose name is nm and time is ti and album is alb and artist is artst and album artist is albartist and composer is cpsr and track number is trck) to playlist iPodplaylist
		display dialog "Next one?"
	end repeat
end tell

I will play around more with it to set error catching so that I can be sure it has captured everything or, if not, will list what is missing.

Many thanks. Will post back when I am done.