【发布时间】:2017-04-09 20:30:17
【问题描述】:
我正在尝试从我的资料库中获取独特的 iTunes 艺术家和流派的列表。 AppleScript 的某些操作可能会很慢,在这种情况下,我不能在速度上妥协太多。我可以对我的代码做进一步的重构吗?
tell application "iTunes"
-- Get all tracks
set all_tracks to shared tracks
-- Get all artists
set all_artists to {}
repeat with i from 1 to count items in all_tracks
set current_track to item i of all_tracks
set current_artist to genre of current_track
if current_artist is not equal to "" and current_artist is not in all_artists then
set end of all_artists to current_artist
end if
end repeat
log all_artists
end tell
我觉得应该有一种更简单的方法可以从 iTunes 中获取我不知道的艺术家或流派列表...
【问题讨论】:
-
你检查过 DougScripts 吗?那里有大量运行速度极快的脚本。有一个专门针对您想要的,如果您愿意,可以将其导出为 txt 文件。我现在不记得它的名字了,但它让我的 74gb 音乐快速工作。
标签: applescript itunes