標準のiTunesのAppleScriptを使用する代わりに、このAppleScriptをiTunes Library frameworkを使用するように変換できますか?新しいiTunesライブラリフレームワークを使用するためのiTunesのAppleScriptの変換
私の現在のスクリプトがユーザーのiTunesライブラリを読み込み、TrackName、TrackLocationとPersistentIdからなるファイルを作成し、それが確実に動作しますが、遅くなることができ、ユーザは大iTunesライブラリを持っている
tell application "iTunes"
with timeout of 2400 seconds
if (count of every file track of library playlist 1) is equal to 0 then
set thePath to (POSIX file "/tmp/songkong_itunes_model.new")
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 timeout
end tell
set thePath to (POSIX file "/tmp/songkong_itunes_model.new")
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
異なる大きなはこれです新しいフレームワークではiTunesが実際に動作する必要はなく、かなり高速になるはずです。しかし、Sparse命令はObjectiveCについてしか解説していません。私はAppleScriptでバージョンを書く方法が明確ではありません(またはJavaではさらに良い)
私はそれを実行すると面倒ですが、ファイルを作成すると空ですが、古いスクリプトは大丈夫です。 –
スクリプトエディタとスクリプトデバッガでスクリプトを正常に実行しました。唯一の違いは、テキストファイルをデスクトップに保存したことです。 – vadian
私は、このAPIを使用するためにコード署名する必要があるアプリケーションについて何かを読んで、それはちょうどスクリプトエディタで実行されている問題である可能性があります。 (これが呼び出される主なJavaアプリケーションはコード署名されていますが) –