2016-05-31 76 views
0

我创建了一个Applescript,只需点击一下,将我硬盘上特定文件夹的内容添加到iTunes(我真的想避免使用iTunes组织系统)。使用Applescript将特定文件夹的内容导入到iTunes

它看起来像这样:

告诉应用程序 “iTunes” 的设置theFolder来( “Macintosh硬盘:温度要 点击:温度在iPod”)设置with_subfolders为true --list 子否(递归)设置parent_folder到theFolder最终告诉

告诉应用程序“系统事件”设置item_list到parent_folder结束 告诉

告诉应用程序“iTunes”的parent_folder的用户添加内容 播放列表“iPod上的温度”结尾告诉

但是,它只进口到iTunes从顶层/父文件夹中的文件。有没有一种方法可以让它递归 - 我想包含来自父文件夹中文件夹的文件。

感谢

塔迪

回答

2

你并不需要从文件夹中获得的所有文件,因为iTunes从文件夹自动和递归地做到这一点。

只需添加文件夹,如:

set parent_folder to "Macintosh HD:Temp to be Listened to:Temp on iPod:" as alias 
tell application "iTunes" 
    add parent_folder to user playlist "Temp on iPod" 
end tell 
1

解决方案1:使用Finder的entire contents - 不是很快

set theFolder to "Macintosh HD:Temp to be Listened to:Temp on iPod:" 
tell application "Finder" to set filesToAdd to files of entire contents of folder theFolder as alias list 
tell application "iTunes" to add filesToAdd to user playlist "Temp on iPod" 

解决方案2:使用Spotlight - 速度非常快,但成交量必须建立索引。

set theFolder to "/Temp to be Listened to/Temp on iPod" 
set fileList to paragraphs of (do shell script "mdfind -onlyin " & quoted form of theFolder & space & quoted form of "kMDItemContentTypeTree == '*public.audio*'") 
set filesToAdd to {} 
repeat with aFile in fileList 
    set end of filesToAdd to POSIX file aFile as alias 
end repeat 
tell application "iTunes" to add filesToAdd to user playlist "Temp on iPod" 
相关问题