feat: ♻️ Remake url
This commit is contained in:
parent
13fdaf9174
commit
0afeb8d2b8
4
main.py
4
main.py
@ -54,7 +54,7 @@ def create_playlist():
|
||||
return render_template("create.html", response='Request failed', comment=e, type="error")
|
||||
|
||||
@app.route('/search/<string:roomid>', methods=['GET', 'POST'])
|
||||
def main_app(roomid):
|
||||
def search(roomid):
|
||||
if len(roomid) != 8 or not cursor.execute("SELECT * FROM rooms WHERE roomid = ?", (roomid,)).fetchone():
|
||||
return main()
|
||||
playlistName = cursor.execute("SELECT playlist_name FROM rooms WHERE roomid = ?", (roomid,)).fetchone()[0]
|
||||
@ -69,7 +69,7 @@ def main_app(roomid):
|
||||
# otherwise handle the GET request
|
||||
return render_template("search.html", roomid=roomid, playlistName=playlistName, spotifyURL=spotifyURL)
|
||||
|
||||
@app.route('/add/<string:roomid>/<string:playlistID>/<string:trackid>', methods=['GET'])
|
||||
@app.route('/add/room/<string:roomid>/playlist/<string:playlistID>/track/<string:trackid>', methods=['GET'])
|
||||
def add_to_playlist(roomid, playlistID, trackid):
|
||||
print(roomid)
|
||||
print(playlistID)
|
||||
|
@ -41,7 +41,7 @@
|
||||
<h5 class="card-title"> {{ track[0] }} </h5>
|
||||
<p class="card-text">{{ track[1] }} - {{ track[2] }}</p>
|
||||
<audio controls><source src="{{ track[3] }}"></audio>
|
||||
<form method="GET" action="/add/{{roomid}}/{{playlistID}}/{{track[5]}}">
|
||||
<form method="GET" action="/add/room/{{roomid}}/playlist/{{playlistID}}/track/{{track[5]}}">
|
||||
<input type="hidden" name="track" value="{{ track[5] }}">
|
||||
<input type="submit" value="Add to the playlist" class="btn btn-primary">
|
||||
</form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user