【发布时间】:2018-10-02 03:58:42
【问题描述】:
谁能提供一种方法来用来自 csv 文件/文本文件的歌曲填充我的播放列表,格式如下: 歌名,歌手? 我可以单独为标题做,但不能指定它必须有某个艺术家。
编辑:这是我如何按标题获取它们的示例:
set TheFile to read file "Macintosh HD:Applications:Automator stuff:01b iTunes Scripts:SongList.txt"
tell application "iTunes"
set thePlaylist to playlist "SongList"
try
delete every track of thePlaylist
end try
set MySongs to paragraphs of (TheFile) -- read artist names (separated by newlines) from the file
repeat with AnItem in MySongs -- get all tracks from each artist
set AnItem to (contents of AnItem)
if AnItem is not "" then try -- don't bother with empty names
set MyTracks to (location of file tracks of playlist "Music" whose name is AnItem)
--can also modify the above from "is" to "contains" or "_begins with_"
add MyTracks to thePlaylist
on error errmess -- oopsie (not found, etc)
log errmess -- just log it
end try
end repeat
end tell
【问题讨论】:
-
向我们展示你是如何为标题做的。
标签: applescript itunes