This script works okay for me and most of my customers, but for a few customers it times out with error -1712; I've no idea why. I've tried increasing timeout, but it makes no difference.
The file /tmp/itunes_model.txt
doesn't get created so it doesn't seem to be doing anything.
How can I debug/fix this?
with timeout of 1200 seconds
tell application "iTunes"
if (count of every file track of library playlist 1) is equal to 0 then
set thePath to (POSIX file "/tmp/itunes_model.txt")
set fileref to open for access (thePath) with write permission
set eof fileref to 0
close access fileref
return
end if
tell every file track of library playlist 1
script performancekludge
property tracknames : its name
property locs : its location
property persistids : its persistent ID
end script
end tell
end tell
set thePath to (POSIX file "/tmp/itunes_model.txt")
set fileref to open for access (thePath) with write permission
set eof fileref to 0
tell performancekludge
repeat with i from 1 to length of its tracknames
try
set nextline to item i of its tracknames ¬
& "::" & POSIX path of item i of its locs ¬
& "::" & item i of its persistids
write nextline & linefeed as «class utf8» to fileref
end try
end repeat
end tell
close access fileref
end timeout
Added a try-catch around the error as requested and reran; the first time it was run it actually worked which is interesting, but the second time it failed again gleaning no more useful information.