From 6530d763191215164895e8f09de8d26acdc66a18 Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Tue, 21 Jan 2025 17:44:17 +0100 Subject: [PATCH] Revert "Simplify _get_existing_genres()" This reverts commit 7ff06df17cfef38c0029b5faeb193d2569220d16. This was here for a reason: Ab empty string genre should als become an empty list! --- beetsplug/lastgenre/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index f14dcaa00..6f47e5e60 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -298,12 +298,15 @@ class LastGenrePlugin(plugins.BeetsPlugin): def _get_existing_genres(self, obj: Union[Album, Item]) -> list[str]: """Return a list of genres for this Item or Album.""" + separator = self.config["separator"].get() if isinstance(obj, library.Item): - genre_str = obj.get("genre", with_album=False) + item_genre = obj.get("genre", with_album=False).split(separator) else: - genre_str = obj.get("genre") + item_genre = obj.get("genre").split(separator) - return genre_str.split(self.config["separator"].get()) + if any(item_genre): + return item_genre + return [] def _combine_genres( self, old: list[str], new: list[str]