mirror of
https://github.com/beetbox/beets.git
synced 2026-01-09 09:22:55 +01:00
Reverted to original approach
This commit is contained in:
parent
d8851b97b8
commit
6e980a977e
2 changed files with 24 additions and 16 deletions
|
|
@ -511,7 +511,10 @@ def album_for_mbid(release_id):
|
|||
if the ID is not found.
|
||||
"""
|
||||
try:
|
||||
return mb.album_for_id(release_id)
|
||||
album = mb.album_for_id(release_id)
|
||||
if album:
|
||||
plugins.send('albuminfo_received', info=album)
|
||||
return album
|
||||
except mb.MusicBrainzAPIError as exc:
|
||||
exc.log(log)
|
||||
|
||||
|
|
@ -521,7 +524,10 @@ def track_for_mbid(recording_id):
|
|||
if the ID is not found.
|
||||
"""
|
||||
try:
|
||||
return mb.track_for_id(recording_id)
|
||||
track = mb.track_for_id(recording_id)
|
||||
if track:
|
||||
plugins.send('trackinfo_received', info=track)
|
||||
return track
|
||||
except mb.MusicBrainzAPIError as exc:
|
||||
exc.log(log)
|
||||
|
||||
|
|
@ -529,14 +535,20 @@ def track_for_mbid(recording_id):
|
|||
def albums_for_id(album_id):
|
||||
"""Get a list of albums for an ID."""
|
||||
candidates = [album_for_mbid(album_id)]
|
||||
candidates.extend(plugins.album_for_id(album_id))
|
||||
plugin_albums = plugins.album_for_id(album_id)
|
||||
for a in plugin_albums:
|
||||
plugins.send('albuminfo_received', info=a)
|
||||
candidates.extend(plugin_albums)
|
||||
return filter(None, candidates)
|
||||
|
||||
|
||||
def tracks_for_id(track_id):
|
||||
"""Get a list of tracks for an ID."""
|
||||
candidates = [track_for_mbid(track_id)]
|
||||
candidates.extend(plugins.track_for_id(track_id))
|
||||
plugin_tracks = plugins.track_for_id(track_id)
|
||||
for t in plugin_tracks:
|
||||
plugins.send('trackinfo_received', info=t)
|
||||
candidates.extend(plugin_tracks)
|
||||
return filter(None, candidates)
|
||||
|
||||
|
||||
|
|
@ -566,6 +578,10 @@ def album_candidates(items, artist, album, va_likely):
|
|||
# Candidates from plugins.
|
||||
out.extend(plugins.candidates(items, artist, album, va_likely))
|
||||
|
||||
# Notify subscribed plugins about fetched album info
|
||||
for a in out:
|
||||
plugins.send('albuminfo_received', info=a)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
|
|
@ -586,4 +602,8 @@ def item_candidates(item, artist, title):
|
|||
# Plugin candidates.
|
||||
out.extend(plugins.item_candidates(item, artist, title))
|
||||
|
||||
# Notify subscribed plugins about fetched track info
|
||||
for i in out:
|
||||
plugins.send('trackinfo_received', info=i)
|
||||
|
||||
return out
|
||||
|
|
|
|||
|
|
@ -350,10 +350,6 @@ def _add_candidate(items, results, info):
|
|||
log.debug(u'Ignored. Missing required tag: {0}', req_tag)
|
||||
return
|
||||
|
||||
# Notify subscribed plugins about fetched album info and let them perform
|
||||
# their manipulations
|
||||
plugins.send('albuminfo_received', info=info)
|
||||
|
||||
# Find mapping between the items and the track info.
|
||||
mapping, extra_items, extra_tracks = assign_items(items, info.tracks)
|
||||
|
||||
|
|
@ -463,10 +459,6 @@ def tag_item(item, search_artist=None, search_title=None,
|
|||
if trackid:
|
||||
log.debug(u'Searching for track ID: {0}', trackid)
|
||||
for track_info in hooks.tracks_for_id(trackid):
|
||||
# Notify subscribed plugins about fetched track info and let them
|
||||
# perform their manipulations
|
||||
plugins.send('trackinfo_received', info=track_info)
|
||||
|
||||
dist = track_distance(item, track_info, incl_artist=True)
|
||||
candidates[track_info.track_id] = \
|
||||
hooks.TrackMatch(dist, track_info)
|
||||
|
|
@ -490,10 +482,6 @@ def tag_item(item, search_artist=None, search_title=None,
|
|||
|
||||
# Get and evaluate candidate metadata.
|
||||
for track_info in hooks.item_candidates(item, search_artist, search_title):
|
||||
# Notify subscribed plugins about fetched track info and let them
|
||||
# perform their manipulations
|
||||
plugins.send('trackinfo_received', info=track_info)
|
||||
|
||||
dist = track_distance(item, track_info, incl_artist=True)
|
||||
candidates[track_info.track_id] = hooks.TrackMatch(dist, track_info)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue