Merge pull request #5153 from Dr-Blank/barcode-support

This commit is contained in:
Serene 2024-03-24 17:41:29 +10:00 committed by GitHub
commit 6077b7a3a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 0 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -90,6 +90,7 @@ class PluralityTest(_common.TestCase):
"disctotal",
"mb_albumid",
"label",
"barcode",
"catalognum",
"country",
"media",

View file

@ -69,6 +69,7 @@ class MBAlbumInfoTest(_common.TestCase):
},
"country": "COUNTRY",
"status": "STATUS",
"barcode": "BARCODE",
}
if multi_artist_credit:
@ -379,6 +380,11 @@ class MBAlbumInfoTest(_common.TestCase):
d = mb.album_info(release)
self.assertEqual(d.albumstatus, "STATUS")
def test_parse_barcode(self):
release = self._make_release(None)
d = mb.album_info(release)
self.assertEqual(d.barcode, "BARCODE")
def test_parse_media(self):
tracks = [
self._make_track("TITLE ONE", "ID ONE", 100.0 * 1000.0),