summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr-Blank <64108942+Dr-Blank@users.noreply.github.com>2024-03-18 12:59:58 -0400
committerDr-Blank <64108942+Dr-Blank@users.noreply.github.com>2024-03-18 13:22:04 -0400
commit812fbca9da85853df7c6824eca67d3572029cd81 (patch)
tree63386d57afdbf9a26fe947f587e65f1ab1bc96a0
parentb09806e0df8f01b9155017d3693764ae7beedcd5 (diff)
Add barcode field to AlbumInfo and update related files
-rw-r--r--beets/autotag/hooks.py3
-rw-r--r--beets/autotag/match.py1
-rw-r--r--beets/autotag/mb.py3
-rw-r--r--beets/library.py3
-rw-r--r--beets/test/helper.py1
5 files changed, 11 insertions, 0 deletions
diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py
index 13c43e8cf..67546f47c 100644
--- a/beets/autotag/hooks.py
+++ b/beets/autotag/hooks.py
@@ -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",
diff --git a/beets/autotag/match.py b/beets/autotag/match.py
index c79eba2d7..a256960f7 100644
--- a/beets/autotag/match.py
+++ b/beets/autotag/match.py
@@ -102,6 +102,7 @@ def current_metadata(
"disctotal",
"mb_albumid",
"label",
+ "barcode",
"catalognum",
"country",
"media",
diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py
index d1ac7956d..1fd41fd2c 100644
--- a/beets/autotag/mb.py
+++ b/beets/autotag/mb.py
@@ -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",
diff --git a/beets/library.py b/beets/library.py
index 5ce59852b..754583f57 100644
--- a/beets/library.py
+++ b/beets/library.py
@@ -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",
diff --git a/beets/test/helper.py b/beets/test/helper.py
index b12bfe7ab..9843b51e8 100644
--- a/beets/test/helper.py
+++ b/beets/test/helper.py
@@ -781,6 +781,7 @@ ALBUM_INFO_FIELDS = [
"albumtype",
"va",
"label",
+ "barcode",
"artist_sort",
"releasegroup_id",
"catalognum",