fix(audiobook_library): split genres on ; and fix ValueError on init

This commit is contained in:
lucas committed 2026-11-01 11:27:09 +01:00
1 parent a9ae9c9a44
commit 2beb715a9c
1 file changed
+6 -3
@@ -1124,8 +1124,6 @@ class AudiobookLibrary:
self.db.close()
def init(self):
if not self.db:
raise ValueError
if not self.connect():
return False
@@ -1194,6 +1192,8 @@ class AudiobookLibrary:
genre = clean_genre(genre)
if "," in genre:
genre = genre.split(",")
elif ";" in genre:
genre = genre.split(";")
elif " - " in genre:
genre = genre.split(" - ")
elif "Historical Adventure Thriller Mystery" in genre:
@@ -1208,10 +1208,13 @@ class AudiobookLibrary:
new_genres.append(genre)
elif isinstance(genre, list):
if len(genres) > 1:
genres = [g for g in genres if g]
genres = [g.strip() for g in genres if g]
logger.trace(f"REPR: {repr(genres)}")
logger.trace(f"GENRES: {genres}")
new_genres.extend(genre)
new_genres = sorted(set(new_genres))
logger.trace(f"{new_genres}")
list_difference = False
if len(new_genres) < len(genres):
list_difference = True