【发布时间】:2018-02-18 22:36:47
【问题描述】:
如何从应用程序 (Windows/Mac) 获取音乐播放、倾斜、艺术家等数据。有一个使用 Web API 的选项,但我测试了 Musixmatch 应用程序,即使我处于离线状态,它也能正常工作,因此可以以某种方式连接到应用程序。
【问题讨论】:
标签: spotify spotify-app
如何从应用程序 (Windows/Mac) 获取音乐播放、倾斜、艺术家等数据。有一个使用 Web API 的选项,但我测试了 Musixmatch 应用程序,即使我处于离线状态,它也能正常工作,因此可以以某种方式连接到应用程序。
【问题讨论】:
标签: spotify spotify-app
见PySpotify!看起来它支持任何支持 Python 的操作系统(包括 Windows 和 Mac)。
【讨论】:
您喜欢在哪里以及如何使用这些数据?您可以查看 Windows 中的 %AppData% 文件夹。除此之外,您可以使用 UFT/QTP 或 Sikuli 等自动化工具,您可以使用这些工具从 Spotify 用户界面获取数据。但是 WebAPI 是最好的方法
【讨论】:
例如,如果您使用的是 Apple 系统,您可以使用 AppleScript API:
-- Creates a notification with information about the currently playing track
-- Main flow
set currentlyPlayingTrack to getCurrentlyPlayingTrack()
displayTrackName(currentlyPlayingTrack)
-- Method to get the currently playing track
on getCurrentlyPlayingTrack()
tell application "Spotify"
set currentArtist to artist of current track as string
set currentTrack to name of current track as string
return currentArtist & " - " & currentTrack
end tell
end getCurrentlyPlayingTrack
-- Method to create a notification
on displayTrackName(trackName)
display notification "Currently playing " & trackName
-- A delay is set added make sure the notification is shown long enough before the script ends
delay 1
end displayTrackName
这个例子来自官方文档,你可以找到here。
改用 Windows 我想说目前还没有明确的方法可以做到这一点。曾经有Libspotify SDK 但不再支持。
似乎这个库将被一些新的 Windows/Mac/其他 API 替代,但目前只有手机操作系统的 beta 版本,我真的找不到任何适用于 Windows 的东西。
所以看来你唯一的选择是使用这个库的旧版本并希望它仍然可以正常工作。
【讨论】:
Spotify 通过“c:\users\username\appdata\local\spotify\data”文件夹进行缓存。这里可能有一些东西可以帮助你。
【讨论】: