我想在16 X2 LCD上显示Spotify中当前播放的歌曲,我想把LCD和我的Arduino连接起来,然后做一个Python脚本,把Spotify当前播放的歌曲发送到Arduino上。
为了达到这个目的,我正在寻找一种方法来获得Spotify当前在Python中播放的歌曲。(我使用的是Windows 8。)我找到了一些类似dbus的方法,但它们要么是用于Linux,要么是用于Mac。
提前谢谢你!(抱歉我的英语语法不好。)
我想在16 X2 LCD上显示Spotify中当前播放的歌曲,我想把LCD和我的Arduino连接起来,然后做一个Python脚本,把Spotify当前播放的歌曲发送到Arduino上。
为了达到这个目的,我正在寻找一种方法来获得Spotify当前在Python中播放的歌曲。(我使用的是Windows 8。)我找到了一些类似dbus的方法,但它们要么是用于Linux,要么是用于Mac。
提前谢谢你!(抱歉我的英语语法不好。)
4条答案
按热度按时间34gzjxbg1#
我遇到了同样的问题,所以我写了一个库来解决这个问题,这个库可以在github上找到:https://github.com/XanderMJ/spotilib。请记住,这仍在进行中。
只需复制文件并将其放在Python/Lib目录中。
artist()只返回第一个艺术家。2我开始使用另一个库 spotimeta.py 来解决这个问题。3然而,这个库还不能100%地工作。
如果出现错误,spotimeta. artist() 将只返回第一个艺术家(在 spotilib.artist() 中找到)
希望这对你有帮助(如果还需要的话)!
jum4pzuy2#
最简单的方法可能是将当前播放的曲目从Spotify客户端scrobble到last.fm帐户,然后使用python从那里获取。
Last.fm 允许你通过user.getRecentTracks的API获取scrobbed音轨,user.getRecentTracks提供
nowplaying="true"
属性,如果一首歌正在播放,它也提供一些其他有用的东西,你可能需要一个外部显示,如专辑封面的链接和last.fm歌曲的www.example.com页面。下面是一个简单的例子,它将用户名和API键作为cmd行参数,并使用requests库获取当前正在为该用户播放的内容。
在一个快速测试中,它似乎确实需要一分钟左右的时间才能意识到在暂停或退出Spotify客户端后曲目不再播放。
7rfyedvj3#
有不止一个pytify吗?这对我来说一直有效,直到今天:https://code.google.com/p/pytify/
Spotify已经更新,现在歌曲不再显示在windows标题中。
他们将把“特色”带回来:https://community.spotify.com/t5/ideas/v2/ideapage/blog-id/ideaexchange/article-id/73238/page/2#comments
hmae6n7t4#
当为True时:print(“欢迎加入项目,“+用户名['显示名'])