mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 11:02:43 +01:00
fetchart: Improve validation of image dimensions
This avoids images being resized unnecessarily if the dimensions are correct.
This commit is contained in:
parent
93009911e0
commit
19dcc25a93
1 changed files with 3 additions and 3 deletions
|
|
@ -519,7 +519,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
|
|||
if not candidate:
|
||||
return CANDIDATE_BAD
|
||||
|
||||
if not (self.enforce_ratio or self.minwidth):
|
||||
if not (self.enforce_ratio or self.minwidth or self.maxwidth):
|
||||
return CANDIDATE_EXACT
|
||||
|
||||
# get_size returns None if no local imaging backend is available
|
||||
|
|
@ -532,9 +532,9 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
|
|||
u'`enforce_ratio` may be violated.')
|
||||
return CANDIDATE_EXACT
|
||||
|
||||
if size[0] >= self.minwidth and (
|
||||
if (not self.minwidth or size[0] >= self.minwidth) and (
|
||||
not self.enforce_ratio or size[0] == size[1]):
|
||||
if size[0] > self.maxwidth:
|
||||
if not self.maxwidth or size[0] > self.maxwidth:
|
||||
return CANDIDATE_DOWNSCALE
|
||||
return CANDIDATE_EXACT
|
||||
return CANDIDATE_BAD
|
||||
|
|
|
|||
Loading…
Reference in a new issue