mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
add function to validate albums
+ extract colors in watchdogg + rename color db files
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ from dataclasses import asdict
|
||||
|
||||
from flask import Blueprint, request
|
||||
|
||||
from app.db.sqlite.albums import SQLiteAlbumMethods as adb
|
||||
from app.db.sqlite.albumcolors import SQLiteAlbumMethods as adb
|
||||
from app.db.sqlite.favorite import SQLiteFavoriteMethods as favdb
|
||||
from app.db.sqlite.lastfm.similar_artists import SQLiteLastFMSimilarArtists as lastfmdb
|
||||
from app.models import FavType, Track
|
||||
|
||||
+5
-7
@@ -8,11 +8,9 @@ api = Blueprint("colors", __name__, url_prefix="/colors")
|
||||
def get_album_color(albumhash: str):
|
||||
album = Store.get_album_by_hash(albumhash)
|
||||
|
||||
if len(album.colors) > 0:
|
||||
return {
|
||||
"color": album.colors[0]
|
||||
}
|
||||
msg = {"color": ""}
|
||||
|
||||
return {
|
||||
"color": ""
|
||||
}
|
||||
if album is None or len(album.colors) == 0:
|
||||
return msg, 404
|
||||
|
||||
return {"color": album.colors[0]}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ def send_track_file(trackhash: str):
|
||||
|
||||
try:
|
||||
return send_file(track.filepath, mimetype=audio_type)
|
||||
except FileNotFoundError:
|
||||
except (FileNotFoundError, OSError) as e:
|
||||
return msg, 404
|
||||
|
||||
return msg, 404
|
||||
|
||||
Reference in New Issue
Block a user