mirror of
https://github.com/beetbox/beets.git
synced 2025-12-16 05:34:47 +01:00
In _get_existing_genres ensure empty string ignore
This commit is contained in:
parent
261379f395
commit
87d9f57e24
1 changed files with 4 additions and 4 deletions
|
|
@ -297,16 +297,16 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
# Main processing: _get_genre() and helpers.
|
||||
|
||||
def _get_existing_genres(self, obj: Union[Album, Item]) -> list[str]:
|
||||
"""Return a list of genres for this Item or Album."""
|
||||
"""Return a list of genres for this Item or Album. Empty string genres
|
||||
are removed."""
|
||||
separator = self.config["separator"].get()
|
||||
if isinstance(obj, library.Item):
|
||||
item_genre = obj.get("genre", with_album=False).split(separator)
|
||||
else:
|
||||
item_genre = obj.get("genre").split(separator)
|
||||
|
||||
if any(item_genre):
|
||||
return item_genre
|
||||
return []
|
||||
# Filter out empty strings
|
||||
return [g for g in item_genre if g]
|
||||
|
||||
def _combine_genres(
|
||||
self, old: list[str], new: list[str]
|
||||
|
|
|
|||
Loading…
Reference in a new issue