mirror of
https://github.com/beetbox/beets.git
synced 2025-12-07 17:16:07 +01:00
hooks: Generalise AlbumMatch and TrackMatch into Match
This commit is contained in:
parent
612ffa0dde
commit
77e25db1b5
1 changed files with 11 additions and 6 deletions
|
|
@ -17,7 +17,8 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
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
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
@ -214,10 +215,14 @@ class TrackInfo(Info):
|
||||||
|
|
||||||
|
|
||||||
# Structures that compose all the information for a candidate match.
|
# Structures that compose all the information for a candidate match.
|
||||||
|
@dataclass
|
||||||
|
class Match:
|
||||||
class AlbumMatch(NamedTuple):
|
|
||||||
distance: Distance
|
distance: Distance
|
||||||
|
info: Info
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class AlbumMatch(Match):
|
||||||
info: AlbumInfo
|
info: AlbumInfo
|
||||||
mapping: dict[Item, TrackInfo]
|
mapping: dict[Item, TrackInfo]
|
||||||
extra_items: list[Item]
|
extra_items: list[Item]
|
||||||
|
|
@ -232,6 +237,6 @@ class AlbumMatch(NamedTuple):
|
||||||
return [i for i, _ in self.item_info_pairs]
|
return [i for i, _ in self.item_info_pairs]
|
||||||
|
|
||||||
|
|
||||||
class TrackMatch(NamedTuple):
|
@dataclass
|
||||||
distance: Distance
|
class TrackMatch(Match):
|
||||||
info: TrackInfo
|
info: TrackInfo
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue