summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ0J0 Todos <2733783+JOJ0@users.noreply.github.com>2024-03-17 00:48:39 +0100
committerGitHub <noreply@github.com>2024-03-17 00:48:39 +0100
commitb09806e0df8f01b9155017d3693764ae7beedcd5 (patch)
tree4c8a275e0a9fa55ab52445a2e1ff38339bcca669
parent3548e353602b47d1dca5e1a0063d27f0b5ad3736 (diff)
parentb9ab0c98673093a087d8168add450a21407887b3 (diff)
Merge pull request #5134 from InvisibleFunction/fix-media-headers
Fix Media Headers on Import
-rw-r--r--beets/autotag/mb.py8
-rwxr-xr-xbeets/ui/commands.py10
-rw-r--r--docs/changelog.rst3
3 files changed, 15 insertions, 6 deletions
diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py
index 0bd47f1e6..d1ac7956d 100644
--- a/beets/autotag/mb.py
+++ b/beets/autotag/mb.py
@@ -595,8 +595,12 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo:
# Media (format).
if release["medium-list"]:
- first_medium = release["medium-list"][0]
- info.media = first_medium.get("format")
+ # If all media are the same, use that medium name
+ if len(set([m.get("format") for m in release["medium-list"]])) == 1:
+ info.media = release["medium-list"][0].get("format")
+ # Otherwise, let's just call it "Media"
+ else:
+ info.media = "Media"
if config["musicbrainz"]["genres"]:
sources = [
diff --git a/beets/ui/commands.py b/beets/ui/commands.py
index 87fc00782..755c148fc 100755
--- a/beets/ui/commands.py
+++ b/beets/ui/commands.py
@@ -453,14 +453,16 @@ class ChangeRepresentation(object):
def make_medium_info_line(self, track_info):
"""Construct a line with the current medium's info."""
- media = self.match.info.media or "Media"
+ track_media = track_info.get("media", "Media")
# Build output string.
if self.match.info.mediums > 1 and track_info.disctitle:
- return f"* {media} {track_info.medium}: {track_info.disctitle}"
+ return (
+ f"* {track_media} {track_info.medium}: {track_info.disctitle}"
+ )
elif self.match.info.mediums > 1:
- return f"* {media} {track_info.medium}"
+ return f"* {track_media} {track_info.medium}"
elif track_info.disctitle:
- return f"* {media}: {track_info.disctitle}"
+ return f"* {track_media}: {track_info.disctitle}"
else:
return ""
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 0b5e19577..72186603d 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -292,6 +292,9 @@ Bug fixes:
and caching in `zsh`.
:bug:`3546`
* Remove unused functions :bug:`5103`
+* Fix bug where all media types are reported as the first media type when
+ importing with MusicBrainz as the data source
+ :bug:`4947`
For plugin developers: