1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

set target directory before postprocessor init (fixes #126)

This commit is contained in:
Mike Fährmann 2018-11-21 22:21:26 +01:00
parent 9e188f6a21
commit 13cb270326
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -235,8 +235,9 @@ class DownloadJob(Job):
def handle_directory(self, keywords):
"""Set and create the target directory for downloads"""
if not self.pathfmt:
self.initialize()
self.pathfmt.set_directory(keywords)
self.initialize(keywords)
else:
self.pathfmt.set_directory(keywords)
def handle_queue(self, url, keywords):
try:
@ -283,9 +284,11 @@ class DownloadJob(Job):
self.downloaders[scheme] = instance
return instance
def initialize(self):
def initialize(self, keywords=None):
"""Delayed initialization of PathFormat, etc."""
self.pathfmt = util.PathFormat(self.extractor)
if keywords:
self.pathfmt.set_directory(keywords)
self.sleep = self.extractor.config("sleep")
skip = self.extractor.config("skip", True)