From abef0d8a6dbe815ec1ff46f76e8e8e92959d2388 Mon Sep 17 00:00:00 2001 From: oop7 <110548351+oop7@users.noreply.github.com> Date: Fri, 1 May 2026 16:29:28 +0300 Subject: [PATCH] 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. --- ytsage/core/ytsage_downloader.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ytsage/core/ytsage_downloader.py b/ytsage/core/ytsage_downloader.py index 6f5b7b2..941c930 100644 --- a/ytsage/core/ytsage_downloader.py +++ b/ytsage/core/ytsage_downloader.py @@ -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)])