implement api-stop for download_pending

This commit is contained in:
simon 2023-03-23 10:48:43 +07:00
parent 860213c427
commit 33b9a012d4
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
3 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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",