Added better logging for itemgen errors
This commit is contained in:
parent
6dbbe7c55f
commit
1ee3657093
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
"cookie-parser": "1.4.5",
|
"cookie-parser": "1.4.5",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"deemix": "^0.1.3",
|
"deemix": "^0.1.4",
|
||||||
"deezer-js": "^1.0.0",
|
"deezer-js": "^1.0.0",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
|
17
server/dist/main.js
vendored
17
server/dist/main.js
vendored
@ -79,6 +79,7 @@ function addToQueue(dz, url, bitrate) {
|
|||||||
if (!dz.logged_in)
|
if (!dz.logged_in)
|
||||||
throw new errors_1.NotLoggedIn();
|
throw new errors_1.NotLoggedIn();
|
||||||
let downloadObjs = [];
|
let downloadObjs = [];
|
||||||
|
const downloadErrors = [];
|
||||||
let link = '';
|
let link = '';
|
||||||
const requestUUID = uuid_1.v4();
|
const requestUUID = uuid_1.v4();
|
||||||
if (url.length > 1) {
|
if (url.length > 1) {
|
||||||
@ -87,13 +88,25 @@ function addToQueue(dz, url, bitrate) {
|
|||||||
for (let i = 0; i < url.length; i++) {
|
for (let i = 0; i < url.length; i++) {
|
||||||
link = url[i];
|
link = url[i];
|
||||||
console.log(`Adding ${link} to queue`);
|
console.log(`Adding ${link} to queue`);
|
||||||
const downloadObj = yield deemix_1.default.generateDownloadObject(dz, link, bitrate, exports.plugins, exports.listener);
|
let downloadObj;
|
||||||
|
try {
|
||||||
|
downloadObj = yield deemix_1.default.generateDownloadObject(dz, link, bitrate, exports.plugins, exports.listener);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
downloadErrors.push(e);
|
||||||
|
}
|
||||||
if (Array.isArray(downloadObj)) {
|
if (Array.isArray(downloadObj)) {
|
||||||
downloadObjs = downloadObjs.concat(downloadObj);
|
downloadObjs = downloadObjs.concat(downloadObj);
|
||||||
}
|
}
|
||||||
else {
|
else if (downloadObj)
|
||||||
downloadObjs.push(downloadObj);
|
downloadObjs.push(downloadObj);
|
||||||
}
|
}
|
||||||
|
if (downloadErrors.length) {
|
||||||
|
downloadErrors.forEach((e) => {
|
||||||
|
if (!e.errid)
|
||||||
|
console.trace(e);
|
||||||
|
exports.listener.send('queueError', { link: e.link, error: e.message, errid: e.errid });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (url.length > 1) {
|
if (url.length > 1) {
|
||||||
exports.listener.send('finishGeneratingItems', { uuid: requestUUID, total: downloadObjs.length });
|
exports.listener.send('finishGeneratingItems', { uuid: requestUUID, total: downloadObjs.length });
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cookie-parser": "1.4.5",
|
"cookie-parser": "1.4.5",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"deemix": "^0.1.3",
|
"deemix": "^0.1.4",
|
||||||
"deezer-js": "^1.0.0",
|
"deezer-js": "^1.0.0",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
|
@ -68,6 +68,7 @@ export async function addToQueue(dz: any, url: string[], bitrate: number) {
|
|||||||
if (!dz.logged_in) throw new NotLoggedIn()
|
if (!dz.logged_in) throw new NotLoggedIn()
|
||||||
|
|
||||||
let downloadObjs: any[] = []
|
let downloadObjs: any[] = []
|
||||||
|
const downloadErrors: any[] = []
|
||||||
let link: string = ''
|
let link: string = ''
|
||||||
const requestUUID = uuidv4()
|
const requestUUID = uuidv4()
|
||||||
|
|
||||||
@ -78,12 +79,22 @@ export async function addToQueue(dz: any, url: string[], bitrate: number) {
|
|||||||
for (let i = 0; i < url.length; i++) {
|
for (let i = 0; i < url.length; i++) {
|
||||||
link = url[i]
|
link = url[i]
|
||||||
console.log(`Adding ${link} to queue`)
|
console.log(`Adding ${link} to queue`)
|
||||||
const downloadObj = await deemix.generateDownloadObject(dz, link, bitrate, plugins, listener)
|
let downloadObj
|
||||||
|
try {
|
||||||
|
downloadObj = await deemix.generateDownloadObject(dz, link, bitrate, plugins, listener)
|
||||||
|
} catch (e) {
|
||||||
|
downloadErrors.push(e)
|
||||||
|
}
|
||||||
if (Array.isArray(downloadObj)) {
|
if (Array.isArray(downloadObj)) {
|
||||||
downloadObjs = downloadObjs.concat(downloadObj)
|
downloadObjs = downloadObjs.concat(downloadObj)
|
||||||
} else {
|
} else if (downloadObj) downloadObjs.push(downloadObj)
|
||||||
downloadObjs.push(downloadObj)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (downloadErrors.length) {
|
||||||
|
downloadErrors.forEach((e: any) => {
|
||||||
|
if (!e.errid) console.trace(e)
|
||||||
|
listener.send('queueError', { link: e.link, error: e.message, errid: e.errid })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.length > 1) {
|
if (url.length > 1) {
|
||||||
|
@ -1899,10 +1899,10 @@ decompress-response@^6.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
mimic-response "^3.1.0"
|
mimic-response "^3.1.0"
|
||||||
|
|
||||||
deemix@^0.1.3:
|
deemix@^0.1.4:
|
||||||
version "0.1.3"
|
version "0.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/deemix/-/deemix-0.1.3.tgz#fe8a9cdb484ffd5c51d61eadb6d7a508022a9570"
|
resolved "https://registry.yarnpkg.com/deemix/-/deemix-0.1.4.tgz#ad43648895fd3bbe5583e7c558f786d6ce43598f"
|
||||||
integrity sha512-R0lp1hgxP4Z2kgqtJcBKkOrBIoSt9+C+rjFwQmW+UQSE9Vyzbr0ZYGBgV3qwHDj3mZ3OP+mr22hiTa43tYPSWw==
|
integrity sha512-7v6zfcx+16g3Ii2yvntJM+MvTYPpWyabzHxRN0u8mUarc/P7o8hPrSVeofAZOhF6iSN0RBKeSjIoN5LTQsobSA==
|
||||||
dependencies:
|
dependencies:
|
||||||
async "^3.2.0"
|
async "^3.2.0"
|
||||||
browser-id3-writer "^4.4.0"
|
browser-id3-writer "^4.4.0"
|
||||||
|
@ -813,10 +813,10 @@ decompress-response@^6.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
mimic-response "^3.1.0"
|
mimic-response "^3.1.0"
|
||||||
|
|
||||||
deemix@^0.1.3:
|
deemix@^0.1.4:
|
||||||
version "0.1.3"
|
version "0.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/deemix/-/deemix-0.1.3.tgz#fe8a9cdb484ffd5c51d61eadb6d7a508022a9570"
|
resolved "https://registry.yarnpkg.com/deemix/-/deemix-0.1.4.tgz#ad43648895fd3bbe5583e7c558f786d6ce43598f"
|
||||||
integrity sha512-R0lp1hgxP4Z2kgqtJcBKkOrBIoSt9+C+rjFwQmW+UQSE9Vyzbr0ZYGBgV3qwHDj3mZ3OP+mr22hiTa43tYPSWw==
|
integrity sha512-7v6zfcx+16g3Ii2yvntJM+MvTYPpWyabzHxRN0u8mUarc/P7o8hPrSVeofAZOhF6iSN0RBKeSjIoN5LTQsobSA==
|
||||||
dependencies:
|
dependencies:
|
||||||
async "^3.2.0"
|
async "^3.2.0"
|
||||||
browser-id3-writer "^4.4.0"
|
browser-id3-writer "^4.4.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user