mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-11-22 02:55:25 +01:00
Added the ability to create a folder hierarchy
This commit is contained in:
parent
3c1be30780
commit
7d9d80e946
@ -3,7 +3,7 @@ import os
|
|||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from pathvalidate import sanitize_filename
|
from pathvalidate import sanitize_filename, sanitize_filepath
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
import qobuz_dl.metadata as metadata
|
import qobuz_dl.metadata as metadata
|
||||||
@ -97,7 +97,7 @@ class Download:
|
|||||||
folder_format, track_format = _clean_format_str(
|
folder_format, track_format = _clean_format_str(
|
||||||
self.folder_format, self.track_format, file_format
|
self.folder_format, self.track_format, file_format
|
||||||
)
|
)
|
||||||
sanitized_title = sanitize_filename(folder_format.format(**album_attr))
|
sanitized_title = sanitize_filepath(folder_format.format(**album_attr))
|
||||||
dirn = os.path.join(self.path, sanitized_title)
|
dirn = os.path.join(self.path, sanitized_title)
|
||||||
os.makedirs(dirn, exist_ok=True)
|
os.makedirs(dirn, exist_ok=True)
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ class Download:
|
|||||||
track_attr = self._get_track_attr(
|
track_attr = self._get_track_attr(
|
||||||
meta, track_title, bit_depth, sampling_rate
|
meta, track_title, bit_depth, sampling_rate
|
||||||
)
|
)
|
||||||
sanitized_title = sanitize_filename(folder_format.format(**track_attr))
|
sanitized_title = sanitize_filepath(folder_format.format(**track_attr))
|
||||||
|
|
||||||
dirn = os.path.join(self.path, sanitized_title)
|
dirn = os.path.join(self.path, sanitized_title)
|
||||||
os.makedirs(dirn, exist_ok=True)
|
os.makedirs(dirn, exist_ok=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user