add download now to form
This commit is contained in:
parent
efca460e9d
commit
280c773441
|
@ -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"""
|
||||
|
|
|
@ -20,11 +20,12 @@
|
|||
<img id="animate-icon" onclick="showForm()" src="{% static 'img/icon-add.svg' %}" alt="add-icon">
|
||||
<p>Add to download queue</p>
|
||||
<div class="show-form">
|
||||
<form id='hidden-form'>
|
||||
<div id='hidden-form' novalidate>
|
||||
{% csrf_token %}
|
||||
{{ add_form }}
|
||||
<button onclick="addToQueue()">Add to download queue</button>
|
||||
</form>
|
||||
<button onclick="addToQueue()">Add to queue</button>
|
||||
<button onclick="addToQueue(true)">Download now</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -369,6 +369,10 @@ button:hover {
|
|||
display: none;
|
||||
}
|
||||
|
||||
#hidden-form button {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
#text-reveal {
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue