Skip to content

Commit

Permalink
api new
Browse files Browse the repository at this point in the history
  • Loading branch information
noeminellen committed Oct 23, 2022
1 parent 16d5f44 commit 217b715
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions backend/src/spotify_api/api_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ def get_metadata_current(self):
artist_name = self.sp.currently_playing()['item']['album']['artists'][0]['name']
album_image_url = self.sp.currently_playing()['item']['album']['images'][0]['url']
metadata = [name, artist_name, album_image_url]
test = pd.DataFrame(metadata, columns=["currentSong"], index=["song", "artist", "albumcover"])
return test


metadata_csv = pd.DataFrame(metadata, columns=["currentSong"], index=["song", "artist", "albumcover"])
return metadata_csv

def get_track_metadata(self, id):
song = self.sp.track(id)
name = song["name"]
artist_name = song['album']['artists'][0]['name']
album_image_url = song['album']['images'][0]['url']
metadata = [name, artist_name, album_image_url]
song_data = pd.DataFrame(metadata, index=["song", "artist", "albumcover"])
return song_data

0 comments on commit 217b715

Please sign in to comment.