mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 19:25:34 +00:00
add route to fetch album color
This commit is contained in:
parent
598e3d4c79
commit
e23f2a6489
@ -6,7 +6,7 @@ from flask import Flask
|
||||
from flask_cors import CORS
|
||||
|
||||
from app.api import (album, artist, favorites, folder, imgserver, playlist,
|
||||
search, settings, track)
|
||||
search, settings, track, colors)
|
||||
|
||||
|
||||
def create_api():
|
||||
@ -26,5 +26,6 @@ def create_api():
|
||||
app.register_blueprint(favorites.api)
|
||||
app.register_blueprint(imgserver.api)
|
||||
app.register_blueprint(settings.api)
|
||||
app.register_blueprint(colors.api)
|
||||
|
||||
return app
|
||||
|
13
app/api/colors.py
Normal file
13
app/api/colors.py
Normal file
@ -0,0 +1,13 @@
|
||||
from flask import Blueprint
|
||||
from app.db.store import Store
|
||||
|
||||
api = Blueprint("colors", __name__, url_prefix="/colors")
|
||||
|
||||
|
||||
@api.route("/album/<albumhash>")
|
||||
def get_album_color(albumhash: str):
|
||||
album = Store.get_album_by_hash(albumhash)
|
||||
|
||||
return {
|
||||
"color": album.colors[0]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user