Strip playlist_index placeholder for single files
When building the output template for single-file downloads, remove any playlist-specific preamble (e.g. '%(playlist_index)s - ') from filename_part. Adds a regex-based substitution to clean up leftover playlist_index placeholders so single downloads don't get playlist-style prefixes in their filenames.
This commit is contained in:
@@ -330,6 +330,9 @@ class DownloadThread(QThread):
|
||||
# Create output template with playlist subfolder
|
||||
output_template: str = f"{base_path}/%(playlist_title)s/{filename_part}"
|
||||
else:
|
||||
# For single files, automatically ignore/remove playlist-specific preamble (like "%(playlist_index)s - ")
|
||||
import re
|
||||
filename_part = re.sub(r'%\(playlist_index[^)]*\)[a-zA-Z0-9]*\s*(?:[-_]\s*)?', '', filename_part)
|
||||
output_template: str = f"{base_path}/{filename_part}"
|
||||
|
||||
cmd.extend(["-o", str(output_template)])
|
||||
|
||||
Reference in New Issue
Block a user