Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base.py for issue #182, #186 #183

Merged
merged 3 commits into from
Jun 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions modules/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ def image(self, filename):
args = [
'convert',
filename + '[0]',
'-resize',
'%dx%d' % (self.width, self.height),
'-background',
'black',
'-gravity',
Expand Down
6 changes: 4 additions & 2 deletions services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups

tries += 1
logging.warning('Retrying again, attempt #%d', tries)

Expand Down