Add barcode field to AlbumInfo and update related files

This commit is contained in:
Dr-Blank 2024-03-18 12:59:58 -04:00
parent b09806e0df
commit 812fbca9da
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
5 changed files with 11 additions and 0 deletions

View file

@ -94,6 +94,7 @@ class AlbumInfo(AttrDict):
month: Optional[int] = None, month: Optional[int] = None,
day: Optional[int] = None, day: Optional[int] = None,
label: Optional[str] = None, label: Optional[str] = None,
barcode: Optional[str] = None,
mediums: Optional[int] = None, mediums: Optional[int] = None,
artist_sort: Optional[str] = None, artist_sort: Optional[str] = None,
artists_sort: Optional[List[str]] = None, artists_sort: Optional[List[str]] = None,
@ -136,6 +137,7 @@ class AlbumInfo(AttrDict):
self.month = month self.month = month
self.day = day self.day = day
self.label = label self.label = label
self.barcode = barcode
self.mediums = mediums self.mediums = mediums
self.artist_sort = artist_sort self.artist_sort = artist_sort
self.artists_sort = artists_sort or [] self.artists_sort = artists_sort or []
@ -175,6 +177,7 @@ class AlbumInfo(AttrDict):
"artist", "artist",
"albumtype", "albumtype",
"label", "label",
"barcode",
"artist_sort", "artist_sort",
"catalognum", "catalognum",
"script", "script",

View file

@ -102,6 +102,7 @@ def current_metadata(
"disctotal", "disctotal",
"mb_albumid", "mb_albumid",
"label", "label",
"barcode",
"catalognum", "catalognum",
"country", "country",
"media", "media",

View file

@ -45,6 +45,7 @@ FIELDS_TO_MB_KEYS = {
"catalognum": "catno", "catalognum": "catno",
"country": "country", "country": "country",
"label": "label", "label": "label",
"barcode": "barcode",
"media": "format", "media": "format",
"year": "date", "year": "date",
} }
@ -531,6 +532,7 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo:
artists_credit=artists_credit_names, artists_credit=artists_credit_names,
data_source="MusicBrainz", data_source="MusicBrainz",
data_url=album_url(release["id"]), data_url=album_url(release["id"]),
barcode=release.get("barcode"),
) )
info.va = info.artist_id == VARIOUS_ARTISTS_ID info.va = info.artist_id == VARIOUS_ARTISTS_ID
if info.va: if info.va:
@ -831,6 +833,7 @@ def _merge_pseudo_and_actual_album(
"original_month", "original_month",
"original_day", "original_day",
"label", "label",
"barcode",
"asin", "asin",
"style", "style",
"genre", "genre",

View file

@ -562,6 +562,7 @@ class Item(LibModel):
"albumtype": types.STRING, "albumtype": types.STRING,
"albumtypes": types.SEMICOLON_SPACE_DSV, "albumtypes": types.SEMICOLON_SPACE_DSV,
"label": types.STRING, "label": types.STRING,
"barcode": types.STRING,
"acoustid_fingerprint": types.STRING, "acoustid_fingerprint": types.STRING,
"acoustid_id": types.STRING, "acoustid_id": types.STRING,
"mb_releasegroupid": types.STRING, "mb_releasegroupid": types.STRING,
@ -1162,6 +1163,7 @@ class Album(LibModel):
"albumtype": types.STRING, "albumtype": types.STRING,
"albumtypes": types.SEMICOLON_SPACE_DSV, "albumtypes": types.SEMICOLON_SPACE_DSV,
"label": types.STRING, "label": types.STRING,
"barcode": types.STRING,
"mb_releasegroupid": types.STRING, "mb_releasegroupid": types.STRING,
"release_group_title": types.STRING, "release_group_title": types.STRING,
"asin": types.STRING, "asin": types.STRING,
@ -1217,6 +1219,7 @@ class Album(LibModel):
"albumtype", "albumtype",
"albumtypes", "albumtypes",
"label", "label",
"barcode",
"mb_releasegroupid", "mb_releasegroupid",
"asin", "asin",
"catalognum", "catalognum",

View file

@ -781,6 +781,7 @@ ALBUM_INFO_FIELDS = [
"albumtype", "albumtype",
"va", "va",
"label", "label",
"barcode",
"artist_sort", "artist_sort",
"releasegroup_id", "releasegroup_id",
"catalognum", "catalognum",