Skip to content

Commit

Permalink
set target directory before postprocessor init (fixes #126)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 21, 2018
1 parent 9e188f6 commit 13cb270
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gallery_dl/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ def handle_urllist(self, urls, keywords):
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:
Expand Down Expand Up @@ -283,9 +284,11 @@ def get_downloader(self, scheme):
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)
Expand Down

0 comments on commit 13cb270

Please sign in to comment.