Merge pull request #3463 from mathieupinet/fetchart_highresolution

fetchart: New high_resolution config option (#3391)
This commit is contained in:
Adrian Sampson 2019-12-26 20:43:51 -05:00
commit f0eede2ab4
3 changed files with 18 additions and 3 deletions

View file

@ -505,12 +505,18 @@ class ITunesStore(RemoteArtSource):
payload['term'])
return
if self._config['high_resolution'].get():
image_suffix = '100000x100000-999'
else:
image_suffix = '1200x1200bb'
for c in candidates:
try:
if (c['artistName'] == album.albumartist
and c['collectionName'] == album.album):
art_url = c['artworkUrl100']
art_url = art_url.replace('100x100', '1200x1200')
art_url = art_url.replace('100x100bb',
image_suffix)
yield self._candidate(url=art_url,
match=Candidate.MATCH_EXACT)
except KeyError as e:
@ -520,7 +526,8 @@ class ITunesStore(RemoteArtSource):
try:
fallback_art_url = candidates[0]['artworkUrl100']
fallback_art_url = fallback_art_url.replace('100x100', '1200x1200')
fallback_art_url = fallback_art_url.replace('100x100bb',
image_suffix)
yield self._candidate(url=fallback_art_url,
match=Candidate.MATCH_FALLBACK)
except KeyError as e:
@ -774,6 +781,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
'google_engine': u'001442825323518660753:hrh5ch1gjzm',
'fanarttv_key': None,
'store_source': False,
'high_resolution': False,
})
self.config['google_key'].redact = True
self.config['fanarttv_key'].redact = True

View file

@ -6,7 +6,11 @@ Changelog
New features:
* :doc:`plugins/discogs` now adds two extra fields: `discogs_labelid` and
* :doc:`plugins/fetchart`: Added a new ``high_resolution`` config option to
allow downloading of higher resolution iTunes artwork (at the expense of
file size).
:bug: `3391`
* :doc:`plugins/discogs` now adds two extra fields: `discogs_labelid` and
`discogs_artistid`
:bug: `3413`
* :doc:`/plugins/export`: Added new ``-f`` (``--format``) flag;

View file

@ -67,6 +67,9 @@ file. The available options are:
- **store_source**: If enabled, fetchart stores the artwork's source in a
flexible tag named ``art_source``. See below for the rationale behind this.
Default: ``no``.
- **high_resolution**: If enabled, fetchart retrieves artwork in the highest
resolution it can find (warning: image files can sometimes reach >20MB).
Default: ``no``.
Note: ``maxwidth`` and ``enforce_ratio`` options require either `ImageMagick`_
or `Pillow`_.