File tree Expand file tree Collapse file tree 2 files changed +118
-104
lines changed Expand file tree Collapse file tree 2 files changed +118
-104
lines changed Original file line number Diff line number Diff line change 2323
2424from typing_extensions import Self
2525
26+ from beets .util import cached_classproperty
27+
2628if TYPE_CHECKING :
2729 from beets .library import Item
2830
@@ -56,6 +58,10 @@ def __hash__(self) -> int: # type: ignore[override]
5658class Info (AttrDict [Any ]):
5759 """Container for metadata about a musical entity."""
5860
61+ @cached_property
62+ def name (self ) -> str :
63+ raise NotImplementedError
64+
5965 def __init__ (
6066 self ,
6167 album : str | None = None ,
@@ -97,6 +103,10 @@ class AlbumInfo(Info):
97103 user items, and later to drive tagging decisions once selected.
98104 """
99105
106+ @cached_property
107+ def name (self ) -> str :
108+ return self .album or ""
109+
100110 def __init__ (
101111 self ,
102112 tracks : list [TrackInfo ],
@@ -169,6 +179,10 @@ class TrackInfo(Info):
169179 stand alone for singleton matching.
170180 """
171181
182+ @cached_property
183+ def name (self ) -> str :
184+ return self .title or ""
185+
172186 def __init__ (
173187 self ,
174188 * ,
@@ -221,6 +235,10 @@ class Match:
221235 distance : Distance
222236 info : Info
223237
238+ @cached_classproperty
239+ def type (cls ) -> str :
240+ return cls .__name__ .removesuffix ("Match" ) # type: ignore[attr-defined]
241+
224242
225243@dataclass
226244class AlbumMatch (Match ):
You can’t perform that action at this time.
0 commit comments