One llong queue working, failed downloads working, just a few more bugs and 3 long client spesific queues to get working
This commit is contained in:
@@ -29,14 +29,14 @@ module.exports.resolveVideos = async (arr) => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
output.data[video] = {found: false};
|
output.data[video] = {found: false};
|
||||||
output.contents = true;
|
output.contents = true;
|
||||||
logger.log(`Error resolving video ${video}`);
|
logger.log(`Error resolving video ${video}: ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
let downloadQueue;
|
let downloadQueue = [];
|
||||||
|
|
||||||
module.exports.setupDownloadQueue = async (arr, socket, options) => {
|
module.exports.setupDownloadQueue = async (arr, socket, options) => {
|
||||||
let numOfDownloads;
|
let numOfDownloads;
|
||||||
@@ -71,7 +71,6 @@ async function runQueueAsync(socketID) {
|
|||||||
async function download(video, videoName ,socket, audioOnly, path = './') {
|
async function download(video, videoName ,socket, audioOnly, path = './') {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
let stream;
|
let stream;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (audioOnly) {
|
if (audioOnly) {
|
||||||
stream = await ytdl(video, {quality: 'highest', filter: (format) => format.container === 'mp4'});
|
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) {
|
} catch (e) {
|
||||||
logger.log(`Socket id '${socket.id}' failed to download ${videoName}: ${e}`);
|
logger.log(`Socket id '${socket.id}' failed to download ${videoName}: ${e}`);
|
||||||
socket.emit('download-done', {video: video, title: videoName});
|
socket.emit('download-done', {video: video, title: videoName});
|
||||||
|
socket.emit('download-progress', {video: video, percent: "Failed", title: videoName});
|
||||||
resolve('error');
|
resolve('error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user