Refactoring and small optimizations
This commit is contained in:
@@ -52,7 +52,14 @@ class Process {
|
||||
|
||||
log.info('proc', `Spawned a new process, pid: ${this.pid}`)
|
||||
|
||||
await insertDownload(this.url, this.info?.title, this.info?.thumbnail, null, this.pid);
|
||||
await insertDownload(
|
||||
this.url,
|
||||
this.info?.title,
|
||||
this.info?.thumbnail,
|
||||
null,
|
||||
this.params.reduce((prev, next) => `${prev} ${next}`),
|
||||
this.pid
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,9 @@ export async function retriveDownload(socket: Socket) {
|
||||
if (coldRestart) {
|
||||
coldRestart = false;
|
||||
let downloads = await pruneDownloads();
|
||||
downloads = [... new Set(downloads)];
|
||||
console.log(downloads)
|
||||
// sanitize
|
||||
downloads = [... new Set(downloads.filter(el => el !== undefined))];
|
||||
log.info('dl', `Cold restart, retrieving ${downloads.length} jobs`)
|
||||
for (const entry of downloads) {
|
||||
if (entry) {
|
||||
@@ -180,7 +182,7 @@ const formatter = (stdout: string, pid: number) => {
|
||||
switch (status) {
|
||||
case 'download':
|
||||
return {
|
||||
status: cleanStdout[0].replace(/\[|\]|\r/g, ''),
|
||||
status: 'download',
|
||||
progress: cleanStdout[1],
|
||||
size: cleanStdout[3],
|
||||
dlSpeed: cleanStdout[5],
|
||||
|
||||
Reference in New Issue
Block a user