From 8d7397135f1431b57199c11aebf70fd701b6ef07 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 29 Jun 2012 15:06:05 -0700 Subject: [PATCH] AlbumMatch and TrackMatch types These new named tuples will represent candidates given by the autotagging system. In the case of album matches, these are currently unwieldy, verbosely-documented tuples that will only get more unwieldy with the addition of "unmatched tracks". --- beets/autotag/hooks.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index 6c82a50f7..7b90f40b6 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -14,11 +14,14 @@ """Glue between metadata sources and the matching logic.""" import logging +from collections import namedtuple + from beets import plugins from beets.autotag import mb log = logging.getLogger('beets') + # Classes used to represent candidate options. class AlbumInfo(object): @@ -117,6 +120,11 @@ class TrackInfo(object): self.disctitle = disctitle self.artist_credit = artist_credit +AlbumMatch = namedtuple('AlbumMatch', ['distance', 'info', 'mapping', + 'extra_items', 'extra_tracks']) + +TrackMatch = namedtuple('TrackMatch', ['distance', 'info']) + # Aggregation of sources.