Export Worker
app.infrastructure.export.export_workerBackground video export worker with progress callbacks and cancellation support.
See Also
ExportService— configures export requestsExportAllWorker— coordinates exports across sessions
Layer: Infrastructure. Context: Implements concrete processing and I/O behind application-facing contracts.
ExportCancelled
Bases: Exception
Raised inside the export callback when the user cancels export (via stop()).
Layer: Infrastructure. Context: Implements concrete processing or I/O behind application-facing contracts.
ExportWorker
Bases: QThread
Background QThread that renders and exports a video session with blurred regions.
| ATTRIBUTE | DESCRIPTION |
|---|---|
_export_service |
Application service that renders the video.
TYPE:
|
_s_id |
Session identifier being exported.
TYPE:
|
_output_path |
Destination file path for the exported video.
TYPE:
|
_stop_requested |
True after
TYPE:
|
Note
Signals emitted by this worker: progress_updated(current_frame, total_frames): Per-frame progress callback. succeeded(): Emitted on successful export completion. finished_processing(): Emitted when the thread exits. cancelled(): Emitted if the user cancels export. error_occurred(msg): Emitted on exception.
Workflow:
1. run() calls export_service.export_session().
2. The progress callback emits progress_updated() for each frame.
3. If stop() is called, the callback raises ExportCancelled and the
thread emits cancelled().
4. On success, emit succeeded().
5. On error, emit error_occurred().
6. Always emit finished_processing() before exit.
Example
worker = ExportWorker(export_service, s_id, "output.mp4") worker.finished_processing.connect(on_finished) worker.start() worker.stop()
| PARAMETER | DESCRIPTION |
|---|---|
export_service
|
Service that renders the session export.
TYPE:
|
s_id
|
Identifier of the session associated with this object.
TYPE:
|
output_path
|
Destination path for the exported video.
TYPE:
|
parent
|
Optional Qt parent object.
TYPE:
|
cancelled = Signal()
class-attribute
instance-attribute
error_occurred = Signal(str)
class-attribute
instance-attribute
finished_processing = Signal()
class-attribute
instance-attribute
progress_updated = Signal(int, int)
class-attribute
instance-attribute
succeeded = Signal()
class-attribute
instance-attribute
__init__(export_service: ExportService, s_id: SessionId, output_path: str, parent: QObject | None = None) -> None
run() -> None
Main thread loop — export video session with blur overlays.
Note
Workflow:
1. Call export_service.export_session(s_id, output_path, callback).
2. The callback emits progress signals and checks _stop_requested.
3. If cancelled, catch ExportCancelled and emit cancelled().
4. On success, emit succeeded().
5. On error, emit error_occurred(msg).
6. Finally, emit finished_processing().
stop() -> None
Request early stop (next progress callback will raise ExportCancelled).