Skip to content

Commit

Permalink
blahblah
Browse files Browse the repository at this point in the history
  • Loading branch information
noeminellen committed Oct 23, 2022
1 parent 4b27683 commit 431a02d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions backend/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@
import pandas as pd
import numpy as np
from flask_cors import CORS
import csv
import pandas as pd

app = Flask(__name__)
CORS(app)
app.debug = True

sp = SPOTIFY_API_INTERFACE()
sp.get_current_song()


def skipped_song_list():
df = pd.read_csv('../../data/player_data/skipped.csv')
skipped_song_list = pd.DataFrame(index=df['id'].to_list())
for id in df['id']:
song_info = sp.get_track_metadata(id)
skipped_song_list.loc[id] = song_info
return skipped_song_list


@app.route('/')
def index():
return redirect(url_for('current_info'))
Expand All @@ -20,11 +30,13 @@ def index():
@app.route('/current_info')
def current_info():
data = sp.get_metadata_current()
skipped_songs = skipped_song_list()
if data is not None:
dict = data.to_dict()

else:
dict = pd.Series()
return dict, 200 # return data and 200 OK code
return {dict, skipped_songs}, 200 # return data and 200 OK code

if __name__ == '__main__':
app.run(debug=True)

0 comments on commit 431a02d

Please sign in to comment.