From 50632f6392e1e1ee7626ef0af36427a49ce4abc1 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Sun, 14 Jun 2026 15:54:53 -0700 Subject: [PATCH] video enrichment: log each match/not-found at INFO (visible in app.log) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The worker only logged exceptions, so a normal run looked dead — no parity with the music workers' 'Matched ... -> ID' lines. Now logs each match (noting '(by server id)' when it used the server's provider id) and each not-found at INFO. Logger is soulsync.video_enrichment.worker, so it already propagates to app.log; it just had nothing to say. caplog seam test pins it. --- core/video/enrichment/worker.py | 5 +++++ tests/test_video_enrichment.py | 11 +++++++++++ 2 files changed, 16 insertions(+) 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))