feat: Enhance playlist management and GUI logic
- Improved playlist item fetching by adding robust pagination and low-level request hooks for better testing and flexibility. - Refactored track ID extraction logic into reusable helpers for clarity. - Improved initialization for dialog components to avoid circular dependencies in the GUI. - Added new unit tests to validate playlist operations, including track addition/removal and API integration. - Updated metadata functions to simplify dictionary access using `.get` for better readability. - Ensured PySide6 system dependencies are installed in GitHub Actions to address CI compatibility issues. - Streamlined UI package initialization to improve modularity and robustness of imports.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""UI package initializer.
|
||||
|
||||
- Ensures that `tidal_dl_ng.ui.dialog_playlist_manager` exposes both the generated
|
||||
`Ui_DialogPlaylistManager` and the implementation `PlaylistManagerDialog`.
|
||||
- Does not modify generated UI .py files; composes at import time.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
from types import ModuleType
|
||||
|
||||
# Import generated UI module
|
||||
_ui_mod: ModuleType = importlib.import_module("tidal_dl_ng.ui.dialog_playlist_manager")
|
||||
|
||||
# Attach the implementation class from gui
|
||||
try:
|
||||
from tidal_dl_ng.gui.dialog_playlist_manager import PlaylistManagerDialog as _ImplDialog
|
||||
except Exception:
|
||||
_ImplDialog = None # type: ignore[assignment]
|
||||
|
||||
if _ImplDialog is not None:
|
||||
_ui_mod.PlaylistManagerDialog = _ImplDialog
|
||||
|
||||
# Re-export for convenience when importing from the package
|
||||
if _ImplDialog is not None:
|
||||
PlaylistManagerDialog = _ImplDialog # type: ignore[assignment]
|
||||
|
||||
try:
|
||||
from tidal_dl_ng.ui.dialog_playlist_manager import Ui_DialogPlaylistManager as _UiClass
|
||||
except Exception:
|
||||
_UiClass = None # type: ignore[assignment]
|
||||
|
||||
if _UiClass is not None:
|
||||
Ui_DialogPlaylistManager = _UiClass # type: ignore[assignment]
|
||||
|
||||
__all__ = [name for name in ("PlaylistManagerDialog", "Ui_DialogPlaylistManager") if name in globals()]
|
||||
|
||||
Reference in New Issue
Block a user