From 8dd75897e3c138826893cb99822dbeebc8efc54c Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Wed, 13 Aug 2025 08:17:11 +0200 Subject: refactor(constants): streamline enums and enhance type annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tidal_dl_ng/download.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tidal_dl_ng/download.py') diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index cf95df8..56c3099 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -38,6 +38,7 @@ from tidal_dl_ng.constants import ( PLAYLIST_EXTENSION, PLAYLIST_PREFIX, REQUESTS_TIMEOUT_SEC, + AudioExtensionsValid, CoverDimensions, MediaType, QualityVideo, @@ -1496,7 +1497,7 @@ class Download: # Get all tracks in the directory path_tracks: list[pathlib.Path] = [] - for extension_audio in AudioExtensions: + for extension_audio in AudioExtensionsValid: path_tracks = path_tracks + list(dir_scoped.glob(f"*{extension_audio!s}")) # Sort alphabetically, e.g. if items are prefixed with numbers -- cgit v1.3.1