Fixed some issues and added some stuff
This commit is contained in:
parent
68a2bae6bf
commit
cc3981bbee
@ -1,7 +1,13 @@
|
|||||||
var queueList = {}
|
var queueList = {}
|
||||||
var queue = []
|
var queue = []
|
||||||
|
|
||||||
socket.on("addedToQueue", function(queueItem){
|
socket.on("init_downloadQueue", function(data){
|
||||||
|
data['queue'].forEach(item=>{
|
||||||
|
addToQueue(data['queueList'][item])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function addToQueue(queueItem){
|
||||||
queueList[queueItem.uuid] = queueItem
|
queueList[queueItem.uuid] = queueItem
|
||||||
queue.push(queueItem.uuid)
|
queue.push(queueItem.uuid)
|
||||||
$("#download_list").append(
|
$("#download_list").append(
|
||||||
@ -21,6 +27,10 @@ socket.on("addedToQueue", function(queueItem){
|
|||||||
<i onclick="downloadAction(event)" class="material-icons queue_icon" data-uuid="${queueItem.uuid}">remove</i>
|
<i onclick="downloadAction(event)" class="material-icons queue_icon" data-uuid="${queueItem.uuid}">remove</i>
|
||||||
</div>
|
</div>
|
||||||
</div>`)
|
</div>`)
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on("addedToQueue", function(queueItem){
|
||||||
|
addToQueue(queueItem)
|
||||||
})
|
})
|
||||||
|
|
||||||
function downloadAction(evt){
|
function downloadAction(evt){
|
||||||
@ -51,6 +61,19 @@ socket.on("finishDownload", function(uuid){
|
|||||||
console.log(uuid+" finished downloading")
|
console.log(uuid+" finished downloading")
|
||||||
toast(`${queueList[uuid].title} finished downloading.`)
|
toast(`${queueList[uuid].title} finished downloading.`)
|
||||||
$('#bar_' + uuid).css('width', '100%')
|
$('#bar_' + uuid).css('width', '100%')
|
||||||
|
let result_icon = $('download_'+uuid).find('.queue_icon')
|
||||||
|
if (queueList[uuid].failed == 0){
|
||||||
|
result_icon.text("done")
|
||||||
|
}else if (queueList[uuid].failed >= queueList[uuid].size){
|
||||||
|
result_icon.text("error")
|
||||||
|
}else{
|
||||||
|
result_icon.text("warning")
|
||||||
|
}
|
||||||
|
let index = queue.indexOf(uuid)
|
||||||
|
if (index > -1){
|
||||||
|
queue.splice(index, 1)
|
||||||
|
delete queueList[uuid]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on("removedAllDownloads", function(){
|
socket.on("removedAllDownloads", function(){
|
||||||
@ -69,7 +92,7 @@ socket.on("updateQueue", function(update){
|
|||||||
if (update.failed){
|
if (update.failed){
|
||||||
queueList[update.uuid].failed++
|
queueList[update.uuid].failed++
|
||||||
if (queueList[update.uuid].failed == 1){
|
if (queueList[update.uuid].failed == 1){
|
||||||
$("#download_"+update.uuid+" .download_info_status").append(`<span class="secondary-text"><span class="download_slim_separator">(</span><span class="queue_failed">1</span> Failed<span class="download_slim_separator">)</span></span>`)
|
$("#download_"+update.uuid+" .download_info_status").append(`<span class="secondary-text"><span class="download_slim_separator">(</span><span class="queue_failed">1</span> <i class="material-icons">error_outline</i><span class="download_slim_separator">)</span></span>`)
|
||||||
}else{
|
}else{
|
||||||
$("#download_"+update.uuid+" .queue_failed").text(queueList[update.uuid].failed)
|
$("#download_"+update.uuid+" .queue_failed").text(queueList[update.uuid].failed)
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,6 @@ search_selected = ""
|
|||||||
main_selected=""
|
main_selected=""
|
||||||
// toasts stuff
|
// toasts stuff
|
||||||
toastsWithId = {}
|
toastsWithId = {}
|
||||||
// track previews stuff
|
|
||||||
let preview_track = document.getElementById('preview-track')
|
|
||||||
let preview_stopped = true
|
|
||||||
let preview_max_volume;
|
|
||||||
|
|
||||||
preview_track.volume = 0
|
|
||||||
preview_max_volume = parseFloat(localStorage.getItem("previewVolume"))
|
|
||||||
if (preview_max_volume === null){
|
|
||||||
preview_max_volume = 0.8
|
|
||||||
localStorage.setItem("previewVolume", preview_max_volume)
|
|
||||||
}
|
|
||||||
|
|
||||||
function toast(msg, icon=null, dismiss=true, id=null){
|
function toast(msg, icon=null, dismiss=true, id=null){
|
||||||
if (toastsWithId[id]){
|
if (toastsWithId[id]){
|
||||||
@ -71,7 +60,6 @@ window.addEventListener('pywebviewready', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
socket.emit("init");
|
|
||||||
if (localStorage.getItem("arl")){
|
if (localStorage.getItem("arl")){
|
||||||
socket.emit("login", localStorage.getItem("arl"));
|
socket.emit("login", localStorage.getItem("arl"));
|
||||||
$("#login_input_arl").val(localStorage.getItem("arl"))
|
$("#login_input_arl").val(localStorage.getItem("arl"))
|
||||||
|
Loading…
Reference in New Issue
Block a user