iTunes manually syncing to iPod

I have a Motorola SLVR and like to listen to Podcasts. So I have a “smart playlist” defined that contains all my “unplayed” podcasts I subscribe to and I told iTunes to synchronize my SLVR with that playlist. Unfortunately that does not work (must be a limitation of the Motorola phone, because the exact same thing works with an iPod).

To the rescue comes AppleScript, I thought.

To my dismay I can’t seem to make it work (and I event bought the AppleScript book).

I am running Mac OS X 10.4.8 with iTunes 7.0.2

First of, the following code yields two different playlists, even though I have selected the very same playlist I specify by name.


tell app "iTunes"
set myPlayList to playlist "unplayed Podcasts"
set mySelected to view of front window
end tell

subsequently, all actions I perform on file tracks in myPlayList yield “can’t perform on track”


tell app "iTunes"
	set unplayedSource to a reference to playlist "unplayed"
	set unplayedDest to a reference to playlist "unplayed Podcasts"
	-- the following works sometimes, haven't figured out when yet
	repeat with aTrack in (every track of unplayedDest whose played count > 0)
		delete aTrack
	end repeat
	
	repeat with aTrack in (every track of unplayedSource)
		duplicate aTrack to unplayedDest
	end repeat
end tell

iTunes got an error: Can’t set playlist “unplayed Podcasts” to item 1 of every track of playlist “unplayed”.

All I want is to sync Podcasts I have not listened to onto the SLVR, and delete all podcasts I have listened to from the SLVR.

Why is this so hard? Or is it me?

Model: Mac Pro
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi,

I don’t know if it’s generally possible what you want (I have no idea about this cell phone)
but your second snippet should work this way:

tell application "iTunes"
	set unplayedSource to playlist "unplayed" -- "a reference to" not needed
	set unplayedDest to playlist "unplayed Podcast"
	-- the following works sometimes, haven't figured out when yet
	repeat with aTrack in (get every track of unplayedDest whose played count > 0) -- get added
		delete aTrack
	end repeat
	
	repeat with aTrack in (get every track of unplayedSource) -- get added
		duplicate aTrack to unplayedDest
	end repeat
end tell

Thanks for the response, Stefan

but the snippet produces the following error in the duplicate line:

iTunes got an error: Can’t set user playlist id 15012 of source id 36 to item 1 of {file track id 7187 of user playlist id 7184 of source id 36, file track id 11222 of user playlist id 7184 of source id 36, file track id 12590 of user playlist id 7184 of source id 36, file track id 12597 of user playlist id 7184 of source id 36}.

I guess, the problem is, that you can’t copy tracks manually into a smart playlist

but thats not what I am trying to do. unplayedDest is not a smart playlist. I is just a regular playlist on the SLVR.

Even if I try to copy into library playlist 1 of the SLVR it fails with

iTunes got an error: File permission error.

Somehow the whole “duplicate” syntax is a mystery.

probably it’s not possible at all to write into playlists on a external device,
(I haven’t never tested this with an iPod), so what’s about to set the playlist in iTunes and
sync the phone with the update command

I tried that, but it doesn’t yield anything.


tell application "iTunes"
	set r to duplicate track 1 of library playlist 1 to playlist "unplayed Podcasts"
end tell

and whatever track 1 of my library is will show up with a dot in the playlist on my SLVR iPod, but the actual file is not copied.

I mean, don’t duplicate files into a playlist of source “SVLR” but in a playlist of source “Library” of iTunes
Then sync the phone with iTunes