【发布时间】:2012-05-13 22:00:15
【问题描述】:
我执行了以下脚本来识别没有插图的 iTunes 歌曲。它基于我在网络中找到的其他脚本。
tell application "iTunes"
repeat with a in every track of playlist "Library"
if not (exists (artwork 1 of a)) then
add (get location of a) to (playlist "noart")
end if
end repeat
end tell
它似乎在工作,它编译得很好,因为我可以在事件日志窗口中这样做:
tell application "iTunes"
count every track of playlist "Library"
--> 10684
exists artwork 1 of item 1 of every track of playlist "Library"
--> true
exists artwork 1 of item 2 of every track of playlist "Library"
--> true
但是在400音轨之后,它开始运行缓慢,并且applescript在1000音轨之后停止响应。
我以为我可能会耗尽我的 mac 内存,但在 Activity Monitor 中,我可以看到 Applescript 正在消耗 100% 的 CPU 和不到 50MB 的内存。我在 macbook pro(i7 和 4GB 内存)上运行 macos 10.7.4。
如您所见,我的 iTunes 库有 10684 首曲目。图书馆不算小,但也不算大。
有人有什么建议吗?还是一个脚本来识别没有艺术作品的曲目?
TIA,
鲍勃
【问题讨论】:
-
信息:当你遍历一个长列表时,不要使用“事件日志窗口”,因为如果“事件日志窗口”中的字符数为太高了。
标签: applescript itunes itunesartwork