Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An opinionated fix for "the albumtype(s) problem" #5075

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions beets/autotag/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def __init__(
artists: Optional[List[str]] = None,
artists_ids: Optional[List[str]] = None,
asin: Optional[str] = None,
albumtype: Optional[str] = None,
albumtypes: Optional[List[str]] = None,
va: bool = False,
year: Optional[int] = None,
Expand Down Expand Up @@ -129,7 +128,6 @@ def __init__(
self.artists_ids = artists_ids or []
self.tracks = tracks
self.asin = asin
self.albumtype = albumtype
self.albumtypes = albumtypes or []
self.va = va
self.year = year
Expand Down Expand Up @@ -173,7 +171,6 @@ def decode(self, codec: str = "utf-8"):
for fld in [
"album",
"artist",
"albumtype",
"label",
"artist_sort",
"catalognum",
Expand Down
7 changes: 5 additions & 2 deletions beets/autotag/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,11 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo:
# feature before MusicBrainz supported multiple release types.
if "type" in release["release-group"]:
reltype = release["release-group"]["type"]
if reltype:
info.albumtype = reltype.lower()
log.debug(
"MusicBrainz release-group.type received but ignoring in favor of"
"new-style primary/secondary release-types:",
reltype,
)

# Set the new-style "primary" and "secondary" release types.
albumtypes = []
Expand Down
2 changes: 1 addition & 1 deletion beets/config_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ replace:

aunique:
keys: albumartist album
disambiguators: albumtype year label catalognum albumdisambig releasegroupdisambig
disambiguators: year label catalognum albumdisambig releasegroupdisambig
bracket: '[]'

sunique:
Expand Down
3 changes: 0 additions & 3 deletions beets/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ class Item(LibModel):
"mb_albumartistids": types.MULTI_VALUE_DSV,
"mb_releasetrackid": types.STRING,
"trackdisambig": types.STRING,
"albumtype": types.STRING,
"albumtypes": types.SEMICOLON_SPACE_DSV,
"label": types.STRING,
"acoustid_fingerprint": types.STRING,
Expand Down Expand Up @@ -1159,7 +1158,6 @@ class Album(LibModel):
"comp": types.BOOLEAN,
"mb_albumid": types.STRING,
"mb_albumartistid": types.STRING,
"albumtype": types.STRING,
"albumtypes": types.SEMICOLON_SPACE_DSV,
"label": types.STRING,
"mb_releasegroupid": types.STRING,
Expand Down Expand Up @@ -1214,7 +1212,6 @@ class Album(LibModel):
"comp",
"mb_albumid",
"mb_albumartistid",
"albumtype",
"albumtypes",
"label",
"mb_releasegroupid",
Expand Down
2 changes: 1 addition & 1 deletion beetsplug/deezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def album_for_id(self, album_id):
artist_credit=self.get_artist([album_data["artist"]])[0],
artist_id=artist_id,
tracks=tracks,
albumtype=album_data["record_type"],
albumtypes=[album_data["record_type"]],
va=len(album_data["contributors"]) == 1
and artist.lower() == "various artists",
year=year,
Expand Down
9 changes: 3 additions & 6 deletions beetsplug/discogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,9 @@ def get_album_info(self, result):

# Extract information for the optional AlbumInfo fields that are
# contained on nested discogs fields.
albumtype = media = label = catalogno = labelid = None
albumtypes = media = label = catalogno = labelid = None
if result.data.get("formats"):
albumtype = (
", ".join(result.data["formats"][0].get("descriptions", []))
or None
)
albumtypes = result.data["formats"][0].get("descriptions", [])
media = result.data["formats"][0]["name"]
if result.data.get("labels"):
label = result.data["labels"][0].get("name")
Expand Down Expand Up @@ -459,7 +456,7 @@ def get_album_info(self, result):
artist=artist,
artist_id=artist_id,
tracks=tracks,
albumtype=albumtype,
albumtypes=albumtypes,
va=va,
year=year,
label=label,
Expand Down
2 changes: 1 addition & 1 deletion beetsplug/spotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def album_for_id(self, album_id):
artist_id=artist_id,
spotify_artist_id=artist_id,
tracks=tracks,
albumtype=album_data["album_type"],
albumtypes=[album_data["album_type"]],
va=len(album_data["artists"]) == 1
and artist.lower() == "various artists",
year=year,
Expand Down
Loading