From c165f152a9f862b277cb93f5cc75425656590469 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 25 Sep 2021 17:40:33 +0700 Subject: [PATCH] allowing to cancle download_now tasks --- tubearchivist/home/views.py | 5 ++++- tubearchivist/static/script.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py index 633dd03..44c8324 100644 --- a/tubearchivist/home/views.py +++ b/tubearchivist/home/views.py @@ -573,7 +573,10 @@ class PostData: """start downloading single vid now""" youtube_id = self.exec_val print("downloading: " + youtube_id) - download_single.delay(youtube_id=youtube_id) + running = download_single.delay(youtube_id=youtube_id) + task_id = running.id + print("set task id: " + task_id) + set_message("dl_queue_id", task_id, expire=False) return {"success": True} @staticmethod diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index cdc452e..3acf91c 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -76,6 +76,7 @@ function downloadNow(button) { document.getElementById(youtube_id).remove(); setTimeout(function(){ handleInterval(); + buildDownloadIcons(); }, 500); }