fix library page genre display

This commit is contained in:
Broque Thomas 2025-10-03 09:15:48 -07:00
parent 26b9c18b02
commit 0715c41745

View file

@ -2422,6 +2422,16 @@ class MusicDatabase:
genres_str = artist_row['genres'] or '' genres_str = artist_row['genres'] or ''
genres = [] genres = []
if genres_str: if genres_str:
# Try to parse as JSON first (new format)
try:
import json
parsed_genres = json.loads(genres_str)
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() genre_set = set()
for genre in genres_str.split(','): for genre in genres_str.split(','):
if genre and genre.strip(): if genre and genre.strip():