fix library page genre display
This commit is contained in:
parent
26b9c18b02
commit
0715c41745
1 changed files with 15 additions and 5 deletions
|
|
@ -2422,11 +2422,21 @@ class MusicDatabase:
|
||||||
genres_str = artist_row['genres'] or ''
|
genres_str = artist_row['genres'] or ''
|
||||||
genres = []
|
genres = []
|
||||||
if genres_str:
|
if genres_str:
|
||||||
genre_set = set()
|
# Try to parse as JSON first (new format)
|
||||||
for genre in genres_str.split(','):
|
try:
|
||||||
if genre and genre.strip():
|
import json
|
||||||
genre_set.add(genre.strip())
|
parsed_genres = json.loads(genres_str)
|
||||||
genres = list(genre_set)
|
if isinstance(parsed_genres, list):
|
||||||
|
genres = parsed_genres
|
||||||
|
else:
|
||||||
|
genres = [str(parsed_genres)]
|
||||||
|
except (json.JSONDecodeError, ValueError):
|
||||||
|
# Fall back to comma-separated format (old format)
|
||||||
|
genre_set = set()
|
||||||
|
for genre in genres_str.split(','):
|
||||||
|
if genre and genre.strip():
|
||||||
|
genre_set.add(genre.strip())
|
||||||
|
genres = list(genre_set)
|
||||||
|
|
||||||
# Get artist's albums with track counts and completion
|
# Get artist's albums with track counts and completion
|
||||||
# Include albums from ALL artists with the same name (fixes duplicate artist issue)
|
# Include albums from ALL artists with the same name (fixes duplicate artist issue)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue