@@ -91,7 +91,7 @@ def sanitize_directory_name(directory_name: str) -> str:
9191 """
9292 invalid_chars_dict = {
9393 "nt" : r'[\\/:*?"<>|]' , # Windows
94- "posix" : r"[/:]" , # macOS and Linux
94+ "posix" : r"[/:]" , # macOS and Linux
9595 }
9696 invalid_chars = invalid_chars_dict .get (os .name )
9797 return re .sub (invalid_chars , "_" , directory_name )
@@ -100,6 +100,8 @@ def sanitize_directory_name(directory_name: str) -> str:
100100def create_download_directory (
101101 directory_name : str ,
102102 custom_path : str | None = None ,
103+ * ,
104+ no_download_folder : bool = False ,
103105) -> str :
104106 """Create a directory for downloads if it doesn't exist."""
105107 # Sanitizing the directory name (album ID), if provided
@@ -108,9 +110,9 @@ def create_download_directory(
108110 )
109111
110112 # Determine the base download path.
111- base_path = (
112- Path ( custom_path ) / DOWNLOAD_FOLDER if custom_path else Path ( DOWNLOAD_FOLDER )
113- )
113+ base_path = Path ( custom_path or "." ) # default to current directory
114+ if not no_download_folder :
115+ base_path /= DOWNLOAD_FOLDER # append DOWNLOAD_FOLDER only if needed
114116
115117 # Albums containing a single file will be directly downloaded into the 'Downloads'
116118 # folder, without creating a subfolder for the album ID.
@@ -143,7 +145,7 @@ def create_urls_file_backup() -> None:
143145 sys .exit (1 )
144146
145147 timestamp = datetime .now (timezone .utc ).strftime ("%d%m%Y_%H%M%S" )
146- backup_file = Path (f"URLs_{ timestamp } .txt. bak" )
148+ backup_file = Path (f"URLs_{ timestamp } .bak" )
147149 shutil .copy2 (URLS_FILE , backup_folder / backup_file )
148150
149151
0 commit comments