mirror of
https://github.com/beetbox/beets.git
synced 2026-02-25 16:53:17 +01:00
fingerprinting track distance based on MB track IDs
This commit is contained in:
parent
30c37ce1b3
commit
b7518038be
2 changed files with 31 additions and 4 deletions
15
NEWS
15
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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue