From fd42791c9f69ebe1662ab8e3537bdca52abfc668 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Fri, 17 Apr 2026 08:55:39 +0200 Subject: [PATCH] feat: add get_all_export_paths to ProcessedDB Co-Authored-By: Claude Opus 4.6 --- core/db.py | 10 ++++++++++ tests/test_audio_scan.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/core/db.py b/core/db.py index e0ba4d0..4818a02 100644 --- a/core/db.py +++ b/core/db.py @@ -213,6 +213,16 @@ class ProcessedDB: ).fetchall() return [r[0] for r in rows] + def get_all_export_paths(self, profile: str = "default") -> list[str]: + """Return all unique output_path values for a given profile.""" + if not self._enabled: + return [] + rows = self._con.execute( + "SELECT DISTINCT output_path FROM processed WHERE profile = ?", + (profile,), + ).fetchall() + return [r[0] for r in rows] + def hide_file(self, filename: str, profile: str = "default") -> None: if not self._enabled: return diff --git a/tests/test_audio_scan.py b/tests/test_audio_scan.py index 2e96e64..52e534c 100644 --- a/tests/test_audio_scan.py +++ b/tests/test_audio_scan.py @@ -118,3 +118,18 @@ def test_scan_video_high_threshold_no_match(): finally: os.unlink(ref.name) os.unlink(vid.name) + + +def test_db_get_all_export_paths(): + with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as f: + path = f.name + try: + from core.db import ProcessedDB + db = ProcessedDB(path) + db.add("a.mp4", 10.0, "/out/a_001.mp4", profile="test") + db.add("b.mp4", 20.0, "/out/b_001.mp4", profile="test") + db.add("c.mp4", 30.0, "/out/c_001.mp4", profile="other") + paths = db.get_all_export_paths("test") + assert set(paths) == {"/out/a_001.mp4", "/out/b_001.mp4"} + finally: + os.unlink(path)