Include video id in default filename format
Add video id to the default output filename template across the downloader and settings UI. The template was changed from "%(title)s_%(resolution)s.%(ext)s" to "%(title)s_%(resolution)s_[%(id)s].%(ext)s" in ytsage_downloader.py and ytsage_dialogs_settings.py (including placeholder and reset behavior). This helps avoid filename collisions and makes downloaded files easier to identify.
This commit is contained in:
@@ -302,7 +302,7 @@ class DownloadThread(QThread):
|
|||||||
base_path: str = self.path.as_posix()
|
base_path: str = self.path.as_posix()
|
||||||
|
|
||||||
# Determine the filename part of the template
|
# Determine the filename part of the template
|
||||||
filename_part = self.filename_format if self.filename_format else "%(title)s_%(resolution)s.%(ext)s"
|
filename_part = self.filename_format if self.filename_format else "%(title)s_%(resolution)s_[%(id)s].%(ext)s"
|
||||||
|
|
||||||
if self.is_playlist:
|
if self.is_playlist:
|
||||||
# Create output template with playlist subfolder
|
# Create output template with playlist subfolder
|
||||||
|
|||||||
@@ -387,18 +387,18 @@ class DownloadSettingsDialog(QDialog):
|
|||||||
filename_layout = QVBoxLayout()
|
filename_layout = QVBoxLayout()
|
||||||
|
|
||||||
# Load current filename format from ConfigManager
|
# Load current filename format from ConfigManager
|
||||||
self.filename_format_value = ConfigManager.get("filename_format") or "%(title)s_%(resolution)s.%(ext)s"
|
self.filename_format_value = ConfigManager.get("filename_format") or "%(title)s_%(resolution)s_[%(id)s].%(ext)s"
|
||||||
|
|
||||||
# Input and Reset Button Layout
|
# Input and Reset Button Layout
|
||||||
filename_input_layout = QHBoxLayout()
|
filename_input_layout = QHBoxLayout()
|
||||||
|
|
||||||
self.filename_format_input = QLineEdit(self.filename_format_value)
|
self.filename_format_input = QLineEdit(self.filename_format_value)
|
||||||
self.filename_format_input.setPlaceholderText("%(title)s_%(resolution)s.%(ext)s")
|
self.filename_format_input.setPlaceholderText("%(title)s_%(resolution)s_[%(id)s].%(ext)s")
|
||||||
filename_input_layout.addWidget(self.filename_format_input)
|
filename_input_layout.addWidget(self.filename_format_input)
|
||||||
|
|
||||||
self.reset_format_button = QPushButton(_("buttons.reset"))
|
self.reset_format_button = QPushButton(_("buttons.reset"))
|
||||||
self.reset_format_button.setFixedWidth(70)
|
self.reset_format_button.setFixedWidth(70)
|
||||||
self.reset_format_button.clicked.connect(lambda: self.filename_format_input.setText("%(title)s_%(resolution)s.%(ext)s"))
|
self.reset_format_button.clicked.connect(lambda: self.filename_format_input.setText("%(title)s_%(resolution)s_[%(id)s].%(ext)s"))
|
||||||
filename_input_layout.addWidget(self.reset_format_button)
|
filename_input_layout.addWidget(self.reset_format_button)
|
||||||
|
|
||||||
filename_layout.addLayout(filename_input_layout)
|
filename_layout.addLayout(filename_input_layout)
|
||||||
|
|||||||
Reference in New Issue
Block a user