From 19dcc25a93689883d6b210e831af722eda16ff05 Mon Sep 17 00:00:00 2001 From: reiv Date: Tue, 3 Nov 2015 02:19:47 +0100 Subject: [PATCH] fetchart: Improve validation of image dimensions This avoids images being resized unnecessarily if the dimensions are correct. --- beetsplug/fetchart.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 9da781e6c..df0eb84ac 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -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