Continues the lift from `web_server._register_automation_handlers`. This commit extracts the four playlist-lifecycle closures: - `refresh_mirrored` -> core/automation/handlers/refresh_mirrored.py - `sync_playlist` -> core/automation/handlers/sync_playlist.py - `discover_playlist` -> core/automation/handlers/discover_playlist.py - `playlist_pipeline` -> core/automation/handlers/playlist_pipeline.py The pipeline composes refresh + sync + discover, so all four ship together. The pipeline imports the other three handler modules directly (cross-handler call) instead of going through the engine, preserving the "single trigger from the user's perspective" UX. `AutomationDeps` grew to cover the new dependency surface: - run_playlist_discovery_worker, run_sync_task, load_sync_status_file (pre-existing background-task entry points) - get_deezer_client, parse_youtube_playlist (per-source clients) - get_sync_states (live mutable accessor for the sync UI's state dict) `web_server._register_automation_handlers` now wires those plus the existing infrastructure into a single `AutomationDeps` and calls `register_all`. The 669-line block of closure definitions and engine register calls (lines 959-1627 pre-edit) is gone -- the file shed 743 lines net on this commit. `tests/automation/test_handlers_playlist.py` adds 17 new boundary tests: - discover_playlist: no_id error, specific_id starts worker, all=True enumerates, no playlists in db - refresh_mirrored: error path, source filter (file/beatport excluded), Spotify happy path with auto-discovered marker, per-playlist exception captured into errors counter - sync_playlist: no_id, not_found, no_tracks, no-discovered-tracks skip, discovered-track happy path, unchanged-since-last-sync skip - playlist_pipeline: no_playlist clears running flag, no-refreshable clears running flag, exception clears running flag 3223 tests pass. web_server.py: 35,593 -> 34,850 lines (743 removed).
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
"""Per-action automation handlers.
|
|
|
|
Each module in this subpackage exposes one top-level handler function
|
|
(or a small cluster of related handlers) of the form::
|
|
|
|
def auto_<action_name>(config: dict, deps: AutomationDeps) -> dict
|
|
|
|
The ``register_all`` helper in :mod:`registration` wires every handler
|
|
to the engine in one place. ``web_server.py`` calls
|
|
``register_all(deps)`` once at startup.
|
|
"""
|
|
|
|
from core.automation.handlers.process_wishlist import auto_process_wishlist
|
|
from core.automation.handlers.scan_watchlist import auto_scan_watchlist
|
|
from core.automation.handlers.scan_library import auto_scan_library
|
|
from core.automation.handlers.refresh_mirrored import auto_refresh_mirrored
|
|
from core.automation.handlers.sync_playlist import auto_sync_playlist
|
|
from core.automation.handlers.discover_playlist import auto_discover_playlist
|
|
from core.automation.handlers.playlist_pipeline import auto_playlist_pipeline
|
|
from core.automation.handlers.registration import register_all
|
|
|
|
__all__ = [
|
|
'auto_process_wishlist',
|
|
'auto_scan_watchlist',
|
|
'auto_scan_library',
|
|
'auto_refresh_mirrored',
|
|
'auto_sync_playlist',
|
|
'auto_discover_playlist',
|
|
'auto_playlist_pipeline',
|
|
'register_all',
|
|
]
|