Skip to content

Commit

Permalink
Will prevent duplicate tasks in folder watch (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus authored Aug 3, 2024
1 parent 326ffbc commit 3c78593
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions buzz/widgets/transcription_task_folder_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
):
super().__init__(parent)
self.tasks = tasks
self.paths_emitted = set()
self.set_preferences(preferences)
self.directoryChanged.connect(self.find_tasks)

Expand All @@ -46,6 +47,7 @@ def find_tasks(self):
if (
filename.startswith(".") # hidden files
or file_path in tasks # file already in tasks
or file_path in self.paths_emitted # file already emitted
):
continue

Expand All @@ -67,6 +69,7 @@ def find_tasks(self):
source=FileTranscriptionTask.Source.FOLDER_WATCH,
)
self.task_found.emit(task)
self.paths_emitted.add(file_path)

# Don't traverse into subdirectories
break

0 comments on commit 3c78593

Please sign in to comment.