Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rangsimanketkaew committed Oct 23, 2022
1 parent 99dd4ab commit 456d93a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions backend/src/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from flask import Flask, redirect, url_for
from backend.src.spotify_api.api_interface import SPOTIFY_API_INTERFACE
import pandas as pd
import numpy as np
from flask_cors import CORS

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

sp = SPOTIFY_API_INTERFACE()
Expand All @@ -15,18 +19,12 @@ def index():

@app.route('/current_info')
def current_info():
data = sp.get_current_song()
dict = data.to_dict()
return {'data': dict}, 200 # return data and 200 OK code

@app.route('/skipped_songs')
def skipped_song():
data = sp.get_current_song()
dict = data.to_dict()
return {'data': dict}, 200 # return data and 200 OK code
data = sp.get_metadata_current()
if data is not None:
dict = data.to_dict()
else:
dict = pd.Series()
return dict, 200 # return data and 200 OK code

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



0 comments on commit 456d93a

Please sign in to comment.