beets/docs
Arne Beer 4d7b9cb14b fix(lastgenre): Canonicalize keep_existing fallback
Fixes a bug where existing tags were set to None, if they weren't whitelisted, but an whitelisted canonicalized parent existed up the tree.

In all other cases, the original genres are canonicalized and considered for the final genre, except in the keep_existing logic branch.
This PR fixes the issue and results in the expected behavior for this combination of options.

For the bug to trigger several conditions had to be met:

- Canonicalization is enabled and a whitelist is specified.
- `force` and `keep_existing` are set. Meaning, that Lastfm is queried for a genre, but the existing genres are still left around when none are found online.
- A release with a non-whitelisted genre exists, but that genre has a whitelisted genre parent up the tree.
- That very release has no genre on lastfm.

This is rather convoluted, but stay with me :D
What would happen is the following:

- `keep_genres` is set to the existing genres, as `force` and `keep_existing` is set.
- Genres for `track`/`album`/`artist` aren't found for this release, as they don't exist in lastfm.
- Then the `keep_existing` logic is entered.
  - The old logic only checks if the existing genres have an **exact** match for the whitelist. In contrast to all other code branches, we don't do the `_try_resolve_stage` in case there's no direct match, resulting in no match.
- We continue to the fallback logic, which returns the fallback (`None` in my case)

This patch results in one last try to resolve the existing genres when `keep_existing` is set, which includes canonicalization (if enabled).
2026-01-31 13:22:56 +01:00
..
_static Transparent background logo for docs 2023-10-29 10:30:33 +01:00
_templates/autosummary Add request handler utils to the docs 2026-01-06 09:54:02 +00:00
api Add request handler utils to the docs 2026-01-06 09:54:02 +00:00
dev Move PromptChoice to beets.util module 2025-12-02 01:51:14 +00:00
extensions Address RUF012 2026-01-13 20:55:40 +00:00
guides Update python version references 2025-11-08 12:09:52 +00:00
plugins Enhanced documentation of random plugin. 2026-01-30 00:30:45 +00:00
reference Update color docs with bright_* and bg_bright_* entries 2026-01-25 12:05:40 +01:00
.gitignore Streamlined auto api referencing for documentation (#5795) 2025-05-22 11:35:40 +02:00
changelog.rst fix(lastgenre): Canonicalize keep_existing fallback 2026-01-31 13:22:56 +01:00
code_of_conduct.rst Update docstrfmt 2025-09-04 12:49:44 +01:00
conf.py Add request handler utils to the docs 2026-01-06 09:54:02 +00:00
contributing.rst Update docstrfmt 2025-09-04 12:49:44 +01:00
faq.rst Run formatter. 2025-10-11 13:52:35 +02:00
index.rst Re-added macport instructions. Removed mailing list ref. Added section 2025-10-11 13:52:35 +02:00
Makefile Streamlined auto api referencing for documentation (#5795) 2025-05-22 11:35:40 +02:00
modd.conf Switch to modd for live docs build 2017-12-21 11:39:08 -05:00
team.rst Reformat all docs using docstrfmt 2025-08-10 16:25:05 +01:00