From c90ca1096c0dde4ca88bfdb4d4963b7b7cddc8d6 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 23 Nov 2015 17:30:09 -0800 Subject: [PATCH] fetchart: Log reasons for rejecting art --- beetsplug/fetchart.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 333d29a89..1b2089b58 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -528,6 +528,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin): # get_size returns None if no local imaging backend is available size = ArtResizer.shared.get_size(candidate) + self._log.debug('image size: {}', size) if not size: self._log.warning(u'Could not get size of image (please see ' @@ -536,12 +537,25 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin): u'`enforce_ratio` may be violated.') return CANDIDATE_EXACT - if (not self.minwidth or size[0] >= self.minwidth) and ( - not self.enforce_ratio or size[0] == size[1]): - if not self.maxwidth or size[0] > self.maxwidth: - return CANDIDATE_DOWNSCALE - return CANDIDATE_EXACT - return CANDIDATE_BAD + # Check minimum size. + if self.minwidth and size[0] < self.minwidth: + self._log.debug('image too small ({} < {})', + size[0], self.minwidth) + return CANDIDATE_BAD + + # Check aspect ratio. + if self.enforce_ratio and size[0] != size[1]: + self._log.debug('image is not square ({} != {})', + size[0], size[1]) + return CANDIDATE_BAD + + # Check maximum size. + if self.maxwidth and size[0] > self.maxwidth: + self._log.debug('image needs resizing ({} > {})', + size[0], self.maxwidth) + return CANDIDATE_DOWNSCALE + + return CANDIDATE_EXACT def art_for_album(self, album, paths, local_only=False): """Given an Album object, returns a path to downloaded art for the