diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index b3e8afcaf..31418559a 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -56,7 +56,37 @@ class AttrDict(dict[str, V]): class Info(AttrDict[Any]): - pass + def __init__( + self, + album: str | None = None, + artist_credit: str | None = None, + artist_id: str | None = None, + artist: str | None = None, + artists_credit: list[str] | None = None, + artists_ids: list[str] | None = None, + artists: list[str] | None = None, + artist_sort: str | None = None, + artists_sort: list[str] | None = None, + data_source: str | None = None, + data_url: str | None = None, + genre: str | None = None, + media: str | None = None, + **kwargs, + ) -> None: + self.album = album + self.artist = artist + self.artist_credit = artist_credit + self.artist_id = artist_id + self.artists = artists or [] + self.artists_credit = artists_credit or [] + self.artists_ids = artists_ids or [] + self.artist_sort = artist_sort + self.artists_sort = artists_sort or [] + self.data_source = data_source + self.data_url = data_url + self.genre = genre + self.media = media + self.update(kwargs) class AlbumInfo(Info): @@ -77,12 +107,7 @@ class AlbumInfo(Info): def __init__( self, tracks: list[TrackInfo], - album: str | None = None, album_id: str | None = None, - artist: str | None = None, - artist_id: str | None = None, - artists: list[str] | None = None, - artists_ids: list[str] | None = None, asin: str | None = None, albumtype: str | None = None, albumtypes: list[str] | None = None, @@ -93,8 +118,6 @@ class AlbumInfo(Info): label: str | None = None, barcode: str | None = None, mediums: int | None = None, - artist_sort: str | None = None, - artists_sort: list[str] | None = None, releasegroup_id: str | None = None, release_group_title: str | None = None, catalognum: str | None = None, @@ -102,29 +125,18 @@ class AlbumInfo(Info): language: str | None = None, country: str | None = None, style: str | None = None, - genre: str | None = None, albumstatus: str | None = None, - media: str | None = None, albumdisambig: str | None = None, releasegroupdisambig: str | None = None, - artist_credit: str | None = None, - artists_credit: list[str] | None = None, original_year: int | None = None, original_month: int | None = None, original_day: int | None = None, - data_source: str | None = None, - data_url: str | None = None, discogs_albumid: str | None = None, discogs_labelid: str | None = None, discogs_artistid: str | None = None, **kwargs, ): - self.album = album self.album_id = album_id - self.artist = artist - self.artist_id = artist_id - self.artists = artists or [] - self.artists_ids = artists_ids or [] self.tracks = tracks self.asin = asin self.albumtype = albumtype @@ -136,8 +148,6 @@ class AlbumInfo(Info): self.label = label self.barcode = barcode self.mediums = mediums - self.artist_sort = artist_sort - self.artists_sort = artists_sort or [] self.releasegroup_id = releasegroup_id self.release_group_title = release_group_title self.catalognum = catalognum @@ -145,22 +155,16 @@ class AlbumInfo(Info): self.language = language self.country = country self.style = style - self.genre = genre self.albumstatus = albumstatus - self.media = media self.albumdisambig = albumdisambig self.releasegroupdisambig = releasegroupdisambig - self.artist_credit = artist_credit - self.artists_credit = artists_credit or [] self.original_year = original_year self.original_month = original_month self.original_day = original_day - self.data_source = data_source - self.data_url = data_url self.discogs_albumid = discogs_albumid self.discogs_labelid = discogs_labelid self.discogs_artistid = discogs_artistid - self.update(kwargs) + super().__init__(**kwargs) class TrackInfo(Info): @@ -181,23 +185,12 @@ class TrackInfo(Info): title: str | None = None, track_id: str | None = None, release_track_id: str | None = None, - artist: str | None = None, - artist_id: str | None = None, - artists: list[str] | None = None, - artists_ids: list[str] | None = None, length: float | None = None, index: int | None = None, medium: int | None = None, medium_index: int | None = None, medium_total: int | None = None, - artist_sort: str | None = None, - artists_sort: list[str] | None = None, disctitle: str | None = None, - artist_credit: str | None = None, - artists_credit: list[str] | None = None, - data_source: str | None = None, - data_url: str | None = None, - media: str | None = None, lyricist: str | None = None, composer: str | None = None, composer_sort: str | None = None, @@ -208,30 +201,17 @@ class TrackInfo(Info): work_disambig: str | None = None, bpm: str | None = None, initial_key: str | None = None, - genre: str | None = None, - album: str | None = None, **kwargs, ): self.title = title self.track_id = track_id self.release_track_id = release_track_id - self.artist = artist - self.artist_id = artist_id - self.artists = artists or [] - self.artists_ids = artists_ids or [] self.length = length self.index = index - self.media = media self.medium = medium self.medium_index = medium_index self.medium_total = medium_total - self.artist_sort = artist_sort - self.artists_sort = artists_sort or [] self.disctitle = disctitle - self.artist_credit = artist_credit - self.artists_credit = artists_credit or [] - self.data_source = data_source - self.data_url = data_url self.lyricist = lyricist self.composer = composer self.composer_sort = composer_sort @@ -242,9 +222,7 @@ class TrackInfo(Info): self.work_disambig = work_disambig self.bpm = bpm self.initial_key = initial_key - self.genre = genre - self.album = album - self.update(kwargs) + super().__init__(**kwargs) # Structures that compose all the information for a candidate match.