From fd210e5ad2c00c491110833d938b953088da35dc Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 9 Jan 2019 11:15:47 +0000 Subject: [PATCH] One llong queue working, failed downloads working, just a few more bugs and 3 long client spesific queues to get working --- src/youtubehelper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/youtubehelper.js b/src/youtubehelper.js index 25ea334..9fb704e 100644 --- a/src/youtubehelper.js +++ b/src/youtubehelper.js @@ -29,14 +29,14 @@ module.exports.resolveVideos = async (arr) => { } catch (e) { output.data[video] = {found: false}; output.contents = true; - logger.log(`Error resolving video ${video}`); + logger.log(`Error resolving video ${video}: ${e}`); } } return output; } -let downloadQueue; +let downloadQueue = []; module.exports.setupDownloadQueue = async (arr, socket, options) => { let numOfDownloads; @@ -71,7 +71,6 @@ async function runQueueAsync(socketID) { async function download(video, videoName ,socket, audioOnly, path = './') { return new Promise(async (resolve, reject) => { let stream; - try { if (audioOnly) { stream = await ytdl(video, {quality: 'highest', filter: (format) => format.container === 'mp4'}); @@ -105,6 +104,7 @@ async function download(video, videoName ,socket, audioOnly, path = './') { } catch (e) { logger.log(`Socket id '${socket.id}' failed to download ${videoName}: ${e}`); socket.emit('download-done', {video: video, title: videoName}); + socket.emit('download-progress', {video: video, percent: "Failed", title: videoName}); resolve('error'); } });