In _resolv_genres wo do not have to explicitly check if self.c14n_branches is
not empty. The tree will have been loaded when self.canonicalize is truthy. Also
if self.c14n_branches would be empty the canonicalization is a no-op anyway...
This improves lastgenre's behaviour when the configuration option
`prefer_specific` is set but `canonical` is not.
Previously it would not set any tags. Now it does apply tags, sorted using the
canonicalization tree, but not canonicalized.
For this the default tree is loaded even when `canonical` is not set.
An extra check is added to only use it for canonicalization when `canonical` is
set.
`test_ui.ConfigTest.test_command_line_option_relative_to_working_dir` was
failing because it changes working directories before the relative lazy-loaded
default configuration path is resolved (`../beets/__init__.py`), later causing a
`beets.util.confit.NotFoundError`. The Configuration object has been modified
so that lazy-load configurations resolve the path in advance.
MBID of recording could become invalid after merging. The existing
code always copies metadata from first track after updating. But for
albums with invalid track MBID that happens to be the first track,
MusicBrainz changes won't be applied to whole album, only whose
tracks with valid MBID. This is particularly annoying since those
changes are actually displayed for every `beet mbsync` run, but never
get applied.
Fix this issue by finding any track that get MusicBrainz updates, and
apply it to whole album.
Send events from {album,track}_for_mbid, then remove the decorators from
{albums,tracks}_for_id so that duplicate events are not fired.
When moving to generators and decorators in autotag.hooks (#2249),
albuminfo_received and trackinfo_received stopped being sent from code
directly calling hooks.{album,track}_for_mbid. This is most visible when
trying to write a plugin to interact with mbsync, as the documentation
explicitly says it should work.