diff --git a/NEWS b/NEWS index 6caa0568c..8f028f418 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +1.0b5 +----- +* A new plugin, "lastid", adds Last.fm acoustic fingerprinting support + to the autotagger. Similar to the PUIDs used by MusicBrainz Picard, + this system allows beets to recognize files that don't have any + metadata at all. (You'll need to install some dependencies for this + plugin to work; documentation is forthcoming.) +* To support the above, there's also a new system for extending the + autotagger via plugins. Plugins can currently add components to the + track distance function. +* New event system for plugins (thanks, Jeff!). Plugins can now get + callbacks from beets when certain events occur in the core. +* Fixed bug that completely broke non-autotagged imports ("import -A"). +* A new "-v" command line switch enables debugging output. + 1.0b4 ----- * Parallel tagger. The autotagger has been reimplemented to use diff --git a/beetsplug/lastid.py b/beetsplug/lastid.py index 4e3aecd7c..5c5c6330f 100644 --- a/beetsplug/lastid.py +++ b/beetsplug/lastid.py @@ -22,9 +22,10 @@ from beets import autotag import lastfp import logging -log = logging.getLogger('beets') API_KEY = '2dc3914abf35f0d9c92d97d8f8e42b43' +log = logging.getLogger('beets') + _match_cache = {} def match(path, metadata=None): """Gets the metadata from Last.fm for the indicated track. Returns @@ -54,10 +55,21 @@ class LastIdPlugin(BeetsPlugin): # Match failed. return 0.0, 0.0 - dist = autotag._ie_dist(last_data['title'], + dist, dist_max = 0.0, 0.0 + + # Track title distance. + dist += autotag._ie_dist(last_data['title'], info['title']) \ - * autotag.TRACK_TITLE_WEIGHT - dist_max = autotag.TRACK_TITLE_WEIGHT + * autotag.TRACK_TITLE_WEIGHT + dist_max += autotag.TRACK_TITLE_WEIGHT + + # MusicBrainz track ID. + if last_data['track_mbid']: + log.debug('Last track ID match: %s/%s' % + (last_data['track_mbid'], track_data['id'])) + if last_data['track_mbid'] != track_data['id']: + dist += autotag.TRACK_ID_WEIGHT + dist_max += autotag.TRACK_ID_WEIGHT log.debug('Last data: %s; distance: %f' % (str(last_data), dist/dist_max))