中获取Spotify当前正在播放的歌曲

中获取Spotify当前正在播放的歌曲

本文介绍了如何在Python(Windows)中获取Spotify当前正在播放的歌曲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在16x2的LCD上显示Spotify中当前播放的歌曲.我当时想将LCD与Arduino连接,然后制作一个Python脚本,将Spotify当前播放的歌曲发送到Arduino.

I want to show the current playing song in Spotify on a 16x2 LCD.I was thinking of connecting the LCD with my Arduino and then making a Python script that sends the current playing song of Spotify to the Arduino.

要点很明确,我正在寻找一种方法来获取Spotify当前使用Python播放的歌曲.(我使用的是Windows8.)我发现了dbus之类的方法,但是它们要么用于Linux,要么用于Mac.

To get to the point, I'm looking for a way to get Spotify's current playing song in Python. (I'm using Windows 8.) I found some ways like dbus, but they were either for Linux or for Mac.

提前谢谢!(对不起,英语语法不好.)

Thanks in advance! (And sorry for bad English grammar.)

推荐答案

我遇到了相同的问题,因此我编写了一个库来解决此问题.该库可以在github上找到: https://github.com/XanderMJ/spotilib .请记住,这仍在进行中.

I encountered the same issue, so I wrote a library to solve this issue. The library can be found at github: https://github.com/XanderMJ/spotilib. Keep in mind that this is still work in progress.

只需复制文件并将其放置在Python/Lib目录中即可.

Just copy the file and place it in your Python/Lib directory.

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%起作用.

spotilib.artist() returns only the first artist. I started working on an other library spotimeta.py to solve this issue. However, this is not working at 100% yet.

import spotimeta
spotimeta.artists() #returns a list of all the collaborating artists of the track

如果发生错误, spotimeta.artists()将仅返回第一位艺术家(通过 spotilib.artist()找到)

If an error occurs, spotimeta.artists() will return only the first artist (found with spotilib.artist())

希望这会对您有帮助(如果仍然需要)!

Hope this will help you (if still needed)!

这篇关于如何在Python(Windows)中获取Spotify当前正在播放的歌曲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 06:09