summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/download.py
Commit message (Collapse)AuthorAgeFilesLines
* [Fix] crash due to missing path_media.Radexito2026-01-141-2/+3
|
* Merge branch 'feature/json-downloaded' into fusion-refac-&-infoWarry2025-12-031-2/+46
|\ | | | | | | | | | | | | # Conflicts: # .gitignore # README.md # tidal_dl_ng/gui.py
| * Merge remote-tracking branch 'warry-github/master' into feature/json-downloadedWarry2025-12-031-3/+17
| |\ | | | | | | | | | | | | # Conflicts: # README.md
| * | feat: Add download history tracking with duplicate preventionWarry2025-11-291-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement comprehensive download history system with JSON persistence and duplicate prevention capabilities. Features: - Persistent JSON-based download history with atomic writes - Duplicate prevention toggle in Tools menu - Thread-safe operations with proper locking - Automatic corruption recovery with backup creation - Import/Export functionality for history portability - Statistics view grouped by source (playlist, album, mix) - Green console messages for improved visibility - Custom exception handling for better error reporting Technical Details: - HistoryService singleton with O(1) track lookups - Track-centric JSON structure for performance - Atomic file operations to prevent data corruption - Custom HistoryFormatError exception class - Complexity reduction through helper methods - Full AGENTS.md compliance (ruff, black, type hints) UI Changes: - Added "Tools" menu with two actions: - "View Download History..." - Opens history dialog - "Prevent Duplicate Downloads" - Toggle with persistence - New Download History dialog with: - Tree view grouped by source - Statistics display - Import/Export buttons - Clear history option - Open folder functionality Files Added: - tidal_dl_ng/history.py (438 lines) - tidal_dl_ng/dialog_history.py (325 lines) - tidal_dl_ng/ui/dialog_history.py - tidal_dl_ng/ui/dialog_history.ui - tests/test_history_service.py (38 tests) - tests/test_download_duplicate_prevention.py (10 tests) - tests/test_gui_duplicate_prevention.py (22 tests) - tests/test_logger_configuration.py (20 tests) - FEATURE_DOCUMENTATION.md (900+ lines) - tests/README.md - CODE_QUALITY_COMPLIANCE.md - FINAL_SUMMARY.md Files Modified: - tidal_dl_ng/download.py - History integration - tidal_dl_ng/gui.py - Tools menu and handlers - tidal_dl_ng/logger.py - Green INFO messages Testing: - 91 tests total, all passing (100% pass rate) - Full test coverage for all new functionality - Thread safety validated with concurrent tests - Corruption recovery tested - Import/Export functionality verified Quality: - Zero ruff violations (full AGENTS.md compliance) - All pre-commit hooks passing - Type hints on all functions - Google-style docstrings throughout - Black formatted - Security reviewed (subprocess usage annotated) Performance: - O(1) track existence checks via dict - Atomic writes prevent corruption - Minimal memory footprint (~100 bytes per track) - Fast startup (<50ms for 1000 tracks) Breaking Changes: None Backward Compatible: Yes (legacy format auto-migrated)
* | | Merge remote-tracking branch 'warry-github/master' into โ†ตWarry2025-12-031-3/+17
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | feature/informations-window # Conflicts: # CONTRIBUTING.md # README.md
| * | Merge pull request #668 from jotalevi/hide-ffmpeg-flashexislow2025-11-291-0/+14
| |\ \ | | | | | | | | fix(ffmpeg): prevent terminal window flash on Windows during media conversion
| | * | fix(ffmpeg): prevent terminal window flash on Windows during media conversionE.J. Talevi2025-11-261-0/+10
| | | |
| | * | fix(ffmpeg): prevent terminal window flash on Windows during media conversionE.J. Talevi2025-11-261-0/+4
| | |/
| * / Added clarity and grammar fixes to documentation and to some strings on the โ†ตE.J. Talevi2025-11-251-3/+3
| |/ | | | | | | program itself.
* / feat(hover): add track details preview on hover + fix all ruff violationsWarry2025-11-291-48/+109
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement comprehensive track information display on hover and resolve all code quality issues to achieve complete ruff compliance. MAJOR FEATURES: - Track details preview on hover with rich metadata display - Async BPM fetching with loading indicator - Enhanced metadata utilities with fuzzy matching - TIDAL API extras integration FILES MODIFIED: 15+ files (core, UI, tests, docs) RUFF COMPLIANCE: 0 errors (89+ violations resolved) - Fixed E999 syntax error in metadata_utils.py - Refactored 10+ complex functions (C901) - Updated error handling (S110, S112, SIM105) - Modernized type hints (UP038) - Fixed naming conflicts (A001, F811) BUG FIXES: - Added missing _on_update_cover() method (11 test failures) - Fixed BPM display and async loading - Improved thread safety TESTING: 30 passed, 1 skipped DOCUMENTATION: Windows PowerShell support, tox troubleshooting
* refactor(downloader): ๐Ÿ”ง reorganize TrackStreamInfo class and importsRobert Honz2025-11-131-12/+1
| | | | | | * Moved `TrackStreamInfo` class definition from `download.py` to `downloader.py`. * Removed redundant `dataclass` import from `download.py`. * Updated import statements to maintain clarity and organization.
* Create TrackStreamInfo dataclass & Add proper docstringsRikrdoga2025-11-121-11/+41
|
* Resolve Race Condition and Optimize Session Switching for Atmos DownloadsRikrdoga2025-11-041-21/+75
|
* Merge pull request #596 from Winman486/fix/rate-limiting-playlist-downloadsexislow2025-10-221-0/+4
|\ | | | | Fix/rate limiting playlist downloads
| * Merge upstream/master and resolve conflictsWinman4862025-10-201-2/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | - Resolved conflict in dialog_settings.py (kept both cb_use_primary_album_artist and cb_mark_explicit checkboxes) - Fixed code quality issues found by make check: * Removed duplicate on_download_album_from_track function (F811) * Updated isinstance calls to use X | Y syntax instead of (X, Y) (UP038) * Fixed unused loop variable album_stub (B007) * Applied automatic formatting fixes (black, prettier, trailing whitespace) - Only remaining issue is C901 complexity warning in on_download_all_albums_from_playlist (expected per maintainer feedback)
| * | feat(gui): add 'Download Full Album', 'Download All Albums', and 'Single โ†ตWinman4862025-10-171-0/+4
| | | | | | | | | | | | album folder (primary artist)' preference
* | | Move credentials to constants, improve docs (tidal_obj), and clean up Atmos โ†ตRikrdoga2025-10-211-3/+4
| | | | | | | | | | | | legacy code
* | | minor fix: Respect audio quality selectedRikrdoga2025-10-201-1/+0
| | |
* | | Apply formatter and fix TRY003Rikrdoga2025-10-201-3/+2
| | |
* | | Refactor Dolby Atmos ImplementationRikrdoga2025-10-201-26/+20
| | |
* | | Refactor Dolby Atmos feature to be internal and seamlessRikrdoga2025-10-201-4/+34
| |/ |/|
* | Merge pull request #600 from truubo/597-optional-explicit-symbol-in-track-titleexislow2025-10-201-1/+1
|\ \ | | | | | | feat(metadata): Toggle explicit symbol in track titles
| * | Add a checkbox to settings that toggles the explicit symbol in track titlesTrubo2025-10-191-1/+1
| |/
* | fix(download): ๐Ÿ› handle missing `st_birthtime` attribute in track sortingRobert Honz2025-10-201-1/+3
| | | | | | | | | | * Updated the sorting method for track paths to check for the presence of `st_birthtime`. * If `st_birthtime` is not available, fallback to using `st_ctime` for sorting.
* | fix(download): ๐Ÿ› update sorting method for track pathsRobert Honz2025-10-201-1/+1
|/ | | | | * Changed sorting method from `os.path.getctime` to `x.stat().st_birthtime` for better accuracy in track creation time. * This improves the reliability of track order when not dealing with albums.
* feat(metadata): โœจ add explicit track metadata handlingRobert Honz2025-10-171-2/+6
| | | | | * Introduced `METADATA_EXPLICIT` constant for explicit track indication. * Updated `Download` class to append explicit metadata to track titles.
* feat(metadata): โœจ add support for explicit track metadataRobert Honz2025-10-171-0/+1
| | | | | | * Added `explicit` attribute to the `Metadata` class. * Updated the constructor to initialize `explicit` with a default value of `False`. * Modified the metadata saving process to include explicit rating in tags.
* feat(metadata): โœจ add support for synced and unsynced lyricsRobert Honz2025-10-171-4/+9
| | | | | | * Introduced `lyrics_synced` and `lyrics_unsynced` fields in the `Metadata` class. * Updated the `Download` class to handle both synced and unsynced lyrics from the track. * Enhanced metadata writing to include `UNSYNCEDLYRICS` in the tags.
* feat(metadata): โœจ add UPC metadata handling and configurationRobert Honz2025-10-171-0/+6
| | | | | | | * Introduced `MetadataTargetUPC` enum for target metadata tags. * Added `METADATA_LOOKUP_UPC` dictionary for mapping file formats to UPC tags. * Updated `Metadata` class to include `target_upc` for dynamic UPC tag assignment. * Enhanced `Settings` class to allow configuration of `metadata_target_upc`.
* feat(path): โœจ add customizable delimiters for artist names in file pathsRobert Honz2025-10-171-6/+27
| | | | | | * Updated `format_path_media` and related functions to accept customizable delimiters for artist names. * Modified `Settings` class to include `filename_delimiter_artist` and `filename_delimiter_album_artist`. * Enhanced `name_builder_artist` and `name_builder_album_artist` functions to utilize the new delimiters.
* feat(metadata): โœจ add customizable metadata delimiters for artistsRobert Honz2025-10-171-2/+2
| | | | | | * Introduced `metadata_delimiter_artist` and `metadata_delimiter_album_artist` settings. * Updated `name_builder_artist` and `name_builder_album_artist` functions to utilize the new delimiters. * This allows users to specify their preferred delimiter for artist names in metadata.
* fix(download): ๐Ÿ› handle empty items list in download processRobert Honz2025-10-061-0/+10
| | | | | * Added a check for empty `items` list to mark progress as complete. * Ensured GUI updates correctly reflect progress for empty downloads.
* fix(download): ๐Ÿ› adjust cover image handling to prevent metadata size issuesRobert Honz2025-09-071-3/+11
| | | | | * Prevent writing `CoverDimensions.PxORIGIN` to metadata to avoid exceeding max file size (>16Mb). * Ensure correct cover image is used based on `cover_dimension` settings.
* refactor(constants): streamline enums and enhance type annotationsRobert Honz2025-08-131-1/+2
| | | | | | | | | | | This commit refactors the codebase to improve readability and maintainability by updating enums and type annotations: - โœจ **Replaced `StrEnum` attributes**: Removed explicit type declarations for enum values to simplify the code. - ๐Ÿ› ๏ธ **Introduced `AudioExtensionsValid` enum**: Added a new enum for valid audio file extensions. - ๐Ÿ”„ **Enhanced type annotations**: Updated `FAVORITES` dictionary to include specific type hints for clarity. - ๐Ÿงน **Updated references**: Replaced outdated `AudioExtensions` usage with the new `AudioExtensionsValid`. These changes improve code clarity, enforce stricter typing, and enhance extensibility.
* feat: add metadata_write_url setting for conditional URL metadata writingRobert Honz2025-08-121-1/+1
| | | | | | | | | | Introduces a new configuration option, `metadata_write_url`, to control whether the media file URL is included in metadata. Updates logic to respect this setting. - โœจ **Feature**: Adds `metadata_write_url` to enable/disable URL writing in metadata. - ๐Ÿ”ง **Logic Update**: Adjusts URL handling to check the new setting before including it. - ๐Ÿ“ **Documentation**: Updates help descriptions to explain the new option. This change improves flexibility in metadata customization.
* feat: add support for original image dimension in album coversRobert Honz2025-08-121-1/+5
| | | | | | | | | | Adds functionality to handle original image dimensions (`origin`) for album cover downloads. - โœจ Added `PxORIGIN` option to cover dimension constants. - ๐Ÿ”„ Updated cover image URL logic to support original dimensions. - ๐Ÿ› ๏ธ Improved cover data handling for more flexible metadata embedding. This enhances customization and fidelity in cover image management.
* feat(metadata): add UPC support for metadata taggingRobert Honz2025-08-121-0/+1
| | | | | | | | | | | This update introduces support for handling UPCs (Universal Product Codes) in metadata processing. It ensures that UPC information is extracted, stored, and written to the appropriate metadata tags for various formats. - โœจ **Feature**: Adds UPC field to metadata handling. - ๐Ÿ› ๏ธ **Enhancement**: Updates metadata initialization to include UPC. - ๐Ÿ—‚๏ธ **Tagging**: Implements UPC writing for supported file formats. - โœ… **Compatibility**: Ensures proper handling when UPC is absent. This improvement enhances metadata completeness and compatibility with systems requiring UPC data.
* refactor(download): ๐Ÿ”ง Improve media validation and preparation logicRobert Honz2025-07-031-56/+25
| | | | | | | * Enhanced `_validate_and_prepare_media` method to support additional media types: `Album`, `Playlist`, `UserPlaylist`, and `Mix`. * Updated media validation checks to ensure proper handling of unavailable media. * Refactored `_validate_media_instance` to streamline media instance creation and validation. * Removed redundant `_validate_and_prepare_media_collection` method for cleaner code.
* refactor(download): โœจ Enhance media collection handling and download executionRobert Honz2025-07-021-35/+195
| | | | | | * Improved validation and preparation of media collections for downloads. * Refactored download context setup and execution logic for better clarity and maintainability. * Added progress tracking for download tasks and improved handling of download futures.
* refactor(download): ๐Ÿ”ง Improve media validation and download processRobert Honz2025-07-021-100/+311
| | | | | | | | * Reordered parameters in `item` method for clarity. * Added `_validate_media_instance` method to streamline media validation. * Enhanced `_prepare_file_paths_and_skip_logic` for better file handling. * Introduced `_perform_actual_download` to encapsulate download logic. * Improved error handling and logging throughout the download process.
* refactor(download): โœจ Refactor media download logic for clarity and efficiencyRobert Honz2025-07-021-39/+137
| | | | | | | * Renamed `_download` to `_get_media_urls` for better clarity on its purpose. * Simplified URL extraction logic for `Track` and `Video` media types. * Improved progress setup and error handling in the download process. * Enhanced `_download_segments` and `_download_postprocess` methods for better readability and maintainability.
* refactor(download): โœจ Enhance docstrings for `RequestsClient` and โ†ตRobert Honz2025-07-021-0/+246
| | | | | | | `Download` classes * Improved documentation for methods in the `RequestsClient` and `Download` classes. * Added detailed descriptions, parameters, and return types to enhance code readability and maintainability.
* refactor(gui): โœจ Enhance type annotations and improve method signaturesRobert Honz2025-07-021-32/+32
| | | | | | * Updated type hints for various methods in and classes. * Changed list types from to for better clarity and consistency. * Improved function signatures to include return types for better type safety.
* ๐Ÿ› ๏ธ Directory length limit is checked and adapted correctly now. Fixes โ†ตRobert Honz2025-06-301-4/+7
| | | | #447 & #436
* ๐Ÿ‘ท Lists and cover will be loaded in background. Gui won't hang anymore. โ†ตRobert Honz2025-06-291-3/+1
| | | | Fixes #423
* โœจ Implemented playlist track position naming (`{list_pos}`) for downloads. โ†ตRobert Honz2025-04-021-7/+23
| | | | Fixes #165
* ๐Ÿ› ๏ธ Fixed and simplified path_file_sanitize method.Robert Honz2025-03-271-3/+1
|
* ๐Ÿ› ๏ธ Fix: Only re-create media item if it is a track. Fixes #386Robert Honz2025-03-251-1/+1
|
* ๐Ÿ‘ท Code style.Robert Honz2025-03-241-1/+3
|
* ๐Ÿ‘ท Check if albums and videos are available or not due to regional โ†ตRobert Honz2025-03-241-7/+18
| | | | restrictions. Fixes #277