diff --git a/tubearchivist/home/src/download/yt_dlp_handler.py b/tubearchivist/home/src/download/yt_dlp_handler.py index 6dfa4fd6..5c29c9e9 100644 --- a/tubearchivist/home/src/download/yt_dlp_handler.py +++ b/tubearchivist/home/src/download/yt_dlp_handler.py @@ -174,7 +174,7 @@ class VideoDownloader: while True: youtube_data = queue.get_next() - if not youtube_data: + if self.task.is_stopped() or not youtube_data: break youtube_data = json.loads(youtube_data) diff --git a/tubearchivist/home/src/ta/task_manager.py b/tubearchivist/home/src/ta/task_manager.py index c3d1a2a1..a47a6273 100644 --- a/tubearchivist/home/src/ta/task_manager.py +++ b/tubearchivist/home/src/ta/task_manager.py @@ -43,7 +43,6 @@ class TaskManager: def is_stopped(self, task_id): """check if task_id has received STOP command""" task = self.get_task(task_id) - print(task) return task.get("command") == "STOP" diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index 5c307205..066ccb8b 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -59,6 +59,7 @@ class BaseTask(Task): "title": "Downloading", "group": "download:run", "api-start": True, + "api-stop": True, }, "extract_download": { "title": "Add to download queue",