add route to fetch album color

This commit is contained in:
geoffrey45 2023-03-19 23:37:01 +03:00
parent 598e3d4c79
commit e23f2a6489
2 changed files with 15 additions and 1 deletions

View File

@ -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
View 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]
}