mirror of
https://github.com/c0de-archive/spotipy-experiments.git
synced 2024-12-22 09:42:39 +00:00
client.currently_playing() works now that I'm no longer on an outdated version from pip
This commit is contained in:
parent
dfadb26285
commit
6801160694
@ -25,12 +25,9 @@ else:
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def get_now_playing(sp):
|
def get_now_playing(sp):
|
||||||
# This should be sp.currently_playing(), but somehow does not work...
|
|
||||||
# So I used its return: https://github.com/plamere/spotipy/blob/master/spotipy/client.py#L899
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the currently playing track and artist
|
# Get the currently playing track and artist
|
||||||
np = sp._get("me/player/currently-playing", market=None)
|
np = sp.currently_playing()
|
||||||
# Take a look at the other goodies that gets returned here for future stuff
|
# Take a look at the other goodies that gets returned here for future stuff
|
||||||
return "%s by: %s" % (np['item']['name'], np['item']['artists'][0]['name'])
|
return "%s by: %s" % (np['item']['name'], np['item']['artists'][0]['name'])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user