Video automations: Full Cleanup twin (phase 4)

Same pattern: video_full_cleanup action (scope='video' block + registry), reuses
the shared auto_full_cleanup handler, owned_by='video' system automation on the
music cadence (every 12h). Music copy untouched. Seam tests + EXPECTED_ACTION_NAMES.
video
BoulderBadgeDad 7 days ago
parent a6b2737a5c
commit f111b5dda6

@ -274,6 +274,8 @@ ACTIONS: list[dict] = [
"description": "Remove old searches from Soulseek", "available": True},
{"type": "video_clean_completed_downloads", "label": "Clean Completed Downloads", "icon": "check-square", "scope": "video",
"description": "Clear completed downloads and empty directories", "available": True},
{"type": "video_full_cleanup", "label": "Full Cleanup", "icon": "trash", "scope": "video",
"description": "Clear quarantine, download queue, import folder, and search history in one sweep", "available": True},
]

@ -164,6 +164,10 @@ def register_all(deps: AutomationDeps) -> None:
'video_clean_completed_downloads',
lambda config: auto_clean_completed_downloads(config, deps),
)
engine.register_action_handler(
'video_full_cleanup',
lambda config: auto_full_cleanup(config, deps),
)
engine.register_action_handler(
'clean_completed_downloads',
lambda config: auto_clean_completed_downloads(config, deps),

@ -201,6 +201,14 @@ SYSTEM_AUTOMATIONS = [
'initial_delay': 300,
'owned_by': 'video',
},
{
'name': 'Full Cleanup',
'trigger_type': 'schedule',
'trigger_config': {'interval': 12, 'unit': 'hours'},
'action_type': 'video_full_cleanup',
'initial_delay': 900,
'owned_by': 'video',
},
# Video twin of music's 'Auto-Deep Scan Library', split into TWO because Movies
# and TV are independent libraries — a TV scan never pulls in new movies and
# vice-versa. Fixed weekly deep scan (re-read + prune removed) at 02:00 server-

@ -62,6 +62,7 @@ EXPECTED_ACTION_NAMES = frozenset({
'video_add_airing_episodes',
'video_clean_search_history',
'video_clean_completed_downloads',
'video_full_cleanup',
})
# Action names that MUST register a guard (duplicate-run prevention).

@ -92,3 +92,24 @@ def test_video_clean_completed_downloads_reuses_the_music_handler():
handlers = _registered_handlers()
assert "video_clean_completed_downloads" in handlers
assert "clean_completed_downloads" in handlers
# ── Phase 4: Full Cleanup ───────────────────────────────────────────────────
def test_video_full_cleanup_is_video_scoped_only():
assert "video_full_cleanup" in _action_types("video")
assert "video_full_cleanup" not in _action_types("music")
assert "full_cleanup" in _action_types("music")
assert "full_cleanup" not in _action_types("video")
def test_video_full_cleanup_seeds_one_video_owned_system_row():
rows = _system_by_action("video_full_cleanup")
assert len(rows) == 1 and rows[0]["owned_by"] == "video"
assert rows[0]["trigger_config"] == {"interval": 12, "unit": "hours"}
def test_video_full_cleanup_reuses_the_music_handler():
handlers = _registered_handlers()
assert "video_full_cleanup" in handlers
assert "full_cleanup" in handlers

Loading…
Cancel
Save