mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 09:50:16 +00:00
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.
This commit is contained in:
@@ -261,16 +261,7 @@ class Spotdl:
|
|||||||
if not self.arguments["no_metadata"]:
|
if not self.arguments["no_metadata"]:
|
||||||
metadata["lyrics"].start()
|
metadata["lyrics"].start()
|
||||||
|
|
||||||
filter_space_chars = self.output_filename_filter(not self.arguments["no_spaces"])
|
os.makedirs(os.path.dirname(filename) or ".", exist_ok=True)
|
||||||
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)
|
|
||||||
|
|
||||||
logger.info('Downloading to "{filename}"'.format(filename=filename))
|
logger.info('Downloading to "{filename}"'.format(filename=filename))
|
||||||
if self.arguments["no_encode"]:
|
if self.arguments["no_encode"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user