我想在 16x2 LCD 上显示 Spotify 中当前正在播放的歌曲。 我正在考虑将 LCD 与我的 Arduino 连接起来,然后制作一个 Python 脚本,将 Spotify 当前正在播放的歌曲发送到 Arduino。
言归正传,我正在寻找一种在 Python 中获取 Spotify 当前播放歌曲的方法。 (我使用的是 Windows 8。)我找到了一些方法,例如 dbus,但它们要么适用于 Linux,要么适用于 Mac。
提前致谢! (抱歉英语语法不好。)
请您参考如下方法:
我遇到了同样的问题,所以我写了一个库来解决这个问题。该库可以在 github 上找到:https://github.com/XanderMJ/spotilib .请记住,这仍在进行中。
只需复制文件并将其放在您的 Python/Lib 目录中。
import spotilib
spotilib.artist() #returns the artist of the current playing song
spotilib.song() #returns the song title of the current playing song
spotilib.artist() 仅返回第一位艺术家。我开始研究另一个库 spotimeta.py 来解决这个问题。但是,这还不是 100% 有效。
import spotimeta
spotimeta.artists() #returns a list of all the collaborating artists of the track
如果发生错误,spotimeta.artists() 将仅返回第一位艺术家(使用 spotilib.artist() 找到)
希望这对您有所帮助(如果仍然需要)!