mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
rearrange stat items
This commit is contained in:
@@ -223,6 +223,9 @@ def get_top_artists(query: ChartItemsQuery):
|
|||||||
"help_text": get_help_text(
|
"help_text": get_help_text(
|
||||||
artist["playcount"], artist["playduration"], query.order_by
|
artist["playcount"], artist["playduration"], query.order_by
|
||||||
),
|
),
|
||||||
|
"extra": {
|
||||||
|
"playcount": artist["playcount"],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
response.append(artist)
|
response.append(artist)
|
||||||
|
|
||||||
@@ -327,9 +330,9 @@ def get_stats():
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"stats": [
|
"stats": [
|
||||||
|
top_track,
|
||||||
last_7_days_playcount,
|
last_7_days_playcount,
|
||||||
last_7_days_playduration,
|
last_7_days_playduration,
|
||||||
total_tracks,
|
total_tracks,
|
||||||
top_track,
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,4 +1,5 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
import copy
|
||||||
from typing import Any, Callable, TypeVar, Protocol, List
|
from typing import Any, Callable, TypeVar, Protocol, List
|
||||||
from app.db.userdata import ScrobbleTable
|
from app.db.userdata import ScrobbleTable
|
||||||
from app.models.track import Track
|
from app.models.track import Track
|
||||||
@@ -40,6 +41,7 @@ def get_albums_in_period(start_time: int, end_time: int):
|
|||||||
album_entry = AlbumStore.albummap.get(track.albumhash)
|
album_entry = AlbumStore.albummap.get(track.albumhash)
|
||||||
if not album_entry:
|
if not album_entry:
|
||||||
continue
|
continue
|
||||||
|
album_entry = copy.deepcopy(album_entry)
|
||||||
|
|
||||||
albumhash = album_entry.album.albumhash
|
albumhash = album_entry.album.albumhash
|
||||||
if albumhash not in albums:
|
if albumhash not in albums:
|
||||||
@@ -61,7 +63,7 @@ def get_tracks_in_period(start_time: int, end_time: int):
|
|||||||
for scrobble in scrobbles:
|
for scrobble in scrobbles:
|
||||||
if scrobble.trackhash not in tracks:
|
if scrobble.trackhash not in tracks:
|
||||||
try:
|
try:
|
||||||
track = TrackStore.get_tracks_by_trackhashes([scrobble.trackhash])[0]
|
track = copy.deepcopy(TrackStore.get_tracks_by_trackhashes([scrobble.trackhash])[0])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user