Skip to content

Commit

Permalink
[pp:metadata] fix 'directory' when file directory has conditions (#5728)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jul 6, 2024
1 parent 1527ad7 commit 1656c92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions gallery_dl/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self, extractor):
raise exception.FilenameFormatError(exc)

directory_fmt = config("directory")
self.directory_conditions = ()
try:
if directory_fmt is None:
directory_fmt = extractor.directory_fmt
Expand Down
3 changes: 3 additions & 0 deletions gallery_dl/postprocessor/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,15 @@ def _directory_custom(self, pathfmt):

def _directory_format(self, pathfmt):
formatters = pathfmt.directory_formatters
conditions = pathfmt.directory_conditions
try:
pathfmt.directory_formatters = self._directory_formatters
pathfmt.directory_conditions = ()
segments = pathfmt.build_directory(pathfmt.kwdict)
directory = pathfmt.clean_path(os.sep.join(segments) + os.sep)
return os.path.join(pathfmt.realdirectory, directory)
finally:
pathfmt.directory_conditions = conditions
pathfmt.directory_formatters = formatters

def _filename(self, pathfmt):
Expand Down

0 comments on commit 1656c92

Please sign in to comment.