diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index b5d3e866c..aae4846ca 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -17,7 +17,8 @@ from __future__ import annotations from copy import deepcopy -from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, TypeVar from typing_extensions import Self @@ -214,10 +215,14 @@ class TrackInfo(Info): # Structures that compose all the information for a candidate match. - - -class AlbumMatch(NamedTuple): +@dataclass +class Match: distance: Distance + info: Info + + +@dataclass +class AlbumMatch(Match): info: AlbumInfo mapping: dict[Item, TrackInfo] extra_items: list[Item] @@ -232,6 +237,6 @@ class AlbumMatch(NamedTuple): return [i for i, _ in self.item_info_pairs] -class TrackMatch(NamedTuple): - distance: Distance +@dataclass +class TrackMatch(Match): info: TrackInfo