[common] pass job status to 'finalize()'
This commit is contained in:
@@ -103,7 +103,7 @@ class Extractor():
|
||||
self._init()
|
||||
self.initialize = util.noop
|
||||
|
||||
def finalize(self):
|
||||
def finalize(self, status):
|
||||
pass
|
||||
|
||||
def items(self):
|
||||
|
||||
@@ -150,8 +150,8 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
|
||||
self.fallback_retries = self.config("fallback-retries", 2)
|
||||
self.original = self.config("original", True)
|
||||
|
||||
def finalize(self):
|
||||
if not self.data:
|
||||
def finalize(self, status):
|
||||
if not status or not self.data:
|
||||
return
|
||||
|
||||
if self.mpv:
|
||||
|
||||
@@ -122,8 +122,8 @@ class InstagramExtractor(Extractor):
|
||||
def posts(self):
|
||||
return ()
|
||||
|
||||
def finalize(self):
|
||||
if self._cursor:
|
||||
def finalize(self, status):
|
||||
if status and self._cursor:
|
||||
self.log.info("Use '-o cursor=%s' to continue downloading "
|
||||
"from the current position", self._cursor)
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ class PatreonExtractor(Extractor):
|
||||
else:
|
||||
self.log.debug("skipping %s (%s %s)", url, fhash, kind)
|
||||
|
||||
def finalize(self):
|
||||
if self._cursor:
|
||||
def finalize(self, status):
|
||||
if status and self._cursor:
|
||||
self.log.info("Use '-o cursor=%s' to continue downloading "
|
||||
"from the current position", self._cursor)
|
||||
|
||||
|
||||
@@ -672,8 +672,8 @@ class TwitterExtractor(Extractor):
|
||||
def tweets(self):
|
||||
"""Yield all relevant tweet objects"""
|
||||
|
||||
def finalize(self):
|
||||
if self._cursor:
|
||||
def finalize(self, status):
|
||||
if status and self._cursor:
|
||||
self.log.info("Use '-o cursor=%s' to continue downloading "
|
||||
"from the current position", self._cursor)
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ class VkExtractor(Extractor):
|
||||
def _init(self):
|
||||
self.offset = text.parse_int(self.config("offset"))
|
||||
|
||||
def finalize(self):
|
||||
if self.offset:
|
||||
def finalize(self, status):
|
||||
if status and self.offset:
|
||||
self.log.info("Use '-o offset=%s' to continue downloading "
|
||||
"from the current position", self.offset)
|
||||
|
||||
|
||||
@@ -198,11 +198,11 @@ class Job():
|
||||
if msg is None:
|
||||
log.info("No results for %s", extractor.url)
|
||||
finally:
|
||||
if extractor.status:
|
||||
self.status |= extractor.status
|
||||
self.handle_finalize()
|
||||
extractor.finalize()
|
||||
extractor.finalize(self.status)
|
||||
|
||||
if s := extractor.status:
|
||||
self.status |= s
|
||||
return self.status
|
||||
|
||||
def dispatch(self, messages):
|
||||
|
||||
Reference in New Issue
Block a user