add '-s/--simulate' to run data extraction without download
Useful for quick testing (even though -g and -j kind of do the same) and to fill a download archive without actually downloading the files. -s does the same as the default behaviour, except downloading stuff. Maybe it should get a more fitting name, as it does actually write to disk (cache, archive)?
This commit is contained in:
@@ -209,7 +209,7 @@ class DownloadJob(Job):
|
||||
|
||||
def handle_queue(self, url, keywords):
|
||||
try:
|
||||
DownloadJob(url, self).run()
|
||||
self.__class__(url, self).run()
|
||||
except exception.NoExtractorError:
|
||||
self._write_unsupported(url)
|
||||
|
||||
@@ -227,6 +227,18 @@ class DownloadJob(Job):
|
||||
return instance
|
||||
|
||||
|
||||
class SimulationJob(DownloadJob):
|
||||
"""Simulate the extraction process without downloading anything"""
|
||||
|
||||
def handle_url(self, url, keywords, fallback=None):
|
||||
self.pathfmt.set_keywords(keywords)
|
||||
self.out.skip(self.pathfmt.path)
|
||||
if self.sleep:
|
||||
time.sleep(self.sleep)
|
||||
if self.archive:
|
||||
self.archive.add(keywords)
|
||||
|
||||
|
||||
class KeywordJob(Job):
|
||||
"""Print available keywords"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user