run queue items immediately

pull/17/head
Mike Fährmann 7 years ago
parent 691c4dd709
commit ae686c4c08
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -118,18 +118,8 @@ class DownloadJob(Job):
Job.__init__(self, url) Job.__init__(self, url)
self.pathfmt = util.PathFormat(self.extractor) self.pathfmt = util.PathFormat(self.extractor)
self.downloaders = {} self.downloaders = {}
self.queue = None
self.out = output.select() self.out = output.select()
def run(self):
Job.run(self)
if self.queue:
for url in self.queue:
try:
DownloadJob(url).run()
except exception.NoExtractorError:
pass
def handle_url(self, url, keywords): def handle_url(self, url, keywords):
"""Download the resource specified in 'url'""" """Download the resource specified in 'url'"""
self.pathfmt.set_keywords(keywords) self.pathfmt.set_keywords(keywords)
@ -144,11 +134,10 @@ class DownloadJob(Job):
self.pathfmt.set_directory(keywords) self.pathfmt.set_directory(keywords)
def handle_queue(self, url): def handle_queue(self, url):
"""Add url to work-queue"""
try: try:
self.queue.append(url) DownloadJob(url).run()
except AttributeError: except exception.NoExtractorError:
self.queue = [url] pass
def handle_headers(self, headers): def handle_headers(self, headers):
self.get_downloader("http:").set_headers(headers) self.get_downloader("http:").set_headers(headers)

Loading…
Cancel
Save