mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
add route to fetch album color
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
Reference in New Issue
Block a user