From 6dc73ac69e9936bcee444343984065e5b2bd6ee9 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 1 Jun 2021 20:24:26 +0200 Subject: [PATCH] Update downloadObject size after conversion --- public/js/bundle.js | 4 ++-- src/components/downloads/TheDownloadBar.vue | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/bundle.js b/public/js/bundle.js index 54c4715..8cb736d 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -2906,13 +2906,13 @@ a { .toastify .circle-loader { border-bottom-color: var(--toast-secondary); } -`;styleInject(css_248z);const sharedOptions={gravity:"bottom",position:"left"},toastsWithId={},toast=function(e,a=null,n=!0,i=null){if(toastsWithId[i]){const r=toastsWithId[i],s=document.querySelectorAll(`div.toastify[toast_id=${i}]`);if(e&&s.forEach(l=>{l.querySelectorAll(".toast-message").forEach(o=>{o.innerText=e})}),a){const l=document.createElement("span");if(l.classList.add("toast-icon"),a=="loading"){const c=document.createElement("div");c.classList.add("circle-loader"),l.appendChild(c)}else{const c=document.createElement("i");c.classList.add("material-icons"),c.appendChild(document.createTextNode(a)),l.appendChild(c)}s.forEach(c=>{c.querySelectorAll(".toast-icon").forEach(u=>{u.parentNode.replaceChild(l,u)})})}n!==null&&n&&(s.forEach(l=>{l.classList.add("dismissable")}),setTimeout(()=>{r.hideToast(),delete toastsWithId[i]},3e3))}else{const r=document.createElement("span");if(r.classList.add("toast-icon"),a==null)r.appendChild(document.createTextNode(""));else if(a=="loading"){const o=document.createElement("div");o.classList.add("circle-loader"),r.appendChild(o)}else{const o=document.createElement("i");o.classList.add("material-icons"),o.appendChild(document.createTextNode(a)),r.appendChild(o)}const s=document.createElement("span");s.classList.add("toast-message"),s.appendChild(document.createTextNode(e));const l=document.createElement("toast");l.appendChild(r),l.appendChild(s);const c=toastify({...sharedOptions,node:l,duration:n?3e3:0,className:n?"dismissable":"",onClick(){let o=!0;if(i){const u=document.querySelector(`div.toastify[toast_id=${i}]`).classList;u&&(o=Array.prototype.slice.call(u).includes("dismissable"))}c&&o&&(c.hideToast(),i&&delete toastsWithId[i])},offset:{x:localStorage.getItem("slimSidebar")==="true"?"3rem":"14rem"}}).showToast();i&&(toastsWithId[i]=c,c.toastElement.setAttribute("toast_id",i))}};socket.on("toast",e=>{const{msg:a,icon:n,dismiss:i,id:r}=e;toast(a,n||null,i!==void 0?i:!0,r||null)});const tabMinWidth=250,tabMaxWidth=500;var script$n={components:{QueueItem},data(){return{cachedTabWidth:parseInt(localStorage.getItem("downloadTabWidth"))||300,queue:[],queueList:{},queueComplete:[],isExpanded:localStorage.getItem("downloadTabOpen")==="true"}},computed:{...mapGetters({clientMode:"getClientMode",isSlim:"getSlimDownloads"}),finishedWithoutErrors(){const e=a=>a.errors.length===0;return Object.values(this.queueList).filter(e)}},created(){const e=a=>{!(a.ctrlKey&&a.key==="b")||this.toggleDownloadTab()};document.addEventListener("keyup",e),this.$on("hook:destroyed",()=>{document.removeEventListener("keyup",e)})},mounted(){socket.on("startDownload",this.startDownload),socket.on("startConversion",this.startConversion),socket.on("addedToQueue",this.addToQueue),socket.on("updateQueue",this.updateQueue),socket.on("removedFromQueue",this.removeFromQueue),socket.on("finishDownload",this.finishDownload),socket.on("removedAllDownloads",this.removeAllDownloads),socket.on("removedFinishedDownloads",this.removedFinishedDownloads),fetchData("getQueue").then(e=>{this.initQueue(e)}).catch(console.error),localStorage.getItem("slimDownloads")==="true"&&this.$refs.list.classList.add("slim"),this.isExpanded&&this.setTabWidth(this.cachedTabWidth),document.addEventListener("mouseup",()=>{document.removeEventListener("mousemove",this.handleDrag)}),window.addEventListener("beforeunload",()=>{localStorage.setItem("downloadTabWidth",this.cachedTabWidth)})},methods:{...mapActions(["setErrors"]),onRemoveItem(e){socket.emit("removeFromQueue",e)},setTabWidth(e){e===void 0?(this.$refs.container.style.width="",this.$refs.list.style.width=""):(this.$refs.container.style.width=e+"px",this.$refs.list.style.width=e+"px")},initQueue(e){const{order:a,currentItem:n,queue:i,restored:r}=e;console.log({initQueueList:i});const s=Object.values(i).filter(l=>["completed","withErrors","failed"].includes(l.status)).map(l=>l.uuid);console.log({initQueueComplete:s}),s&&s.length&&s.forEach(l=>{i[l].silent=!0,this.addToQueue(i[l])}),n&&(n.silent=!0,this.addToQueue(n,!0)),a.forEach(l=>{i[l].silent=!0,this.addToQueue(i[l])}),r&&(toast(this.$t("toasts.queueRestored"),"done",!0,"restoring_queue"),socket.emit("queueRestored"))},addToQueue(e,a=!1){if(Array.isArray(e))if(e.length>1){e.forEach((r,s)=>{r.silent=!0,this.addToQueue(r)}),toast(this.$t("toasts.addedMoreToQueue",{n:e.length}),"playlist_add_check");return}else e=e[0];if(e.downloaded=e.downloaded||0,e.failed=e.failed||0,e.progress=e.progress||0,e.conversion=e.conversion||0,e.errors=e.errors||[],this.$set(e,"current",a),this.$set(this.queueList,e.uuid,e),e.downloaded+e.failed==e.size){const r=!this.queueComplete.includes(e.uuid);this.$set(this.queueList[e.uuid],"status","download finished"),r&&this.queueComplete.push(e.uuid)}else!this.queue.includes(e.uuid)&&this.queue.push(e.uuid);(e.progress>0&&e.progress<100||a)&&this.startDownload(e.uuid),e.silent||toast(this.$t("toasts.addedToQueue",{item:e.title}),"playlist_add_check")},updateQueue(e){const{uuid:a,downloaded:n,failed:i,progress:r,conversion:s,error:l,data:c,errid:o}=e;a&&this.queue.includes(a)&&(n&&this.queueList[a].downloaded++,i&&(this.queueList[a].failed++,this.queueList[a].errors.push({message:l,data:c,errid:o})),r&&(this.queueList[a].progress=r),s&&(this.queueList[a].conversion=s))},removeFromQueue(e){const a=this.queue.indexOf(e);a>-1&&(this.$delete(this.queue,a),this.$delete(this.queueList,e))},removeAllDownloads(e){if(this.queueComplete=[],!e)this.queue=[],this.queueList={};else{this.queue=[e];const a=this.queueList[e];this.queueList={},this.queueList[e]=a}},removedFinishedDownloads(){this.queueComplete=this.finishedWithoutErrors.map(e=>e.uuid),this.queueComplete.forEach(e=>{this.$delete(this.queueList,e)}),this.queueComplete=[]},toggleDownloadTab(){this.setTabWidth(),this.$refs.container.style.transition="all 250ms ease-in-out",this.isExpanded=!this.isExpanded,this.isExpanded&&this.setTabWidth(this.cachedTabWidth),localStorage.setItem("downloadTabOpen",this.isExpanded)},cleanQueue(){socket.emit("removeFinishedDownloads")},cancelQueue(){socket.emit("cancelAllDownloads")},openDownloadsFolder(){window.api.send("openDownloadsFolder")},handleDrag(e){let a=window.innerWidth-e.pageX+2;atabMaxWidth&&(a=tabMaxWidth),this.cachedTabWidth=a,this.setTabWidth(a)},startDrag(){document.addEventListener("mousemove",this.handleDrag)},startDownload(e){this.$set(this.queueList[e],"status","downloading")},finishDownload(e){if(!this.queue.includes(e))return;this.$set(this.queueList[e],"status","download finished"),toast(this.$t("toasts.finishDownload",{item:this.queueList[e].title}),"done");const n=this.queue.indexOf(e);n>-1&&(this.queue.splice(n,1),this.queueComplete.push(e)),this.queue.length<=0&&toast(this.$t("toasts.allDownloaded"),"done_all")},startConversion(e){this.$set(this.queueList[e],"status","converting"),this.$set(this.queueList[e],"conversion",0)},async showErrorsTab(e){await this.setErrors(e),this.$router.push({name:"Errors"})}}};const __vue_script__$n=script$n;var __vue_render__$n=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("section",{ref:"container",staticClass:"block h-screen bg-panels-bg text-foreground",class:{"tab-hidden":!e.isExpanded,"w-8":!e.isExpanded},attrs:{id:"download_tab_container","data-label":e.$t("downloads"),"aria-label":"downloads"},on:{transitionend:function(i){e.$refs.container.style.transition=""}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.isExpanded,expression:"isExpanded"}],staticClass:"absolute w-4 h-full bg-grayscale-200",staticStyle:{cursor:"ew-resize"},on:{mousedown:function(i){return i.preventDefault(),e.startDrag(i)}}}),e._v(" "),n("i",{ref:"toggler",staticClass:"m-1 text-2xl cursor-pointer material-icons",class:{"ml-1":!e.isExpanded,"ml-5":e.isExpanded},attrs:{id:"toggle_download_tab",title:e.$t("globals.toggle_download_tab_hint")},on:{click:function(i){return i.preventDefault(),e.toggleDownloadTab(i)}}}),e._v(" "),n("div",{staticClass:"absolute top-0 right-0 transition-all duration-200 ease-in-out",class:{"opacity-0 invisible":!e.isExpanded,"opacity-100 visible":e.isExpanded}},[e.clientMode?n("i",{staticClass:"m-1 text-2xl cursor-pointer material-icons",attrs:{title:e.$t("globals.open_downloads_folder")},on:{click:e.openDownloadsFolder}},[e._v(` +`;styleInject(css_248z);const sharedOptions={gravity:"bottom",position:"left"},toastsWithId={},toast=function(e,a=null,n=!0,i=null){if(toastsWithId[i]){const r=toastsWithId[i],s=document.querySelectorAll(`div.toastify[toast_id=${i}]`);if(e&&s.forEach(l=>{l.querySelectorAll(".toast-message").forEach(o=>{o.innerText=e})}),a){const l=document.createElement("span");if(l.classList.add("toast-icon"),a=="loading"){const c=document.createElement("div");c.classList.add("circle-loader"),l.appendChild(c)}else{const c=document.createElement("i");c.classList.add("material-icons"),c.appendChild(document.createTextNode(a)),l.appendChild(c)}s.forEach(c=>{c.querySelectorAll(".toast-icon").forEach(u=>{u.parentNode.replaceChild(l,u)})})}n!==null&&n&&(s.forEach(l=>{l.classList.add("dismissable")}),setTimeout(()=>{r.hideToast(),delete toastsWithId[i]},3e3))}else{const r=document.createElement("span");if(r.classList.add("toast-icon"),a==null)r.appendChild(document.createTextNode(""));else if(a=="loading"){const o=document.createElement("div");o.classList.add("circle-loader"),r.appendChild(o)}else{const o=document.createElement("i");o.classList.add("material-icons"),o.appendChild(document.createTextNode(a)),r.appendChild(o)}const s=document.createElement("span");s.classList.add("toast-message"),s.appendChild(document.createTextNode(e));const l=document.createElement("toast");l.appendChild(r),l.appendChild(s);const c=toastify({...sharedOptions,node:l,duration:n?3e3:0,className:n?"dismissable":"",onClick(){let o=!0;if(i){const u=document.querySelector(`div.toastify[toast_id=${i}]`).classList;u&&(o=Array.prototype.slice.call(u).includes("dismissable"))}c&&o&&(c.hideToast(),i&&delete toastsWithId[i])},offset:{x:localStorage.getItem("slimSidebar")==="true"?"3rem":"14rem"}}).showToast();i&&(toastsWithId[i]=c,c.toastElement.setAttribute("toast_id",i))}};socket.on("toast",e=>{const{msg:a,icon:n,dismiss:i,id:r}=e;toast(a,n||null,i!==void 0?i:!0,r||null)});const tabMinWidth=250,tabMaxWidth=500;var script$n={components:{QueueItem},data(){return{cachedTabWidth:parseInt(localStorage.getItem("downloadTabWidth"))||300,queue:[],queueList:{},queueComplete:[],isExpanded:localStorage.getItem("downloadTabOpen")==="true"}},computed:{...mapGetters({clientMode:"getClientMode",isSlim:"getSlimDownloads"}),finishedWithoutErrors(){const e=a=>a.errors.length===0;return Object.values(this.queueList).filter(e)}},created(){const e=a=>{!(a.ctrlKey&&a.key==="b")||this.toggleDownloadTab()};document.addEventListener("keyup",e),this.$on("hook:destroyed",()=>{document.removeEventListener("keyup",e)})},mounted(){socket.on("startDownload",this.startDownload),socket.on("startConversion",this.startConversion),socket.on("finishConversion",this.finishConversion),socket.on("addedToQueue",this.addToQueue),socket.on("updateQueue",this.updateQueue),socket.on("removedFromQueue",this.removeFromQueue),socket.on("finishDownload",this.finishDownload),socket.on("removedAllDownloads",this.removeAllDownloads),socket.on("removedFinishedDownloads",this.removedFinishedDownloads),fetchData("getQueue").then(e=>{this.initQueue(e)}).catch(console.error),localStorage.getItem("slimDownloads")==="true"&&this.$refs.list.classList.add("slim"),this.isExpanded&&this.setTabWidth(this.cachedTabWidth),document.addEventListener("mouseup",()=>{document.removeEventListener("mousemove",this.handleDrag)}),window.addEventListener("beforeunload",()=>{localStorage.setItem("downloadTabWidth",this.cachedTabWidth)})},methods:{...mapActions(["setErrors"]),onRemoveItem(e){socket.emit("removeFromQueue",e)},setTabWidth(e){e===void 0?(this.$refs.container.style.width="",this.$refs.list.style.width=""):(this.$refs.container.style.width=e+"px",this.$refs.list.style.width=e+"px")},initQueue(e){const{order:a,currentItem:n,queue:i,restored:r}=e;console.log({initQueueList:i});const s=Object.values(i).filter(l=>["completed","withErrors","failed"].includes(l.status)).map(l=>l.uuid);console.log({initQueueComplete:s}),s&&s.length&&s.forEach(l=>{i[l].silent=!0,this.addToQueue(i[l])}),n&&(n.silent=!0,this.addToQueue(n,!0)),a.forEach(l=>{i[l].silent=!0,this.addToQueue(i[l])}),r&&(toast(this.$t("toasts.queueRestored"),"done",!0,"restoring_queue"),socket.emit("queueRestored"))},addToQueue(e,a=!1){if(Array.isArray(e))if(e.length>1){e.forEach((r,s)=>{r.silent=!0,this.addToQueue(r)}),toast(this.$t("toasts.addedMoreToQueue",{n:e.length}),"playlist_add_check");return}else e=e[0];if(e.downloaded=e.downloaded||0,e.failed=e.failed||0,e.progress=e.progress||0,e.conversion=e.conversion||0,e.errors=e.errors||[],this.$set(e,"current",a),this.$set(this.queueList,e.uuid,e),e.downloaded+e.failed==e.size){const r=!this.queueComplete.includes(e.uuid);this.$set(this.queueList[e.uuid],"status","download finished"),r&&this.queueComplete.push(e.uuid)}else!this.queue.includes(e.uuid)&&this.queue.push(e.uuid);(e.progress>0&&e.progress<100||a)&&this.startDownload(e.uuid),e.silent||toast(this.$t("toasts.addedToQueue",{item:e.title}),"playlist_add_check")},updateQueue(e){const{uuid:a,downloaded:n,failed:i,progress:r,conversion:s,error:l,data:c,errid:o}=e;a&&this.queue.includes(a)&&(n&&this.queueList[a].downloaded++,i&&(this.queueList[a].failed++,this.queueList[a].errors.push({message:l,data:c,errid:o})),r&&(this.queueList[a].progress=r),s&&(this.queueList[a].conversion=s))},removeFromQueue(e){const a=this.queue.indexOf(e);a>-1&&(this.$delete(this.queue,a),this.$delete(this.queueList,e))},removeAllDownloads(e){if(this.queueComplete=[],!e)this.queue=[],this.queueList={};else{this.queue=[e];const a=this.queueList[e];this.queueList={},this.queueList[e]=a}},removedFinishedDownloads(){this.queueComplete=this.finishedWithoutErrors.map(e=>e.uuid),this.queueComplete.forEach(e=>{this.$delete(this.queueList,e)}),this.queueComplete=[]},toggleDownloadTab(){this.setTabWidth(),this.$refs.container.style.transition="all 250ms ease-in-out",this.isExpanded=!this.isExpanded,this.isExpanded&&this.setTabWidth(this.cachedTabWidth),localStorage.setItem("downloadTabOpen",this.isExpanded)},cleanQueue(){socket.emit("removeFinishedDownloads")},cancelQueue(){socket.emit("cancelAllDownloads")},openDownloadsFolder(){window.api.send("openDownloadsFolder")},handleDrag(e){let a=window.innerWidth-e.pageX+2;atabMaxWidth&&(a=tabMaxWidth),this.cachedTabWidth=a,this.setTabWidth(a)},startDrag(){document.addEventListener("mousemove",this.handleDrag)},startDownload(e){this.$set(this.queueList[e],"status","downloading")},finishDownload(e){if(!this.queue.includes(e))return;this.$set(this.queueList[e],"status","download finished"),toast(this.$t("toasts.finishDownload",{item:this.queueList[e].title}),"done");const n=this.queue.indexOf(e);n>-1&&(this.queue.splice(n,1),this.queueComplete.push(e)),this.queue.length<=0&&toast(this.$t("toasts.allDownloaded"),"done_all")},startConversion(e){this.$set(this.queueList[e],"status","converting"),this.$set(this.queueList[e],"conversion",0)},finishConversion(e){this.$set(this.queueList[e.uuid],"size",e.size)},async showErrorsTab(e){await this.setErrors(e),this.$router.push({name:"Errors"})}}};const __vue_script__$n=script$n;var __vue_render__$n=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("section",{ref:"container",staticClass:"block h-screen bg-panels-bg text-foreground",class:{"tab-hidden":!e.isExpanded,"w-8":!e.isExpanded},attrs:{id:"download_tab_container","data-label":e.$t("downloads"),"aria-label":"downloads"},on:{transitionend:function(i){e.$refs.container.style.transition=""}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.isExpanded,expression:"isExpanded"}],staticClass:"absolute w-4 h-full bg-grayscale-200",staticStyle:{cursor:"ew-resize"},on:{mousedown:function(i){return i.preventDefault(),e.startDrag(i)}}}),e._v(" "),n("i",{ref:"toggler",staticClass:"m-1 text-2xl cursor-pointer material-icons",class:{"ml-1":!e.isExpanded,"ml-5":e.isExpanded},attrs:{id:"toggle_download_tab",title:e.$t("globals.toggle_download_tab_hint")},on:{click:function(i){return i.preventDefault(),e.toggleDownloadTab(i)}}}),e._v(" "),n("div",{staticClass:"absolute top-0 right-0 transition-all duration-200 ease-in-out",class:{"opacity-0 invisible":!e.isExpanded,"opacity-100 visible":e.isExpanded}},[e.clientMode?n("i",{staticClass:"m-1 text-2xl cursor-pointer material-icons",attrs:{title:e.$t("globals.open_downloads_folder")},on:{click:e.openDownloadsFolder}},[e._v(` folder_open `)]):e._e(),e._v(" "),n("i",{staticClass:"m-1 text-2xl cursor-pointer material-icons",attrs:{title:e.$t("globals.clean_queue_hint")},on:{click:e.cleanQueue}},[e._v(` clear_all `)]),e._v(" "),n("i",{staticClass:"m-1 text-2xl cursor-pointer material-icons",attrs:{title:e.$t("globals.cancel_queue_hint")},on:{click:e.cancelQueue}},[e._v(` delete_sweep - `)])]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.isExpanded,expression:"isExpanded"}],ref:"list",staticClass:"w-full pr-2",class:{slim:e.isSlim},attrs:{id:"download_list"}},e._l(e.queueList,function(i){return n("QueueItem",{key:i.uuid,attrs:{"queue-item":i},on:{"show-errors":e.showErrorsTab,"remove-item":e.onRemoveItem}})}),1)])},__vue_staticRenderFns__$n=[];const __vue_inject_styles__$n=function(e){!e||e("data-v-332db015_0",{source:"#toggle_download_tab[data-v-332db015]{width:25px;height:25px}#toggle_download_tab[data-v-332db015]::before{font-family:'Material Icons';font-style:normal;font-weight:400;content:'chevron_right'}#download_tab_container.tab-hidden #toggle_download_tab[data-v-332db015]::before{content:'chevron_left'}#download_tab_container.tab-hidden[data-v-332db015]::after{content:attr(data-label);display:flex;align-items:center;text-transform:capitalize;writing-mode:vertical-rl;line-height:2rem}#download_list[data-v-332db015]{height:calc(100% - 32px);padding-left:28px;overflow-y:scroll}#download_list[data-v-332db015]::-webkit-scrollbar{width:10px}#download_list[data-v-332db015]::-webkit-scrollbar-track{background:var(--panels-background)}#download_list[data-v-332db015]::-webkit-scrollbar-thumb{background:var(--panels-scroll);border-radius:4px;width:6px;padding:0 2px}",map:void 0,media:void 0})},__vue_scope_id__$n="data-v-332db015",__vue_module_identifier__$5=void 0,__vue_is_functional_template__$n=!1;function __vue_normalize__$n(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="TheDownloadBar.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i;{let u;if(a&&(u=function(d){a.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(h,m){return u.call(m),d(h,m)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__$5(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__$5.styles||(__vue_create_injector__$5.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(r,s){if(document.querySelector('style[data-vue-ssr-id~="'+r+'"]'))return;const l=n?s.media||"default":r,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(r)){let o=s.source,u=c.ids.length;if(c.ids.push(r),s.map&&(o+=` + `)])]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.isExpanded,expression:"isExpanded"}],ref:"list",staticClass:"w-full pr-2",class:{slim:e.isSlim},attrs:{id:"download_list"}},e._l(e.queueList,function(i){return n("QueueItem",{key:i.uuid,attrs:{"queue-item":i},on:{"show-errors":e.showErrorsTab,"remove-item":e.onRemoveItem}})}),1)])},__vue_staticRenderFns__$n=[];const __vue_inject_styles__$n=function(e){!e||e("data-v-a5cfdafe_0",{source:"#toggle_download_tab[data-v-a5cfdafe]{width:25px;height:25px}#toggle_download_tab[data-v-a5cfdafe]::before{font-family:'Material Icons';font-style:normal;font-weight:400;content:'chevron_right'}#download_tab_container.tab-hidden #toggle_download_tab[data-v-a5cfdafe]::before{content:'chevron_left'}#download_tab_container.tab-hidden[data-v-a5cfdafe]::after{content:attr(data-label);display:flex;align-items:center;text-transform:capitalize;writing-mode:vertical-rl;line-height:2rem}#download_list[data-v-a5cfdafe]{height:calc(100% - 32px);padding-left:28px;overflow-y:scroll}#download_list[data-v-a5cfdafe]::-webkit-scrollbar{width:10px}#download_list[data-v-a5cfdafe]::-webkit-scrollbar-track{background:var(--panels-background)}#download_list[data-v-a5cfdafe]::-webkit-scrollbar-thumb{background:var(--panels-scroll);border-radius:4px;width:6px;padding:0 2px}",map:void 0,media:void 0})},__vue_scope_id__$n="data-v-a5cfdafe",__vue_module_identifier__$5=void 0,__vue_is_functional_template__$n=!1;function __vue_normalize__$n(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="TheDownloadBar.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i;{let u;if(a&&(u=function(d){a.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(h,m){return u.call(m),d(h,m)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__$5(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__$5.styles||(__vue_create_injector__$5.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(r,s){if(document.querySelector('style[data-vue-ssr-id~="'+r+'"]'))return;const l=n?s.media||"default":r,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(r)){let o=s.source,u=c.ids.length;if(c.ids.push(r),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const d=c.element=document.createElement("style");d.type="text/css",s.media&&d.setAttribute("media",s.media),n&&(d.setAttribute("data-group",l),d.setAttribute("data-next-index","0")),e.appendChild(d)}if(n&&(u=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",u+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` `);else{const d=document.createTextNode(o),f=c.element.childNodes;f[u]&&c.element.removeChild(f[u]),f.length?c.element.insertBefore(d,f[u]):c.element.appendChild(d)}}}}var TheDownloadBar=__vue_normalize__$n({render:__vue_render__$n,staticRenderFns:__vue_staticRenderFns__$n},__vue_inject_styles__$n,__vue_script__$n,__vue_scope_id__$n,__vue_is_functional_template__$n,__vue_module_identifier__$5,__vue_create_injector__$5),script$m={components:{TheSidebar,TheSearchBar,TheDownloadBar,TheTrackPreview,TheQualityModal,BaseLoadingPlaceholder,TheContextMenu,TheContent},data(){return{isSocketConnected:!1}},mounted(){socket.addEventListener("open",e=>{console.log("Connected to WebSocket"),this.isSocketConnected=!0})}};const __vue_script__$m=script$m;var __vue_render__$m=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{attrs:{id:"app"}},[n("div",{staticClass:"app-container"},[n("TheSidebar"),e._v(" "),n("div",{staticClass:"content-container"},[n("TheSearchBar"),e._v(" "),n("TheContent")],1),e._v(" "),n("TheDownloadBar")],1),e._v(" "),n("BaseLoadingPlaceholder",{attrs:{text:"Connecting to local server...",hidden:e.isSocketConnected,"additional-classes":"absolute top-0 left-0 w-screen h-screen bg-black bg-opacity-50 z-50"}}),e._v(" "),n("TheTrackPreview"),e._v(" "),n("TheQualityModal"),e._v(" "),n("TheContextMenu")],1)},__vue_staticRenderFns__$m=[];const __vue_inject_styles__$m=function(e){!e||e("data-v-047e2277_0",{source:".app-container{display:flex}.content-container{width:100%;display:flex;flex-direction:column}",map:void 0,media:void 0})},__vue_scope_id__$m=void 0,__vue_module_identifier__$4=void 0,__vue_is_functional_template__$m=!1;function __vue_normalize__$m(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="App.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i;{let u;if(a&&(u=function(d){a.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(h,m){return u.call(m),d(h,m)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__$4(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__$4.styles||(__vue_create_injector__$4.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(r,s){if(document.querySelector('style[data-vue-ssr-id~="'+r+'"]'))return;const l=n?s.media||"default":r,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(r)){let o=s.source,u=c.ids.length;if(c.ids.push(r),s.map&&(o+=` diff --git a/src/components/downloads/TheDownloadBar.vue b/src/components/downloads/TheDownloadBar.vue index 64c9eb8..b7bd638 100644 --- a/src/components/downloads/TheDownloadBar.vue +++ b/src/components/downloads/TheDownloadBar.vue @@ -166,6 +166,7 @@ export default { mounted() { socket.on('startDownload', this.startDownload) socket.on('startConversion', this.startConversion) + socket.on('finishConversion', this.finishConversion) // socket.on('init_downloadQueue', this.initQueue) socket.on('addedToQueue', this.addToQueue) socket.on('updateQueue', this.updateQueue) @@ -426,6 +427,9 @@ export default { this.$set(this.queueList[uuid], 'status', 'converting') this.$set(this.queueList[uuid], 'conversion', 0) }, + finishConversion(downloadObject) { + this.$set(this.queueList[downloadObject.uuid], 'size', downloadObject.size) + }, async showErrorsTab(item) { await this.setErrors(item)