From 0f1538af78b22c94de752510f1480d6e3022cfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 29 Nov 2019 22:32:07 +0100 Subject: [PATCH] split filename formatting into its own function --- gallery_dl/util.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 854ad5c8..98edb903 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -670,17 +670,17 @@ class PathFormat(): self.temppath = self.realpath = self.realpath[:-1] return True - def build_path(self): - """Use filename metadata and directory to build a full path""" - - # Apply 'kwdict' to filename format string + def build_filename(self): + """Apply 'kwdict' to filename format string""" try: - self.filename = filename = self.clean_path(self.clean_segment( + return self.clean_path(self.clean_segment( self.filename_formatter(self.kwdict))) except Exception as exc: raise exception.FilenameFormatError(exc) - # Combine directory and filename to full paths + def build_path(self): + """Combine directory and filename to full paths""" + self.filename = filename = self.build_filename() self.path = self.directory + filename self.realpath = self.realdirectory + filename if not self.temppath: