From 3ce754b235e55f9d91a3a9fbaadc0c043c4e2534 Mon Sep 17 00:00:00 2001 From: Inrixia Date: Thu, 29 Jun 2023 07:38:51 +1200 Subject: [PATCH] Improved summary updates for completed videos --- src/Downloader.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Downloader.ts b/src/Downloader.ts index b3d62ad..6bc9116 100644 --- a/src/Downloader.ts +++ b/src/Downloader.ts @@ -43,7 +43,6 @@ const getDownloadSempahore = async () => { const releaseDownloadSemaphore = () => { AvalibleDeliverySlots++; - completedVideos++; // If there are queued requests, resolve the first one in the queue DownloadQueue.shift()?.(); @@ -144,7 +143,6 @@ const processVideo = async (fTitle: string, video: Video, retries = 0) => { summaryStats._.downloadedMB = summaryStats[fTitle].downloadedMB; summaryStats._.totalMB = summaryStats[fTitle].totalMB; delete summaryStats[fTitle]; - updateSummaryBar(); } // eslint-disable-next-line no-fallthrough case VideoState.Partial: { @@ -165,13 +163,13 @@ const processVideo = async (fTitle: string, video: Video, retries = 0) => { await (await (await (await (await plexApi.resource(sectionToUpdate.server)).connect()).library()).section(sectionToUpdate.section)).refresh(); } } - updateSummaryBar(); } // eslint-disable-next-line no-fallthrough case VideoState.Muxed: { + completedVideos++; + updateSummaryBar(); mpb?.done(fTitle); setTimeout(() => mpb?.removeTask(fTitle), 10000 + Math.floor(Math.random() * 6000)); - updateSummaryBar(); } } } catch (error) {