diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py index 1ff7917a..006b7a04 100644 --- a/tubearchivist/home/src/download/queue.py +++ b/tubearchivist/home/src/download/queue.py @@ -273,7 +273,7 @@ class PendingList(PendingIndex): # add last newline bulk_list.append("\n") query_str = "\n".join(bulk_list) - _, _ = ElasticWrap("_bulk").post(query_str, ndjson=True) + _, _ = ElasticWrap("_bulk?refresh=true").post(query_str, ndjson=True) def _notify_add(self, idx, total): """send notification for adding videos to download queue""" diff --git a/tubearchivist/home/templates/home/downloads.html b/tubearchivist/home/templates/home/downloads.html index a1d9be29..59f4f039 100644 --- a/tubearchivist/home/templates/home/downloads.html +++ b/tubearchivist/home/templates/home/downloads.html @@ -20,11 +20,12 @@ add-icon

Add to download queue

-
+
{% csrf_token %} {{ add_form }} - - + + +
diff --git a/tubearchivist/static/css/style.css b/tubearchivist/static/css/style.css index 07b59c00..9ece9873 100644 --- a/tubearchivist/static/css/style.css +++ b/tubearchivist/static/css/style.css @@ -369,6 +369,10 @@ button:hover { display: none; } +#hidden-form button { + margin-right: 1rem; +} + #text-reveal { height: 0; overflow: hidden; diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 59161447..cc770741 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -160,18 +160,22 @@ function dlPending() { }, 500); } -function addToQueue() { +function addToQueue(autostart=false) { let textArea = document.getElementById('id_vid_url'); if (textArea.value === '') { return } let toPost = {data: [{youtube_id: textArea.value, status: 'pending'}]}; let apiEndpoint = '/api/download/'; + if (autostart) { + apiEndpoint = `${apiEndpoint}?autostart=true`; + } apiRequest(apiEndpoint, 'POST', toPost); - textArea.value = ""; + textArea.value = ''; setTimeout(function () { checkMessages(); }, 500); + showForm(); } function toIgnore(button) {