diff --git a/core/video/enrichment/worker.py b/core/video/enrichment/worker.py index 3a19f667..032ba9dc 100644 --- a/core/video/enrichment/worker.py +++ b/core/video/enrichment/worker.py @@ -119,9 +119,14 @@ class VideoEnrichmentWorker: self.db.enrichment_apply(self.service, item["kind"], item["id"], matched=True, external_id=result["id"], metadata=result.get("metadata")) self.stats["matched"] += 1 + # Visible progress in app.log, mirroring the music workers' style. + logger.info("Matched %s '%s' -> %s ID: %s%s", item["kind"], item["title"], + self.display_name, result["id"], + " (by server id)" if item.get("known_id") else "") else: self.db.enrichment_apply(self.service, item["kind"], item["id"], matched=False) self.stats["not_found"] += 1 + logger.info("No %s match for %s '%s'", self.display_name, item["kind"], item["title"]) return True # ── status (same shape the music enrichment API returns) ────────────────── diff --git a/tests/test_video_enrichment.py b/tests/test_video_enrichment.py index 908aa284..dd3405bb 100644 --- a/tests/test_video_enrichment.py +++ b/tests/test_video_enrichment.py @@ -129,6 +129,17 @@ def test_tvdb_client_refreshes_expired_token(monkeypatch): assert len(logins) == 2 # initial login + one refresh after the 401 +def test_worker_logs_match_progress(db, caplog): + # The worker must log each match at INFO (under soulsync.*) so progress is + # visible in app.log like the music workers — otherwise it looks dead. + db.upsert_movie("plex", {"server_id": "m1", "title": "Dune", "year": 2021}) + w = VideoEnrichmentWorker(db, "tmdb", FakeClient({"id": 438631, "metadata": {}})) + with caplog.at_level("INFO", logger="soulsync.video_enrichment.worker"): + w.process_one() + assert any("Matched movie 'Dune'" in r.message and "TMDB ID: 438631" in r.message + for r in caplog.records) + + def test_worker_process_one_not_found(db): db.upsert_movie("plex", {"server_id": "m1", "title": "X"}) w = VideoEnrichmentWorker(db, "tmdb", FakeClient(None))