Fixed artist download issue
This commit is contained in:
parent
b33601e86a
commit
5291cbbd16
8
server/dist/main.js
vendored
8
server/dist/main.js
vendored
@ -72,7 +72,7 @@ function addToQueue(dz, url, bitrate) {
|
||||
console.log(`Adding ${link} to queue`);
|
||||
let downloadObj = yield deemix_1.default.generateDownloadObject(dz, link, bitrate, exports.plugins, exports.listener);
|
||||
if (Array.isArray(downloadObj)) {
|
||||
downloadObjs.concat(downloadObj);
|
||||
downloadObjs = downloadObjs.concat(downloadObj);
|
||||
}
|
||||
else {
|
||||
downloadObjs.push(downloadObj);
|
||||
@ -85,8 +85,10 @@ function addToQueue(dz, url, bitrate) {
|
||||
const slimmedObjects = [];
|
||||
downloadObjs.forEach((downloadObj) => {
|
||||
// Check if element is already in queue
|
||||
if (Object.keys(exports.queue).includes(downloadObj.uuid))
|
||||
throw new errors_1.AlreadyInQueue(downloadObj.getEssentialDict(), !isSingleObject);
|
||||
if (Object.keys(exports.queue).includes(downloadObj.uuid)) {
|
||||
exports.listener.send('alreadyInQueue', downloadObj.getEssentialDict());
|
||||
return;
|
||||
}
|
||||
// Save queue status when adding something to the queue
|
||||
if (!fs_1.default.existsSync(exports.configFolder + 'queue'))
|
||||
fs_1.default.mkdirSync(exports.configFolder + 'queue');
|
||||
|
4
server/dist/routes/api/post/addToQueue.js
vendored
4
server/dist/routes/api/post/addToQueue.js
vendored
@ -27,10 +27,6 @@ const handler = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
}
|
||||
catch (e) {
|
||||
switch (e.name) {
|
||||
case 'AlreadyInQueue':
|
||||
res.send({ result: false, errid: e.name, data: { url, bitrate, obj: e.item } });
|
||||
main_1.listener.send('alreadyInQueue', e.item);
|
||||
break;
|
||||
case 'NotLoggedIn':
|
||||
res.send({ result: false, errid: e.name, data: { url, bitrate } });
|
||||
main_1.listener.send('loginNeededToDownload');
|
||||
|
@ -66,7 +66,7 @@ export async function addToQueue(dz: any, url: string[], bitrate: number) {
|
||||
console.log(`Adding ${link} to queue`)
|
||||
let downloadObj = await deemix.generateDownloadObject(dz, link, bitrate, plugins, listener)
|
||||
if (Array.isArray(downloadObj)){
|
||||
downloadObjs.concat(downloadObj)
|
||||
downloadObjs = downloadObjs.concat(downloadObj)
|
||||
} else {
|
||||
downloadObjs.push(downloadObj)
|
||||
}
|
||||
@ -81,8 +81,11 @@ export async function addToQueue(dz: any, url: string[], bitrate: number) {
|
||||
|
||||
downloadObjs.forEach((downloadObj: any) => {
|
||||
// Check if element is already in queue
|
||||
if (Object.keys(queue).includes(downloadObj.uuid))
|
||||
throw new AlreadyInQueue(downloadObj.getEssentialDict(), !isSingleObject)
|
||||
if (Object.keys(queue).includes(downloadObj.uuid)){
|
||||
listener.send('alreadyInQueue', downloadObj.getEssentialDict())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// Save queue status when adding something to the queue
|
||||
if (!fs.existsSync(configFolder + 'queue')) fs.mkdirSync(configFolder + 'queue')
|
||||
|
@ -18,10 +18,6 @@ const handler: ApiHandler['handler'] = async (req, res) => {
|
||||
obj = await addToQueue(dz, url, bitrate)
|
||||
} catch (e) {
|
||||
switch (e.name) {
|
||||
case 'AlreadyInQueue':
|
||||
res.send({ result: false, errid: e.name, data: { url, bitrate, obj: e.item } })
|
||||
listener.send('alreadyInQueue', e.item)
|
||||
break
|
||||
case 'NotLoggedIn':
|
||||
res.send({ result: false, errid: e.name, data: { url, bitrate } })
|
||||
listener.send('loginNeededToDownload')
|
||||
|
Loading…
Reference in New Issue
Block a user