mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
fix: is_favorite missing from album and artist page
This commit is contained in:
+7
-1
@@ -2,6 +2,7 @@
|
||||
Contains all the album routes.
|
||||
"""
|
||||
|
||||
from dataclasses import asdict
|
||||
from pprint import pprint
|
||||
import random
|
||||
|
||||
@@ -52,6 +53,8 @@ def get_album_tracks_and_info(body: AlbumHashSchema):
|
||||
tracks=tracks, singleTrackAsSingle=UserConfig().showAlbumsAsSingles
|
||||
)
|
||||
|
||||
print("is_favorite", album.is_favorite)
|
||||
|
||||
track_total = sum({int(t.extra.get("track_total", 1) or 1) for t in tracks})
|
||||
avg_bitrate = sum(t.bitrate for t in tracks) // (len(tracks) or 1)
|
||||
|
||||
@@ -59,7 +62,10 @@ def get_album_tracks_and_info(body: AlbumHashSchema):
|
||||
pprint(album)
|
||||
|
||||
return {
|
||||
"info": album,
|
||||
"info": {
|
||||
**asdict(album),
|
||||
"is_favorite": album.is_favorite,
|
||||
},
|
||||
"extra": {
|
||||
# INFO: track_total is the sum of a set of track_total values from each track
|
||||
# ASSUMPTIONS
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
Contains all the artist(s) routes.
|
||||
"""
|
||||
|
||||
from dataclasses import asdict
|
||||
import math
|
||||
import random
|
||||
from datetime import datetime
|
||||
@@ -68,7 +69,7 @@ def get_artist(path: ArtistHashSchema, query: TrackLimitSchema):
|
||||
artist.genres.insert(0, {"name": decade, "genrehash": decade})
|
||||
|
||||
return {
|
||||
"artist": artist,
|
||||
"artist": {**asdict(artist), "is_favorite": artist.is_favorite},
|
||||
"tracks": serialize_tracks(tracks[:limit]),
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ from app.api.auth import admin_required
|
||||
from app.db.sqlite.plugins import PluginsMethods as pdb
|
||||
from app.db.sqlite.tracks import SQLiteTrackMethods as trackdb
|
||||
from app.db.userdata import PluginTable
|
||||
from app.lib import populate
|
||||
from app.lib.index import index_everything
|
||||
from app.lib.watchdogg import Watcher as WatchDog
|
||||
from app.logger import log
|
||||
|
||||
Reference in New Issue
Block a user