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)
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
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}.
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