mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
fix: artist track count
+ fix: album type on artits page + sort by release date help text on get all
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ def get_album_tracks_and_info(body: AlbumHashSchema):
|
|||||||
tracks = TrackDb.get_tracks_by_albumhash(albumhash)
|
tracks = TrackDb.get_tracks_by_albumhash(albumhash)
|
||||||
album.trackcount = len(tracks)
|
album.trackcount = len(tracks)
|
||||||
album.duration = sum(t.duration for t in tracks)
|
album.duration = sum(t.duration for t in tracks)
|
||||||
album.type = album.check_type(
|
album.check_type(
|
||||||
tracks=tracks, singleTrackAsSingle=UserConfig().showAlbumsAsSingles
|
tracks=tracks, singleTrackAsSingle=UserConfig().showAlbumsAsSingles
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ def get_all_items(path: GetAllItemsPath, query: GetAllItemsQuery):
|
|||||||
item_dict = serialize_album(item) if is_albums else serialize_artist(item)
|
item_dict = serialize_album(item) if is_albums else serialize_artist(item)
|
||||||
|
|
||||||
if sort_is_date:
|
if sort_is_date:
|
||||||
item_dict["help_text"] = item.date
|
item_dict["help_text"] = datetime.fromtimestamp(item.date).year
|
||||||
|
|
||||||
if sort_is_create_date:
|
if sort_is_create_date:
|
||||||
date = create_new_date(datetime.fromtimestamp(item.created_date))
|
date = create_new_date(datetime.fromtimestamp(item.created_date))
|
||||||
|
|||||||
+10
-2
@@ -210,6 +210,7 @@ class IndexArtists:
|
|||||||
|
|
||||||
for a in track.albumartists:
|
for a in track.albumartists:
|
||||||
if a not in this_artists:
|
if a not in this_artists:
|
||||||
|
a["in_track"] = False
|
||||||
this_artists.append(a)
|
this_artists.append(a)
|
||||||
|
|
||||||
for thisartist in this_artists:
|
for thisartist in this_artists:
|
||||||
@@ -228,7 +229,11 @@ class IndexArtists:
|
|||||||
"playcount": track.playcount,
|
"playcount": track.playcount,
|
||||||
"playduration": track.playduration,
|
"playduration": track.playduration,
|
||||||
"trackcount": None,
|
"trackcount": None,
|
||||||
"tracks": {track.trackhash},
|
"tracks": (
|
||||||
|
{track.trackhash}
|
||||||
|
if thisartist.get("in_track", True)
|
||||||
|
else set()
|
||||||
|
),
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
artist = artists[thisartist["artisthash"]]
|
artist = artists[thisartist["artisthash"]]
|
||||||
@@ -236,12 +241,15 @@ class IndexArtists:
|
|||||||
artist["playcount"] += track.playcount
|
artist["playcount"] += track.playcount
|
||||||
artist["playduration"] += track.playduration
|
artist["playduration"] += track.playduration
|
||||||
artist["albums"].add(track.albumhash)
|
artist["albums"].add(track.albumhash)
|
||||||
artist["tracks"].add(track.trackhash)
|
|
||||||
artist["date"] = min(artist["date"], track.date)
|
artist["date"] = min(artist["date"], track.date)
|
||||||
artist["lastplayed"] = max(artist["lastplayed"], track.lastplayed)
|
artist["lastplayed"] = max(artist["lastplayed"], track.lastplayed)
|
||||||
artist["created_date"] = min(artist["created_date"], track.last_mod)
|
artist["created_date"] = min(artist["created_date"], track.last_mod)
|
||||||
artist["names"].add(thisartist["name"])
|
artist["names"].add(thisartist["name"])
|
||||||
|
|
||||||
|
|
||||||
|
if thisartist.get("in_track", True):
|
||||||
|
artist["tracks"].add(track.trackhash)
|
||||||
|
|
||||||
if track.genres:
|
if track.genres:
|
||||||
artist["genres"].extend(track.genres)
|
artist["genres"].extend(track.genres)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -269,7 +269,7 @@ def get_tags(filepath: str, artist_separators: set[str]):
|
|||||||
]
|
]
|
||||||
|
|
||||||
tags.artisthashes = list(
|
tags.artisthashes = list(
|
||||||
{a["artisthash"] for a in tags.artists + tags.albumartists}
|
{a["artisthash"] for a in tags.artists}
|
||||||
)
|
)
|
||||||
|
|
||||||
# remove prod by
|
# remove prod by
|
||||||
|
|||||||
Reference in New Issue
Block a user