Add plugin option to store cover art non-progressive.

This commit is contained in:
Piotrek Kochański 2021-08-25 22:56:46 +02:00
parent c6e05e8ab7
commit 0a0719f9ed

View file

@ -52,6 +52,7 @@ class Candidate(object):
CANDIDATE_EXACT = 1
CANDIDATE_DOWNSCALE = 2
CANDIDATE_DOWNSIZE = 3
CANDIDATE_DEINTERLACE = 4
MATCH_EXACT = 0
MATCH_FALLBACK = 1
@ -80,7 +81,7 @@ class Candidate(object):
return self.CANDIDATE_BAD
if (not (plugin.enforce_ratio or plugin.minwidth or plugin.maxwidth
or plugin.max_filesize)):
or plugin.max_filesize or plugin.deinterlace)):
return self.CANDIDATE_EXACT
# get_size returns None if no local imaging backend is available
@ -147,6 +148,8 @@ class Candidate(object):
return self.CANDIDATE_DOWNSCALE
elif downsize:
return self.CANDIDATE_DOWNSIZE
elif plugin.deinterlace:
return self.CANDIDATE_DEINTERLACE
else:
return self.CANDIDATE_EXACT
@ -159,13 +162,18 @@ class Candidate(object):
self.path = \
ArtResizer.shared.resize(plugin.maxwidth, self.path,
quality=plugin.quality,
max_filesize=plugin.max_filesize)
max_filesize=plugin.max_filesize,
deinterlace=plugin.deinterlace)
elif self.check == self.CANDIDATE_DOWNSIZE:
# dimensions are correct, so maxwidth is set to maximum dimension
self.path = \
ArtResizer.shared.resize(max(self.size), self.path,
quality=plugin.quality,
max_filesize=plugin.max_filesize)
max_filesize=plugin.max_filesize,
deinterlace=plugin.deinterlace)
elif self.check == self.CANDIDATE_DEINTERLACE:
self.path = \
ArtResizer.shared.deinterlace(self.path)
def _logged_get(log, *args, **kwargs):
@ -932,6 +940,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
'lastfm_key': None,
'store_source': False,
'high_resolution': False,
'deinterlace': False,
})
self.config['google_key'].redact = True
self.config['fanarttv_key'].redact = True
@ -949,6 +958,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
confuse.String(pattern=self.PAT_PERCENT)]))
self.margin_px = None
self.margin_percent = None
self.deinterlace = self.config['deinterlace'].get(bool)
if type(self.enforce_ratio) is six.text_type:
if self.enforce_ratio[-1] == u'%':
self.margin_percent = float(self.enforce_ratio[:-1]) / 100