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`);
|
console.log(`Adding ${link} to queue`);
|
||||||
let downloadObj = yield deemix_1.default.generateDownloadObject(dz, link, bitrate, exports.plugins, exports.listener);
|
let downloadObj = yield deemix_1.default.generateDownloadObject(dz, link, bitrate, exports.plugins, exports.listener);
|
||||||
if (Array.isArray(downloadObj)) {
|
if (Array.isArray(downloadObj)) {
|
||||||
downloadObjs.concat(downloadObj);
|
downloadObjs = downloadObjs.concat(downloadObj);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
downloadObjs.push(downloadObj);
|
downloadObjs.push(downloadObj);
|
||||||
@ -85,8 +85,10 @@ function addToQueue(dz, url, bitrate) {
|
|||||||
const slimmedObjects = [];
|
const slimmedObjects = [];
|
||||||
downloadObjs.forEach((downloadObj) => {
|
downloadObjs.forEach((downloadObj) => {
|
||||||
// Check if element is already in queue
|
// Check if element is already in queue
|
||||||
if (Object.keys(exports.queue).includes(downloadObj.uuid))
|
if (Object.keys(exports.queue).includes(downloadObj.uuid)) {
|
||||||
throw new errors_1.AlreadyInQueue(downloadObj.getEssentialDict(), !isSingleObject);
|
exports.listener.send('alreadyInQueue', downloadObj.getEssentialDict());
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Save queue status when adding something to the queue
|
// Save queue status when adding something to the queue
|
||||||
if (!fs_1.default.existsSync(exports.configFolder + 'queue'))
|
if (!fs_1.default.existsSync(exports.configFolder + 'queue'))
|
||||||
fs_1.default.mkdirSync(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) {
|
catch (e) {
|
||||||
switch (e.name) {
|
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':
|
case 'NotLoggedIn':
|
||||||
res.send({ result: false, errid: e.name, data: { url, bitrate } });
|
res.send({ result: false, errid: e.name, data: { url, bitrate } });
|
||||||
main_1.listener.send('loginNeededToDownload');
|
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`)
|
console.log(`Adding ${link} to queue`)
|
||||||
let downloadObj = await deemix.generateDownloadObject(dz, link, bitrate, plugins, listener)
|
let downloadObj = await deemix.generateDownloadObject(dz, link, bitrate, plugins, listener)
|
||||||
if (Array.isArray(downloadObj)){
|
if (Array.isArray(downloadObj)){
|
||||||
downloadObjs.concat(downloadObj)
|
downloadObjs = downloadObjs.concat(downloadObj)
|
||||||
} else {
|
} else {
|
||||||
downloadObjs.push(downloadObj)
|
downloadObjs.push(downloadObj)
|
||||||
}
|
}
|
||||||
@ -81,8 +81,11 @@ export async function addToQueue(dz: any, url: string[], bitrate: number) {
|
|||||||
|
|
||||||
downloadObjs.forEach((downloadObj: any) => {
|
downloadObjs.forEach((downloadObj: any) => {
|
||||||
// Check if element is already in queue
|
// Check if element is already in queue
|
||||||
if (Object.keys(queue).includes(downloadObj.uuid))
|
if (Object.keys(queue).includes(downloadObj.uuid)){
|
||||||
throw new AlreadyInQueue(downloadObj.getEssentialDict(), !isSingleObject)
|
listener.send('alreadyInQueue', downloadObj.getEssentialDict())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Save queue status when adding something to the queue
|
// Save queue status when adding something to the queue
|
||||||
if (!fs.existsSync(configFolder + 'queue')) fs.mkdirSync(configFolder + '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)
|
obj = await addToQueue(dz, url, bitrate)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
switch (e.name) {
|
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':
|
case 'NotLoggedIn':
|
||||||
res.send({ result: false, errid: e.name, data: { url, bitrate } })
|
res.send({ result: false, errid: e.name, data: { url, bitrate } })
|
||||||
listener.send('loginNeededToDownload')
|
listener.send('loginNeededToDownload')
|
||||||
|
Loading…
Reference in New Issue
Block a user