diff --git a/core/db.py b/core/db.py index 08244fb..fdedadc 100644 --- a/core/db.py +++ b/core/db.py @@ -418,6 +418,21 @@ class ProcessedDB: pass return max_n + def delete_scan_exports(self, filename: str, profile: str) -> int: + """Delete all scan_export entries for *filename* in *profile*. + + Returns the number of rows deleted. + """ + if not self._enabled: + return 0 + cur = self._con.execute( + "DELETE FROM processed" + " WHERE filename = ? AND profile = ? AND scan_export = 1", + (filename, profile), + ) + self._con.commit() + return cur.rowcount + def get_vid_folder(self, filename: str, profile: str, export_folder: str) -> str: """Return the vid_NNN folder name for a source video. diff --git a/main.py b/main.py index 1f43ce7..f617da8 100755 --- a/main.py +++ b/main.py @@ -4666,6 +4666,13 @@ class MainWindow(QMainWindow): self._auto_export_no_markers = batch["is_scan"] self._export_batch_file = batch["file_path"] + # Replace old scan export entries for this video + if batch["is_scan"]: + fname = os.path.basename(batch["file_path"]) + n_old = self._db.delete_scan_exports(fname, batch["profile"]) + if n_old: + _log(f"Replacing {n_old} old scan export entries for {fname}") + n_queued = len(self._export_queue) q_msg = f" ({n_queued} queued)" if n_queued else "" self._show_status(f"Auto: exporting {len(batch['jobs'])} clips...{q_msg}")