diff --git a/src/core/ytsage_downloader.py b/src/core/ytsage_downloader.py index cf7b029..a980e9f 100644 --- a/src/core/ytsage_downloader.py +++ b/src/core/ytsage_downloader.py @@ -88,7 +88,6 @@ class DownloadThread(QThread): self.paused = False self.cancelled = False self.process = None - self.use_direct_command = True # Flag to use direct CLI command instead of Python API self.last_output_time = time.time() self.timeout_timer = None self.current_filename = None # Initialize filename storage @@ -317,12 +316,8 @@ class DownloadThread(QThread): except Exception as e: logger.exception(f"Error scanning for initial subtitle files: {e}") - if self.use_direct_command: - # Use direct CLI command instead of Python API - self._run_direct_command() - else: - # Original method using Python API - code left for reference - self._run_python_api() + # Use direct CLI command + self._run_direct_command() except Exception as e: # Catch errors during setup @@ -664,11 +659,6 @@ class DownloadThread(QThread): self.update_details.emit("") # Clear details label on completion - def _run_python_api(self) -> None: - """Original download method using Python API - kept for reference.""" - # The existing run method code using yt_dlp.YoutubeDL starts here - # This method is no longer used by default - def pause(self) -> None: self.paused = True diff --git a/src/core/ytsage_style.py b/src/core/ytsage_style.py deleted file mode 100644 index 2981218..0000000 --- a/src/core/ytsage_style.py +++ /dev/null @@ -1,204 +0,0 @@ -MAIN_STYLE = """ -QMainWindow { - background-color: #15181b; -} -QWidget { - background-color: #15181b; - color: #ffffff; - font-size: 12px; -} -QLineEdit { - padding: 8px; - border: 2px solid #1b2021; - border-radius: 4px; - background-color: #1b2021; - color: #ffffff; - selection-background-color: #c90000; - selection-color: #ffffff; -} -QPushButton { - padding: 8px 15px; - background-color: #c90000; - border: none; - border-radius: 4px; - color: white; - font-weight: bold; - min-height: 20px; -} -QPushButton:hover { - background-color: #a50000; -} -QPushButton:pressed { - background-color: #800000; -} -QPushButton:disabled { - background-color: #666666; - color: #999999; -} -QTableWidget { - border: 2px solid #1b2021; - border-radius: 4px; - background-color: #1b2021; - gridline-color: #1b2021; - selection-background-color: #c90000; - selection-color: #ffffff; -} -QHeaderView::section { - background-color: #15181b; - padding: 5px; - border: 1px solid #1b2021; - color: #ffffff; - font-weight: bold; -} -QScrollBar:vertical { - border: none; - background-color: #15181b; - width: 12px; - margin: 0px; -} -QScrollBar::handle:vertical { - background-color: #666666; - min-height: 20px; - border-radius: 6px; -} -QScrollBar::handle:vertical:hover { - background-color: #c90000; -} -QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { - height: 0px; -} -QProgressBar { - border: 2px solid #1b2021; - border-radius: 4px; - text-align: center; - color: white; - background-color: #1b2021; -} -QProgressBar::chunk { - background-color: #c90000; - border-radius: 2px; -} -QComboBox { - padding: 8px; - border: 2px solid #1b2021; - border-radius: 4px; - background-color: #1b2021; - color: #ffffff; - min-height: 20px; -} -QComboBox:hover { - border: 2px solid #c90000; -} -QComboBox:focus { - border: 2px solid #c90000; -} -QComboBox::drop-down { - border: none; - width: 30px; - background-color: #1b2021; - border-radius: 0 4px 4px 0; -} -QComboBox::drop-down:hover { - background-color: #c90000; -} -QComboBox::down-arrow { - width: 0; - height: 0; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-top: 8px solid #ffffff; - margin: auto; -} -QComboBox QAbstractItemView { - border: 2px solid #1b2021; - border-radius: 4px; - background-color: #1b2021; - color: #ffffff; - selection-background-color: #c90000; - selection-color: #ffffff; - outline: none; -} -QComboBox QAbstractItemView::item { - height: 30px; - padding: 5px; - border: none; - background-color: #1b2021; - color: #ffffff; -} -QComboBox QAbstractItemView::item:hover { - background-color: #c90000; - color: #ffffff; -} -QComboBox QAbstractItemView::item:selected { - background-color: #c90000; - color: #ffffff; -} -QCheckBox { - spacing: 5px; - color: #ffffff; -} -QCheckBox::indicator { - width: 18px; - height: 18px; - border-radius: 9px; -} -QCheckBox::indicator:unchecked { - border: 2px solid #666666; - background: #15181b; -} -QCheckBox::indicator:checked { - border: 2px solid #c90000; - background: #c90000; -} -QRadioButton { - spacing: 5px; - color: #ffffff; -} -QRadioButton::indicator { - width: 18px; - height: 18px; - border-radius: 9px; -} -QRadioButton::indicator:unchecked { - border: 2px solid #666666; - background: #15181b; -} -QRadioButton::indicator:checked { - border: 2px solid #c90000; - background: #c90000; -} -QLabel { - color: #ffffff; -} -QGroupBox { - color: #ffffff; - border: 2px solid #1b2021; - border-radius: 4px; - margin-top: 1ex; - padding-top: 10px; -} -QGroupBox::title { - subcontrol-origin: margin; - left: 10px; - padding: 0 5px 0 5px; - color: #c90000; - font-weight: bold; -} -QTextEdit, QPlainTextEdit { - background-color: #1b2021; - color: #ffffff; - border: 2px solid #1b2021; - border-radius: 4px; - selection-background-color: #c90000; - selection-color: #ffffff; -} -QMessageBox { - background-color: #15181b; -} -QMessageBox QLabel { - color: #ffffff; -} -QMessageBox QPushButton { - min-width: 80px; -} -""" diff --git a/src/core/ytsage_utils.py b/src/core/ytsage_utils.py index c5e8e9b..c1e2241 100644 --- a/src/core/ytsage_utils.py +++ b/src/core/ytsage_utils.py @@ -825,33 +825,3 @@ def validate_video_url(url: str) -> tuple[bool, str]: logger.info(f"YouTube URL doesn't match known patterns but allowing: {url}") return True, "" - -def sanitize_filename(filename: str) -> str: - """ - Sanitize a filename by removing or replacing dangerous characters. - - Args: - filename: The filename to sanitize - - Returns: - str: Sanitized filename safe for filesystem use - - Example: - >>> sanitize_filename('video<>file?.mp4') - 'video__file_.mp4' - """ - import re - - # Replace dangerous characters with underscore - # Characters not allowed in Windows filenames: < > : " / \ | ? * - # Also remove control characters - sanitized = re.sub(r'[<>:"/\\|?*\x00-\x1f]', '_', filename) - - # Remove leading/trailing dots and spaces (Windows compatibility) - sanitized = sanitized.strip('. ') - - # Ensure filename is not empty after sanitization - if not sanitized: - sanitized = "video" - - return sanitized diff --git a/src/gui/ytsage_gui_main.py b/src/gui/ytsage_gui_main.py index 747c655..f1c6049 100644 --- a/src/gui/ytsage_gui_main.py +++ b/src/gui/ytsage_gui_main.py @@ -51,16 +51,6 @@ from src.utils.ytsage_config_manager import ConfigManager from src.utils.ytsage_localization import LocalizationManager, _ from src.utils.ytsage_history_manager import HistoryManager -# Note: yt-dlp Python package removed - using binary-only approach -# DownloadError and ExtractorError definitions kept for compatibility -class DownloadError(Exception): - """Compatibility class for yt-dlp DownloadError""" - pass - -class ExtractorError(Exception): - """Compatibility class for yt-dlp ExtractorError""" - pass - class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from mixins def __init__(self) -> None: