|
|
@ -61,6 +61,15 @@ def album(album_id): |
|
|
songs = Song.query.filter_by(album_id=album_id).all() |
|
|
songs = Song.query.filter_by(album_id=album_id).all() |
|
|
return render_template('album.html', album=album, songs=songs) |
|
|
return render_template('album.html', album=album, songs=songs) |
|
|
|
|
|
|
|
|
|
|
|
@app.route('/search') |
|
|
|
|
|
def search(): |
|
|
|
|
|
query = request.args.get('query', '') |
|
|
|
|
|
if query: |
|
|
|
|
|
songs = Song.query.filter(Song.title.contains(query)).all() |
|
|
|
|
|
else: |
|
|
|
|
|
songs = [] |
|
|
|
|
|
return render_template('search.html', query=query, songs=songs) |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
with app.app_context(): |
|
|
with app.app_context(): |
|
|
db.create_all() |
|
|
db.create_all() |
|
|
|