Categories: Misc / DotNet / Java / Coder / Linux / PHP Ask - La ask - La Answer

Duplicate tracks to Ipod shuffle

Hi,
I have been trying to automate completely the updating and autofilling of my ipod Shuffle 2G. I have most pieces working, but I can't get Applescript to do the autofill part. I have a smart playlist which contains the updated podcasts. My script (based on scripts from Doug's iTunes site) reads my main library of the Shuffle and then steps through my smart playlist and compares the database id of the i-th track with the list of the ipod shuffle and if it is not in the list I try to duplicate it to the ipod. Here is some code I tried and which resulted in a permission error.
tell application "iTunes"
set oldfi to fixed indexing
set fixed indexing to true
set Podlist to the playlist "Shuffle"
set Ipodname to some source whose kind is iPod
set Ipodplaylist to library playlist 1 of Ipodname
set Ipodname2 to the name of Ipodname as text
try
set currentIDs to {}
if exists (track 1 of Ipodplaylist) then
copy (get database ID of every track of Ipodplaylist) to currentIDs -- list
end if
on error errText number errnum
end try
set track_count to the number of tracks of Podlist
repeat with j from 1 to track_count
set dbid to the database ID of track j of Podlist
if currentIDs does not contain dbid then duplicate track j to library playlist 1 of source Ipodname2
end repeat
set fixed indexing to oldfi
end tell

I have tried all kind of variations, e.g., not introducing the Ipodname as string and referring directly to Ipodname, but I either get a permission error or a type mismatch on the duplicate track j line. Anybody who can help me here?
Thanks.
[1706 byte] By [ars] at [2007-11-11 17:00:25]
# 1 Re: Duplicate tracks to Ipod shuffle
Why not just auto-sync the shuffle to a Smart Playlist?
What are you filling it with?
Essin at 2007-11-15 17:23:33 >
# 2 Re: Duplicate tracks to Ipod shuffle
Hi
The Shuffle 2G does not automatically sync in the sense of filling automatically from a smart play list. I have it automatically update so that the old podcasts get removed if a new episode is available, but I still have to click autofill (after changing the shuffable to true of each podcast) to load my ipod 2G with the new podcasts. What I really want to is put my Shuffle on its dock attached to my laptop. Walk away and come back after some time with my iPod completely ready to go without any human interaction. I got most of it working except for the thing at the end. I still have to click autofill and then wait until it is done (which can take sometimes a few minutes).
ARS
ars at 2007-11-15 17:24:34 >
[an error occurred while processing this directive]
[an error occurred while processing this directive]