填补itunes的空白

时间:2015-01-13 21:53:16

标签: applescript itunes-app

我是appplescript和编程的新手。有人会非常友好地查看我的代码。我知道它还没有正确的AppleScript语法,因为我努力寻找这些信息。

tell application iTunes
for each track in library playlist{ #all listed tracks, regardless of what files i have.  may include dead links
set tr to track name
if file location is missing then search for it at external/Music/iTunes else messagebox(tr no file)
if search has result cut and paste to Music/itunes
check if file now exists else messagebox(tr error)
} end tell

1 个答案:

答案 0 :(得分:0)

我会帮你的。以下是如何找到计算机上找不到的所有曲目的歌曲名称和艺术家。你必须在此基础上做其余的事情。

set missingTracks to {}
tell application "iTunes"
    set alltracks to tracks of library playlist 1
    repeat with aTrack in alltracks
        set theLocation to location of aTrack
        set doesExist to my fileExists(theLocation)

        if not doesExist then
            set thisInfo to {songName:name of aTrack, songArtist:artist of aTrack}
            set end of missingTracks to thisInfo
        end if
    end repeat
end tell
return missingTracks


on fileExists(theLocation)
    tell application "Finder"
        if exists theLocation then
            return true
        else
            return false
        end if
    end tell
end fileExists