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