Commit Graph

48 Commits

Author SHA1 Message Date
oop7 83d37676ae Suppress output when killing process tree on Windows
Replaces capture_output with stdout and stderr redirected to DEVNULL in subprocess.run for taskkill, preventing codec issues and suppressing command output.
2025-11-29 14:44:39 +02:00
oop7 478daf4771 Improve process termination and file cleanup logic
Enhanced cross-platform process tree termination for downloads, using process groups on Unix and taskkill on Windows. Improved file deletion reliability by increasing retries, adding garbage collection, and adjusting backoff logic. Refactored process startup to support process group management and ensured proper resource cleanup after cancellation.
2025-11-29 14:09:05 +02:00
oop7 9d1f886305 Update subprocess to use encoding and error handling
Replaces 'text' and 'universal_newlines' parameters with 'encoding="utf-8"' and 'errors="replace"' in subprocess.Popen for improved output handling.
2025-11-29 13:58:16 +02:00
oop7 f2b6dc26cb Add audio format selection for audio-only downloads
Introduces settings and UI for forcing audio format conversion on audio-only downloads, including support for selecting preferred audio formats. Updates language files for all supported languages, adds config options, and passes new settings through the downloader and main app logic.
2025-11-17 15:23:48 +02:00
oop7 d5c3b4799b Add explicit type annotations across core modules
Introduced explicit type annotations for variables, function arguments, and return types in ytsage_downloader.py, ytsage_utils.py, and ytsage_config_manager.py. This improves code clarity, maintainability, and static analysis support.
2025-11-15 18:31:16 +02:00
oop7 9d5a2460b1 Add Deno version check and update UI
Introduces a Deno version checker and updater section to the updater tab, with localized strings in all supported languages. Adds backend functions for fetching the latest Deno version, comparing versions, and upgrading Deno, along with corresponding GUI logic for checking and updating Deno from the interface.
2025-11-14 18:44:40 +02:00
oop7 894f999017 Add Deno version detection and caching support
Introduces functions to detect Deno version directly and with caching in ytsage_deno.py and ytsage_utils.py. Updates the About dialog to display Deno status, version, and path if available. Also extends version cache refresh logic to include Deno.
2025-11-14 18:19:02 +02:00
oop7 38a8d9d29f Add Deno setup and integration to application
Introduces Deno binary management, setup dialog, and download/verification logic. Updates localization files for Deno setup messages in all supported languages. Integrates Deno setup checks into main.py and GUI initialization, and adds Deno constants for platform-specific downloads.
2025-11-14 17:58:45 +02:00
oop7 bb231ccd12 Refactor FFmpeg updater to version checker
Replaces the FFmpeg updater logic with a version checker across all supported languages and removes the updater module. The Windows installation logic in ytsage_ffmpeg.py is rewritten to use essentials build extraction and path configuration directly, removing dependency on the updater module. Dialogs and UI strings are updated to reflect the new version checking workflow and provide installation guide links.
2025-11-14 17:10:36 +02:00
oop7 b0c7616704 Add SHA256 verification for yt-dlp downloads
Introduced a function to verify the SHA256 hash of the downloaded yt-dlp binary against official checksums, improving security and integrity checks. Updated the download thread to perform hash verification after download and handle failures appropriately. Added the SHA256 checksums URL to constants.
2025-11-12 20:25:48 +02:00
oop7 2e302f1d0e Move yt-dlp auto-update settings to updater tab
Refactored auto-update settings for yt-dlp from DownloadSettingsDialog to the UpdaterTabWidget in the Custom Options dialog. Updated logic to use ConfigManager for settings management and ensured settings are saved when the dialog is accepted. This improves separation of concerns and centralizes update-related options.
2025-11-12 16:33:25 +02:00
oop7 a3a4352f9d Add FFmpeg updater module and GUI integration
Introduces a new FFmpeg updater module for checking and updating FFmpeg to the latest essentials build, with progress reporting and version comparison. Updates language files with new translation keys for the updater in multiple languages. Refactors Windows FFmpeg installation to use the new updater logic. Adds UpdaterTabWidget to the GUI dialogs for integration of the updater into the application's interface.
2025-11-12 16:04:55 +02:00
oop7 b3206d8890 Remove redundant file existence check in downloader
Eliminated the check_file_exists method and related logic, as file existence is now handled by yt-dlp itself. This simplifies the DownloadThread class and avoids unnecessary pre-download checks.
2025-11-04 22:06:30 +02:00
oop7 4bbb6af693 Improve robustness of final file detection after download
Enhanced the logic for finding the final downloaded file by always searching for the most recent video or audio file in the download directory and its subdirectories. This approach handles various post-processing scenarios such as merging, remuxing, and subtitle embedding, ensuring the correct file is identified even if the tracked path is invalid or missing.
2025-11-04 22:01:34 +02:00
oop7 17a33b0c9c Remove unused code and style module
Deleted the ytsage_style.py file and removed related imports, as well as unused compatibility exception classes and the sanitize_filename function. The downloader now always uses the direct CLI command, removing the Python API fallback.
2025-11-04 21:49:33 +02:00
oop7 3729d2941e Add output format selection to settings
Introduces new settings for forcing output format when merging videos, allowing users to select a preferred format (mp4, webm, mkv). Updates all language files with relevant translations, adds UI controls in the settings dialog, persists settings via ConfigManager, and passes options through the download workflow to yt-dlp.
2025-11-03 20:53:53 +02:00
oop7 df4a7ab49d Add download history feature with UI and localization
Introduces a download history dialog with thumbnail previews, redownload, and remove options. Updates all language files to support history-related UI strings. Adds HistoryManager utility and integrates history dialog into the main GUI. Enhances downloader to better track final downloaded files and merged outputs.
2025-11-03 18:27:22 +02:00
oop7 73479a46bd Improve format selection for audio/video downloads
Refactored format selection logic to explicitly handle audio-only and progressive formats using new flags. Updated GUI to pass format metadata, ensuring correct yt-dlp command construction and more reliable downloads for different format types.
2025-11-01 12:28:32 +02:00
oop7 8d2e7bd553 Add URL validation and ytdlp error messages to translations
Added new translation keys for URL validation and ytdlp error messages in all supported languages. This improves error reporting and user feedback for invalid URLs and common download issues.
2025-10-26 21:05:57 +03:00
oop7 952ac88518 Add video URL validation and filename sanitization
Introduces validate_video_url to check YouTube/YouTube Music URLs for supported formats and domains, returning detailed error messages. Adds sanitize_filename to clean filenames by removing unsafe characters for filesystem compatibility.
2025-10-26 20:50:19 +03:00
oop7 22a7951d80 Remove duplicate signal declaration in DownloadThread
Eliminated a redundant declaration of the 'update_details' signal in the DownloadThread class to clean up the code and prevent confusion.
2025-10-26 20:48:34 +03:00
oop7 41d35060c1 Remove yt-dlp Python package usage; use binary only
Refactored all modules to remove dependency on the yt-dlp Python package, switching to subprocess calls to the yt-dlp binary for all extraction and update operations. Update logic now exclusively manages the app's own yt-dlp binary and no longer supports pip-based updates. Simplified format/audio detection and thumbnail extraction to use CLI heuristics and subprocess output. This improves reliability and avoids Python package conflicts.
2025-10-25 19:49:46 +03:00
Your Name d80dff371c Add localization keys for fallback and status messages in UI
Replaced hardcoded status and fallback messages with localized strings across downloader, update, and main UI modules. Updated language files for all supported languages to include new keys for fallback download status, pip timeout, invalid URL, zero selected, and playlist selection dialog title. This improves internationalization and consistency of user-facing messages.
2025-10-06 17:26:16 +03:00
Your Name 2ccdb532b5 Add localization for post-processing status messages
Introduces new translation keys for post-processing status messages ('merging formats' and 'removing sponsor segments') in all supported languages. Updates code to use these i18n keys in both downloader and GUI, improving localization and consistency of user-facing messages.
2025-10-06 17:09:36 +03:00
Your Name d48a474e00 Add speed and ETA translations; localize status message
Added 'speed' and 'eta' translation keys to all language files for download status. Updated ytsage_downloader.py to use localized labels for speed and ETA in the status message.
2025-10-04 13:10:56 +03:00
Your Name 3164c07416 Add localization for status and error messages
Replaced hardcoded status and error messages with localized strings throughout the downloader, main GUI, update dialog, and video info components. Updated English and Spanish language files with new keys for download statuses, errors, playlist info, and UI labels to improve internationalization and maintainability.
2025-10-02 22:03:21 +03:00
Your Name 377157d415 Improve partial file cleanup with retry and delays
Added a _safe_delete_with_retry method to handle Windows file locking issues when deleting partial files. Introduced delays before cleanup after process termination to ensure file handles are released, reducing errors during file deletion. Error signal emission for cleanup failures is suppressed to avoid thread crashes.
2025-09-22 15:16:34 +03:00
Your Name d6fb926644 Add proxy configuration support to downloader and GUI
Introduces proxy and geo-verification proxy options to the downloader and GUI dialogs, allowing users to specify network proxies for downloads and geo-restricted content. Updates the DownloadThread and main app logic to pass and apply these proxy settings, and adds validation and status indicators in the custom options dialog.
2025-09-22 14:49:58 +03:00
Viren Hirpara e9de913b47 v4.9.0 - Refactor (#41)
* fix imports
remove unused imports
use full import path
sort import (1. Standard Library, 2. Third-Party, 3. Local) in alphabetic.

* - remove: Method 3 from src.core.ytsage_downlader:cleanup_subtitle_file
  - it could delete the subtitle file of other movies if it present in same directory as it scane recursively.

- refactor: migrate from os.path to pathlib.Path for path handling
  - Replaced os.path methods with pathlib.Path to improve readability,
  - avoid repeatation.
  - cross-platform compatibility, and maintain cleaner code.

- improve: enhance code readability
  - Standardized string literals to use double quotes for consistency
  - Removed unnecessary spaces to maintain cleaner formatting
  - Applied code formatting for better readability and maintainability

* - add: ytsage_constants.py file for one place to store all constants.

- imporve: return type hint for function.

- remove: src/gui/ytsage_gui_dialogs.py file to avoid repetation
  - src/gui/dialogs is renamed to src/gui/ytsage_gui_dialogs for same naming convection. (future import will remains same)
  - use of src/gui/ytsage_gui_dialogs/__init__.py to import the dilogs modules.

- change: variable self.parent to self._parent so it does not overwrite the parent()
  - add type hint checking.

* - refactor: QMetaObject.invokeMethod to Signal
  - I encounter error with incokeMethod. Could not solve it.
  - So, Changed it to Signal to match app code language.

- implement: the ytsage_constants.py to code
  - remove: unnecessary logic
  - remove: repetitive code logic.

- update: yt-dlp logic for src\gui\ytsage_gui_dialogs\ytsage_dialogs_update:_update_binary
  - yt-dlp update logic will use `yt-dlp -U`

* refactor: remove unused imports and streamline code formatting across multiple files

* - **refactor: drop `pygame` in favor of built-in `PySide6` sound**

- Removed `pygame` dependency (too heavy just for notifications).
- Replaced with `QSoundEffect`, which is lightweight and built into `PySide6`.
- Dropped `pygame.mixer` + threading → Qt handles async playback.
- Implemented sound playback with `QUrl.fromLocalFile()` and `.play()`.
- Added `setVolume(0.9)` as a configurable example.
- Converted notification sound from `.mp3` to `.wav` (only format supported).

* **refactor(utils): simplify logger module**
  - Moved `logger` to `src.utils`
  - Removed unnecessary import checks (logger is always available)
  - Replaced `raise` statements with error logging to prevent crashes
  - Use `logger.exception()` in `except` blocks to capture traceback (logged as error)

**style: remove redundant str() in f-strings**
  - Dropped explicit `str()` calls inside f-strings
  - f-strings already call `str()` under the hood

**chore: add type hints for GUI mixins**
  - Added type hints for `FormatTableMixin` (`src.gui.ytsage_gui_format_table`)
  - Added type hints for `VideoInfoMixin` (`src.gui.ytsage_gui_video_info`)
  - Improves autocomplete and type safety in IDEs

* - **introduce the `ytsage_config_manager.py` module to manage app setting.**
  - Loads settings from a JSON config file (`APP_CONFIG_FILE`).
  - Creates the config file with default values if missing or corrupt.
  - Retrieves, sets, and deletes settings using simple dot-separated keys.
  - Provides safe error handling with logging instead of raising exceptions.
  - Persists updates back to disk automatically.

- **Usage**
```python
from src.utils.ytsage_config_manager import ConfigManager

download_path = ConfigManager.get("download_path")

ConfigManager.set("download_path", "D:/Downloads")

last_check = ConfigManager.get("cached_versions.ytdlp.last_check")

ConfigManager.delete("cached_versions.ffmpeg.path")
```

* **Refactore: pkg_resources with importlib.metadata.version**
  - UserWarning: pkg_resources is deprecated as an API.
  - See https://setuptools.pypa.io/en/latest/pkg_resources.html.
  - The pkg_resources package is slated for removal as early as 2025-11-30.

* **refactore: notification sound**
  - `QSoundEffect` is chnaged back to `pyglet` as per mainter `@oop7` choise.
  - simplify the logic.

* remove: import check, it should always work.

* **fix: runtime error**
  - yt_dlp moved from `--excludes` to `--packages` in `build-windows.yml`
  - In frozen build, logger will not log to consol. insted will log to file.
  - In frozen build, `app_dir` is next to `.exe` file.

* chang back to checking import for ytdlp

* Bump version to 4.8.1

Update version references from 4.8.0b to 4.8.1 in __init__.py, main app, and About dialog to reflect the new release.

* Update asset paths in build workflows

Changed asset inclusion and screenshot removal paths from 'assets' to 'lib/assets' in Linux, macOS, and Windows build workflows to reflect new directory structure and ensure screenshots are excluded from packaged builds.

* Bump version to 4.8.2

Update version references from 4.8.1 to 4.8.2 in source files and documentation to prepare for a new patch release.

* Fix asset include path in Windows build workflow

Corrects the syntax for including asset files in the build-windows.yml workflow by changing 'assets,lib/assets' to 'assets=lib/assets'. This ensures assets are properly mapped during the build process.

* Update release tag examples in CI/CD README

Changed the example git tag commands from v4.8.0 and v4.8.2 to v4.8.1 for consistency in the CI/CD documentation.

* Fix include-files mapping in Windows build workflow

Changed the cx_Freeze --include-files argument from '=' to ':' for source:destination mapping in build-windows.yml. This resolves an issue where '=' was treated as a literal path, ensuring assets are correctly copied to the destination directory.

* Remove redundant comments in build-windows workflow

Deleted comments explaining the colon usage for source:destination mapping in the cx_Freeze CLI, as the mapping is already clear from the context.

* Refactor Windows build to use cx_Freeze setup script

Replaces direct cx_Freeze CLI calls with dynamically generated setup scripts for both standard and FFmpeg builds. This improves maintainability and flexibility of build configuration in the GitHub Actions workflow.

* Bump version to 4.8.3

Updated version references from 4.8.2 to 4.8.3 in __init__.py, main app, and About dialog to reflect the new release.

* revert(build): move yt_dlp from --packages to --excludes in build-windows.yml

---------

Co-authored-by: Your Name <mohamed.mohamed112@ai.mnu.edu.eg>
2025-09-09 23:01:19 +03:00
Your Name c140acef5a Fix output template path handling in downloader
Replaces Path.joinpath with string concatenation using as_posix() for output templates to avoid issues with Path objects. Ensures correct file paths for both single downloads and playlists.
2025-09-09 11:50:21 +03:00
Your Name 9e89228c6d Reapply "Fix path handling and subtitle file tracking in downloader"
This reverts commit afcab75b20.
2025-09-04 17:50:03 +03:00
Your Name afcab75b20 Revert "Fix path handling and subtitle file tracking in downloader"
This reverts commit 8198f7604f.
2025-09-04 17:48:36 +03:00
Your Name 8198f7604f Fix path handling and subtitle file tracking in downloader
Corrects usage of Path.joinpath to use instance method, improving output template path construction. Enhances subtitle file detection and cleanup logic to handle malformed Windows paths and ensures subtitle file paths are properly resolved and tracked for later deletion.
2025-09-04 17:44:46 +03:00
Your Name 90b173c389 Improve yt-dlp version detection and binary management
Refactored version detection to use importlib.metadata when available, with fallback to pkg_resources for older Python versions. Enhanced app-managed binary detection by safely comparing paths and handling missing files, improving robustness in update logic for both core and GUI update threads.
2025-09-04 00:16:02 +03:00
Your Name f390d23f54 Refactor windowed mode and subprocess handling
Removed redundant windowed mode setup from main.py and simplified subprocess creation flags logic across core and GUI modules. Centralized subprocess creation flags usage, eliminated custom run_subprocess_hidden wrapper, and improved logging handler setup for better compatibility with windowed applications.
2025-08-27 23:00:08 +03:00
Your Name b23be4335e Improve console suppression for windowed mode on Windows
Refactored console window suppression logic to better handle PyInstaller windowed applications and prevent console flicker. Added creation flags and redirected subprocess streams in multiple modules to ensure hidden console windows when running subprocesses. Introduced a utility function for running subprocesses with hidden console and updated all relevant subprocess calls to use it.
2025-08-27 22:46:38 +03:00
Your Name a6a175b3d7 Improve handling of console window in windowed apps
Suppresses console window flicker for PyInstaller windowed applications by redirecting stdout and stderr in main.py. Updates logging setup to avoid console output in windowed mode and adds fallback error logging. Suppresses pkg_resources deprecation warnings to further reduce unwanted console output.
2025-08-27 22:17:13 +03:00
Your Name 6ff72f296a Add yt-dlp error parser for user-friendly messages
Introduces the parse_yt_dlp_error function to convert raw yt-dlp error messages into actionable, user-friendly feedback. This improves error handling and provides clearer guidance to users encountering common download issues.
2025-08-26 19:27:59 +03:00
Your Name ca7287ee60 Enhance QComboBox and QGroupBox styling
Improved QComboBox appearance with updated padding, border, drop-down, and arrow styles, including hover and focus effects. Added custom styling for QComboBox item views and introduced new styles for QGroupBox and its title for better UI consistency.
2025-08-26 19:27:21 +03:00
Your Name cb342eb499 Add browser cookies support to DownloadThread
Introduces a browser_cookies parameter to DownloadThread, allowing cookies to be loaded from a browser for downloads. Updates command and options construction to handle both cookie files and browser cookies, improving flexibility for authentication.
2025-08-26 19:27:14 +03:00
Viren Hirpara 9c13b4b61c Refactor/code cleanup (#37)
* fix imports
remove unused imports
use full import path
sort import (1. Standard Library, 2. Third-Party, 3. Local) in alphabetic.

* - remove: Method 3 from src.core.ytsage_downlader:cleanup_subtitle_file
  - it could delete the subtitle file of other movies if it present in same directory as it scane recursively.

- refactor: migrate from os.path to pathlib.Path for path handling
  - Replaced os.path methods with pathlib.Path to improve readability,
  - avoid repeatation.
  - cross-platform compatibility, and maintain cleaner code.

- improve: enhance code readability
  - Standardized string literals to use double quotes for consistency
  - Removed unnecessary spaces to maintain cleaner formatting
  - Applied code formatting for better readability and maintainability

* - add: ytsage_constants.py file for one place to store all constants.

- imporve: return type hint for function.

- remove: src/gui/ytsage_gui_dialogs.py file to avoid repetation
  - src/gui/dialogs is renamed to src/gui/ytsage_gui_dialogs for same naming convection. (future import will remains same)
  - use of src/gui/ytsage_gui_dialogs/__init__.py to import the dilogs modules.

- change: variable self.parent to self._parent so it does not overwrite the parent()
  - add type hint checking.

* - refactor: QMetaObject.invokeMethod to Signal
  - I encounter error with incokeMethod. Could not solve it.
  - So, Changed it to Signal to match app code language.

- implement: the ytsage_constants.py to code
  - remove: unnecessary logic
  - remove: repetitive code logic.

- update: yt-dlp logic for src\gui\ytsage_gui_dialogs\ytsage_dialogs_update:_update_binary
  - yt-dlp update logic will use `yt-dlp -U`

* refactor: remove unused imports and streamline code formatting across multiple files
2025-08-26 16:27:12 +03:00
Your Name 9c0897e787 Add centralized logging configuration with loguru
Introduces src/core/ytsage_logging.py to provide structured logging for the YTSage application using loguru. Includes multiple output handlers for console and file logging, robust fallbacks for environments without loguru, and safe initialization to replace print statements with consistent logging.
2025-08-16 15:07:31 +03:00
Your Name 1e95e643c2 Move ytsage_style.py to src/core directory
Renamed and relocated ytsage_style.py to src/core/ytsage_style.py for improved project structure and organization.
2025-08-16 15:07:09 +03:00
Your Name b339a322e8 Refactor print statements to use logger in ytsage_utils
Replaced all print statements with logger calls for improved logging consistency and error handling. Updated imports to use relative paths and added logger import. This change enhances maintainability and integrates better with the application's logging system.
2025-08-16 15:06:02 +03:00
Your Name 1fcde5d6b9 Refactor and enhance yt-dlp setup dialog UI
Moved ytsage_yt_dlp.py to src/core/ and improved the YtdlpSetupDialog UI with better layout, styling, and accessibility. Replaced print statements with logger calls, added a check_ytdlp_installed() utility, and refined icon path resolution. These changes improve user experience and maintainability.
2025-08-16 15:05:51 +03:00
Your Name 0cb40f4338 Refactor and enhance FFmpeg installer module
Moved ytsage_ffmpeg.py to src/core and refactored for improved logging and error handling. Added SHA-256 verification for downloads, updated FFmpeg URLs to 7.1.1, and implemented fallback extraction methods. Introduced get_ffmpeg_path utility and replaced print statements with logger calls for better integration.
2025-08-16 15:05:27 +03:00
Your Name 8ee436aa14 Refactor downloader logging and add new options
Replaced print statements with logger calls for improved logging. Added support for sponsorblock categories and chapter embedding. Updated imports to use relative paths and improved command building logic for yt-dlp.
2025-08-16 15:05:15 +03:00
Your Name 4fdc815f70 Add package docstring to core __init__.py
Introduces a new __init__.py file for the core package with a descriptive docstring outlining its purpose and contents.
2025-08-16 15:04:24 +03:00