|
24 | 24 | import lap |
25 | 25 | import numpy as np |
26 | 26 |
|
27 | | -from beets import config, logging, metadata_plugins |
| 27 | +from beets import config, logging, metadata_plugins, plugins |
28 | 28 | from beets.autotag import AlbumInfo, AlbumMatch, TrackInfo, TrackMatch, hooks |
29 | 29 | from beets.util import get_most_common_tags |
30 | 30 |
|
@@ -274,12 +274,17 @@ def tag_album( |
274 | 274 | log.debug("Searching for album ID: {}", search_id) |
275 | 275 | if info := metadata_plugins.album_for_id(search_id): |
276 | 276 | _add_candidate(items, candidates, info) |
| 277 | + if opt_candidate := candidates.get(info.album_id): |
| 278 | + plugins.send("album_matched", match=opt_candidate) |
277 | 279 |
|
278 | 280 | # Use existing metadata or text search. |
279 | 281 | else: |
280 | 282 | # Try search based on current ID. |
281 | 283 | if info := match_by_id(items): |
282 | 284 | _add_candidate(items, candidates, info) |
| 285 | + for candidate in candidates.values(): |
| 286 | + plugins.send("album_matched", match=candidate) |
| 287 | + |
283 | 288 | rec = _recommendation(list(candidates.values())) |
284 | 289 | log.debug("Album ID match recommendation is {}", rec) |
285 | 290 | if candidates and not config["import"]["timid"]: |
@@ -313,6 +318,8 @@ def tag_album( |
313 | 318 | items, search_artist, search_album, va_likely |
314 | 319 | ): |
315 | 320 | _add_candidate(items, candidates, matched_candidate) |
| 321 | + if opt_candidate := candidates.get(matched_candidate.album_id): |
| 322 | + plugins.send("album_matched", match=opt_candidate) |
316 | 323 |
|
317 | 324 | log.debug("Evaluating {} candidates.", len(candidates)) |
318 | 325 | # Sort and get the recommendation. |
|
0 commit comments