Fix lastgenre "count" issue

When original genres were kept (keep_existing option), the final genre
count was "off". The reason was that reducing genres to that count is
handled in _resolve_genre which wasn't run.

- This fixes it by ensuring a run of _resolve_genre in
  _combine_and_label_genres.
- There is a small caveat though: New genres have been run through
  _resolve_genres already. When they are combined with the old ones,
  they run through it again. Let's take this into account for now and
  hope performance doesn't suffer too much.
This commit is contained in:
J0J0 Todos 2025-01-04 12:20:23 +01:00
parent 3e452e7b76
commit 5e6d9170d7

View file

@ -370,8 +370,11 @@ class LastGenrePlugin(plugins.BeetsPlugin):
if new_genres and keep_genres:
split_genres = new_genres.split(separator)
combined_genres = deduplicate(keep_genres + split_genres)
return separator.join(combined_genres), f"keep + {log_label}"
# If we combine old and new, run through _resolve_genres (again).
resolved_genres = self._resolve_genres(combined_genres)
return resolved_genres, f"keep + {log_label}"
if new_genres:
# New genres ran through _resolve_genres already.
return new_genres, log_label
return None, log_label