在Applescript中,从Spotify检索播放列表信息,并启用/禁用洗牌

在Applescript中,从Spotify检索播放列表信息,并启用/禁用洗牌,applescript,spotify,Applescript,Spotify,我知道AppleScript中有很多用于Spotify的命令,比如简单的playpause命令,但是我如何从Spotify中提取播放列表的信息,并将其粘贴到选择列表中呢?我希望它能够从您收听的任何地方获取所有歌曲,并将它们粘贴到选择列表中,这样您就可以选择您想要收听的歌曲。这可能吗?我可以做类似的事情吗 另外,您将如何启用/禁用洗牌 另外,有没有办法通过AppleScript搜索Spotify 我不确定这些是否可行,谷歌目前也没有这方面的任何信息。有人知道怎么做吗?Spotify AppleSc

我知道AppleScript中有很多用于Spotify的命令,比如简单的
playpause
命令,但是我如何从Spotify中提取播放列表的信息,并将其粘贴到
选择列表中呢?我希望它能够从您收听的任何地方获取所有歌曲,并将它们粘贴到
选择列表中
,这样您就可以选择您想要收听的歌曲。这可能吗?我可以做类似的事情吗

另外,您将如何启用/禁用洗牌

另外,有没有办法通过AppleScript搜索Spotify


我不确定这些是否可行,谷歌目前也没有这方面的任何信息。有人知道怎么做吗?

Spotify AppleScript实现没有特定的命令来获取播放列表信息——它只公开“当前曲目”以获取当前播放曲目的信息,而公开“下一曲目”以播放下一曲目。您可以绕过此限制构建包含当前播放列表中所有曲目的AppleScript数组

set trackNameList to {}
set trackIDList to {}

tell application "Spotify"
    activate

    set shuffling to false
    set repeating to true
    set sound volume to 0

    if player state is not playing then
        playpause
    end if

    set trackID to spotify url of current track
    repeat while trackIDList does not contain trackID
        set end of trackIDList to trackID
        set end of trackNameList to name of current track
        next track
        delay 1 -- otherwise Spotify misbehaves
        set trackID to spotify url of current track
    end repeat

end tell

tell me to activate
set chosenNames to choose from list trackNameList without multiple selections allowed
set chosenName to (item 1 of chosenNames) as string

repeat with i from 1 to count of trackNameList
    set itsName to (item i of trackNameList) as string
    if itsName is chosenName then
        exit repeat
    end if
end repeat

set trackID to (item i of trackIDList) as string

tell application "Spotify"
    activate
    set sound volume to 100
    play track trackID
end tell

在Spotify中搜索没有AppleScript支持。

您可以了解如何使用他们的api。。。我发现这显示了如何搜索spotify。您可以随时了解如何使用applescript打开浏览器,并通过使用javascript更新空白窗口将其发送到“自定义”页面……但此时您几乎无法使用applescript。