From af9881a0c54392b8925c2ccc391ebfaa27b86f15 Mon Sep 17 00:00:00 2001 From: Tom Anschutz Date: Sun, 27 Jun 2021 09:00:50 -0400 Subject: [PATCH] Update base.py for issue #182, #186 (#183) * Update base.py Changed the way `sum` was computed in `getImagesTotal()` to avoid black screen with "no (new) images could be found" in the warning log. * Update display.py Fix Fill and Do Nothing image handling. * Update base.py Addresses #186 --- modules/display.py | 2 -- services/base.py | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/display.py b/modules/display.py index 0f09943..32b5a95 100755 --- a/modules/display.py +++ b/modules/display.py @@ -227,8 +227,6 @@ def image(self, filename): args = [ 'convert', filename + '[0]', - '-resize', - '%dx%d' % (self.width, self.height), '-background', 'black', '-gravity', diff --git a/services/base.py b/services/base.py index b0972d2..1a6054b 100755 --- a/services/base.py +++ b/services/base.py @@ -178,13 +178,15 @@ def getId(self): def getImagesTotal(self): # return the total number of images provided by this service + sum = 0 if self.needKeywords(): for keyword in self.getKeywords(): if keyword not in self._STATE["_NUM_IMAGES"] or keyword not in self._STATE['_NEXT_SCAN'] or self._STATE['_NEXT_SCAN'][keyword] < time.time(): logging.debug('Keywords either not scanned or we need to scan now') self._getImagesFor(keyword) # Will make sure to get images self._STATE['_NEXT_SCAN'][keyword] = time.time() + self.REFRESH_DELAY - return sum([self._STATE["_NUM_IMAGES"][k] for k in self._STATE["_NUM_IMAGES"]]) + sum = sum + self._STATE["_NUM_IMAGES"][keyword] + return sum def getImagesSeen(self): count = 0 @@ -694,7 +696,7 @@ def requestUrl(self, url, destination=None, params=None, data=None, usePost=Fals break except: logging.exception('Issues downloading') - time.sleep(tries / 10) # Back off 10, 20, ... depending on tries + time.sleep(tries * 10) # Back off 10, 20, ... depending on tries tries += 1 logging.warning('Retrying again, attempt #%d', tries)