mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Use images attr over cover_image
This commit is contained in:
parent
e9574bdc21
commit
3e06ca2af4
1 changed files with 13 additions and 3 deletions
|
|
@ -413,7 +413,7 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
|
||||
# Extract information for the optional AlbumInfo fields that are
|
||||
# contained on nested discogs fields.
|
||||
albumtype = media = label = catalogno = labelid = cover_art_url = None
|
||||
albumtype = media = label = catalogno = labelid = None
|
||||
if result.data.get("formats"):
|
||||
albumtype = (
|
||||
", ".join(result.data["formats"][0].get("descriptions", []))
|
||||
|
|
@ -424,8 +424,8 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
label = result.data["labels"][0].get("name")
|
||||
catalogno = result.data["labels"][0].get("catno")
|
||||
labelid = result.data["labels"][0].get("id")
|
||||
if result.data.get("cover_image"):
|
||||
cover_art_url = result.data.get("cover_image")
|
||||
|
||||
cover_art_url = self.select_cover_art(result)
|
||||
|
||||
# Additional cleanups (various artists name, catalog number, media).
|
||||
if va:
|
||||
|
|
@ -479,6 +479,16 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
cover_art_url=cover_art_url
|
||||
)
|
||||
|
||||
def select_cover_art(self, result):
|
||||
"""Returns the best candidate image, if any, from a Discogs `Release` object."""
|
||||
if result.data.get("images") and len(result.data.get("images")) > 0:
|
||||
# The first image in this list appears to be the one displayed first
|
||||
# on the release page - even if it is not flagged as `type: "primary"` - and
|
||||
# so it is the best candidate for the cover art.
|
||||
return result.data.get("images")[0].get("uri")
|
||||
|
||||
return None
|
||||
|
||||
def format(self, classification):
|
||||
if classification:
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue