mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 19:25:34 +00:00
17 lines
392 B
Python
17 lines
392 B
Python
from flask import Blueprint
|
|
from app.store.albums import AlbumStore as 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)
|
|
|
|
msg = {"color": ""}
|
|
|
|
if album is None or len(album.colors) == 0:
|
|
return msg, 404
|
|
|
|
return {"color": album.colors[0]}
|