From 8a3aaf9aba5350a6b2ea8bf9f2e859de6e76499b Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 14 Apr 2020 12:58:31 +0200 Subject: [PATCH] Fixed downloading related issues - Fixed album cover download and saving - Fixed download list initialization on reload - Adjusted download object layout --- public/css/style.css | 7 +++++-- public/js/downloadList.js | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index aef1d90..a02d352 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -265,7 +265,6 @@ div#download_tab{ #download_list > .download_object .download_info_status{ margin-left: 8px; width: 80px; - text-align: right; } #download_list.slim > .download_object .download_info img{ display: none; @@ -277,7 +276,7 @@ div#download_tab{ display: inline-block; } #download_list.slim > .download_object .download_info_data{ - width: calc(80% - 8px); + width: calc(80% - 16px); display: inline-block; padding-left: 0px; } @@ -389,6 +388,10 @@ p, .tracks_table td.breakline{ display: flex; align-items:center; } +.secondary-text .material-icons{ + font-size: 17px !important; + margin-left: 4px; +} button{ font-family : inherit; font-weight: 600; diff --git a/public/js/downloadList.js b/public/js/downloadList.js index 8b301ee..7b2bc2d 100644 --- a/public/js/downloadList.js +++ b/public/js/downloadList.js @@ -2,6 +2,14 @@ var queueList = {} var queue = [] socket.on("init_downloadQueue", function(data){ + if (data.currentItem){ + addToQueue(data['queueList'][data.currentItem]) + $('#bar_' + data.currentItem).removeClass('indeterminate').addClass('determinate') + $('#bar_' + data.currentItem).css('width', data['queueList'][data.currentItem].progress + '%') + if (queueList[data.currentItem].failed >= 1){ + $("#download_"+data.currentItem+" .download_info_status").append(`(${queueList[data.currentItem].failed}error_outline)`) + } + } data['queue'].forEach(item=>{ addToQueue(data['queueList'][item]) }) @@ -19,7 +27,7 @@ function addToQueue(queueItem){ ${queueItem.artist}
- 0/${queueItem.size} + ${queueItem.downloaded + queueItem.failed}/${queueItem.size}
@@ -75,7 +83,7 @@ socket.on("finishDownload", function(uuid){ delete queueList[uuid] } if (queue.length <= 0){ - toast('All downloads completed!', 'all_done') + toast('All downloads completed!', 'done_all') } } }) @@ -90,12 +98,13 @@ socket.on("updateQueue", function(update){ if (update.uuid && queue.indexOf(update.uuid) > -1){ if (update.downloaded){ queueList[update.uuid].downloaded++ - $("#download_"+update.uuid+" .queue_downloaded").text(queueList[update.uuid].downloaded) + $("#download_"+update.uuid+" .queue_downloaded").text(queueList[update.uuid].downloaded + queueList[update.uuid].failed) } if (update.failed){ queueList[update.uuid].failed++ + $("#download_"+update.uuid+" .queue_downloaded").text(queueList[update.uuid].downloaded + queueList[update.uuid].failed) if (queueList[update.uuid].failed == 1){ - $("#download_"+update.uuid+" .download_info_status").append(`(1 error_outline)`) + $("#download_"+update.uuid+" .download_info_status").append(`(1 error_outline)`) }else{ $("#download_"+update.uuid+" .queue_failed").text(queueList[update.uuid].failed) }