Merge pull request #4677 from trolley/topic/fix-fetchart-suffix

Fix cover art archive fetching
This commit is contained in:
Adrian Sampson 2023-02-17 18:56:25 -08:00 committed by GitHub
commit c4b7bdfb70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -367,7 +367,7 @@ class CoverArtArchive(RemoteArtSource):
ID.
"""
def get_image_urls(url, size_suffix=None):
def get_image_urls(url, preferred_width=None):
try:
response = self.request(url)
except requests.RequestException:
@ -387,8 +387,8 @@ class CoverArtArchive(RemoteArtSource):
if 'Front' not in item['types']:
continue
if size_suffix:
yield item['thumbnails'][size_suffix]
if preferred_width:
yield item['thumbnails'][preferred_width]
else:
yield item['image']
except KeyError:
@ -401,12 +401,12 @@ class CoverArtArchive(RemoteArtSource):
# If the maxwidth config matches one of the already available sizes
# fetch it directly intead of fetching the full sized image and
# resizing it.
size_suffix = None
preferred_width = None
if plugin.maxwidth in self.VALID_THUMBNAIL_SIZES:
size_suffix = "-" + str(plugin.maxwidth)
preferred_width = str(plugin.maxwidth)
if 'release' in self.match_by and album.mb_albumid:
for url in get_image_urls(release_url, size_suffix):
for url in get_image_urls(release_url, preferred_width):
yield self._candidate(url=url, match=Candidate.MATCH_EXACT)
if 'releasegroup' in self.match_by and album.mb_releasegroupid:

View file

@ -60,6 +60,8 @@ New features:
Bug fixes:
* :doc:`/plugins/fetchart`: Fix fetching from Cover Art Archive when the
`maxwidth` option is set to one of the supported Cover Art Archive widths.
* :doc:`/plugins/discogs`: Fix "Discogs plugin replacing Feat. or Ft. with
a comma" by fixing an oversight that removed a functionality from the code
base when the MetadataSourcePlugin abstract class was introduced in PR's