From 2aa7dce4a42feb5cd3ceb9324e58da524cdb4b6f Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Wed, 20 May 2020 12:19:13 +0530 Subject: [PATCH] Derive download directory from filename itself In some cases when using `-f` to create sub-directories from metadata, where the full slugified download filename and the non-slugified download directory happen to differ, the download would fail. This happens because the directory the track needs to be downloaded doesn't get created. With this, the download directory will now be derived from filename itself so that the sub-directory name always overlaps. Fixes #727. --- spotdl/command_line/core.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/spotdl/command_line/core.py b/spotdl/command_line/core.py index 24b1fbf..affac39 100644 --- a/spotdl/command_line/core.py +++ b/spotdl/command_line/core.py @@ -261,16 +261,7 @@ class Spotdl: if not self.arguments["no_metadata"]: metadata["lyrics"].start() - filter_space_chars = self.output_filename_filter(not self.arguments["no_spaces"]) - directory = os.path.dirname( - spotdl.metadata.format_string( - self.arguments["output_file"], - metadata, - output_extension=output_extension, - sanitizer=filter_space_chars - ) - ) - os.makedirs(directory or ".", exist_ok=True) + os.makedirs(os.path.dirname(filename) or ".", exist_ok=True) logger.info('Downloading to "{filename}"'.format(filename=filename)) if self.arguments["no_encode"]: