switch deleteQueue to API call

This commit is contained in:
simon 2022-12-22 19:57:19 +07:00
parent 470ecb007d
commit 09556dbf21
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 3 additions and 12 deletions

View File

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

View File

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