From 8181afdf8816bd335fa8cf214078f3eed2f43da9 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Sat, 19 Mar 2022 10:12:11 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Refactored=20the=20unrar=20and?= =?UTF-8?q?=20unzip=20return=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/libraryqueue.service.ts | 8 ++++---- utils/uncompression.utils.ts | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/services/libraryqueue.service.ts b/services/libraryqueue.service.ts index baf8c74..785b570 100644 --- a/services/libraryqueue.service.ts +++ b/services/libraryqueue.service.ts @@ -163,14 +163,14 @@ export default class QueueService extends Service { const foo = await this.getQueue( "process.import" ).pause(); - console.log(foo); - break; + console.log("paused", foo); + return foo; case "resume": const soo = await this.getQueue( "process.import" ).resume(); - console.log(soo); - break; + console.log("resumed", soo); + return soo; default: console.log("Unrecognized queue action."); } diff --git a/utils/uncompression.utils.ts b/utils/uncompression.utils.ts index 249bf42..d3fd231 100644 --- a/utils/uncompression.utils.ts +++ b/utils/uncompression.utils.ts @@ -153,7 +153,6 @@ export const extractComicInfoXMLFromRar = async ( } if (existsSync(`${targetDirectory}/${coverFile}`)) { // orchestrate result - console.log("ASDAsd"); resolve({ filePath, name: fileNameWithoutExtension, @@ -220,7 +219,6 @@ export const extractComicInfoXMLFromZip = async ( // ComicInfoXML detection, parsing and conversion to JSON // Write ComicInfo.xml to disk let comicinfostring = ""; - const comicInfoXMLPromise = new Promise((resolve, reject) => { if ( !isNil(filesToWriteToDisk.comicInfoXML) && @@ -296,16 +294,15 @@ export const extractFromArchive = async (filePath: string) => { console.log( "Detected file type is cbz, looking for comicinfo.xml..." ); - const result = await extractComicInfoXMLFromZip(filePath); - return Object.assign({}, ...result); + const cbzResult = await extractComicInfoXMLFromZip(filePath); + return Object.assign({}, ...cbzResult); case ".cbr": console.log( "Detected file type is cbr, looking for comicinfo.xml..." ); - const CbrResult = await extractComicInfoXMLFromRar(filePath); - console.log(CbrResult); - return Object.assign({}, ...CbrResult); + const cbrResult = await extractComicInfoXMLFromRar(filePath); + return Object.assign({}, ...cbrResult); default: console.log(