From 09556dbf21a26fe7b649e7568dae159f0fe70dd5 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 22 Dec 2022 19:57:19 +0700 Subject: [PATCH] switch deleteQueue to API call --- tubearchivist/home/src/frontend/api_calls.py | 9 --------- tubearchivist/static/script.js | 6 +++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/tubearchivist/home/src/frontend/api_calls.py b/tubearchivist/home/src/frontend/api_calls.py index 4e0a92c..48df366 100644 --- a/tubearchivist/home/src/frontend/api_calls.py +++ b/tubearchivist/home/src/frontend/api_calls.py @@ -4,7 +4,6 @@ Functionality: - called via user input """ -from home.src.download.queue import PendingInteract from home.src.download.subscriptions import ( ChannelSubscription, PlaylistSubscription, @@ -62,7 +61,6 @@ class PostData: "show_subed_only": self._show_subed_only, "dlnow": self._dlnow, "show_ignored_only": self._show_ignored_only, - "deleteQueue": self._delete_queue, "manual-import": self._manual_import, "re-embed": self._re_embed, "db-backup": self._db_backup, @@ -212,13 +210,6 @@ class PostData: RedisArchivist().set_message(key, value) return {"success": True} - def _delete_queue(self): - """delete download queue""" - status = self.exec_val - print("deleting from download queue: " + status) - PendingInteract(status=status).delete_by_status() - return {"success": True} - @staticmethod def _manual_import(): """run manual import from settings page""" diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 4ec6dea..1883c01 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -204,7 +204,7 @@ function downloadNow(button) { function forgetIgnore(button) { let youtube_id = button.getAttribute('data-id'); let apiEndpoint = '/api/download/' + youtube_id + '/'; - apiRequest(apiEndpoint, "DELETE"); + apiRequest(apiEndpoint, 'DELETE'); document.getElementById('dl-' + youtube_id).remove(); } @@ -220,8 +220,8 @@ function addSingle(button) { function deleteQueue(button) { let to_delete = button.getAttribute('data-id'); - let payload = JSON.stringify({ deleteQueue: to_delete }); - sendPost(payload); + let apiEndpoint = '/api/download/?filter=' + to_delete; + apiRequest(apiEndpoint, 'DELETE'); // clear button let message = document.createElement('p'); message.innerText = 'deleting download queue: ' + to_delete;