🔧 Refactored the unrar and unzip return objects

This commit is contained in:
2022-03-19 10:12:11 -07:00
parent e144c9dd5f
commit 8181afdf88
2 changed files with 8 additions and 11 deletions

View File

@@ -163,14 +163,14 @@ export default class QueueService extends Service {
const foo = await this.getQueue( const foo = await this.getQueue(
"process.import" "process.import"
).pause(); ).pause();
console.log(foo); console.log("paused", foo);
break; return foo;
case "resume": case "resume":
const soo = await this.getQueue( const soo = await this.getQueue(
"process.import" "process.import"
).resume(); ).resume();
console.log(soo); console.log("resumed", soo);
break; return soo;
default: default:
console.log("Unrecognized queue action."); console.log("Unrecognized queue action.");
} }

View File

@@ -153,7 +153,6 @@ export const extractComicInfoXMLFromRar = async (
} }
if (existsSync(`${targetDirectory}/${coverFile}`)) { if (existsSync(`${targetDirectory}/${coverFile}`)) {
// orchestrate result // orchestrate result
console.log("ASDAsd");
resolve({ resolve({
filePath, filePath,
name: fileNameWithoutExtension, name: fileNameWithoutExtension,
@@ -220,7 +219,6 @@ export const extractComicInfoXMLFromZip = async (
// ComicInfoXML detection, parsing and conversion to JSON // ComicInfoXML detection, parsing and conversion to JSON
// Write ComicInfo.xml to disk // Write ComicInfo.xml to disk
let comicinfostring = ""; let comicinfostring = "";
const comicInfoXMLPromise = new Promise((resolve, reject) => { const comicInfoXMLPromise = new Promise((resolve, reject) => {
if ( if (
!isNil(filesToWriteToDisk.comicInfoXML) && !isNil(filesToWriteToDisk.comicInfoXML) &&
@@ -296,16 +294,15 @@ export const extractFromArchive = async (filePath: string) => {
console.log( console.log(
"Detected file type is cbz, looking for comicinfo.xml..." "Detected file type is cbz, looking for comicinfo.xml..."
); );
const result = await extractComicInfoXMLFromZip(filePath); const cbzResult = await extractComicInfoXMLFromZip(filePath);
return Object.assign({}, ...result); return Object.assign({}, ...cbzResult);
case ".cbr": case ".cbr":
console.log( console.log(
"Detected file type is cbr, looking for comicinfo.xml..." "Detected file type is cbr, looking for comicinfo.xml..."
); );
const CbrResult = await extractComicInfoXMLFromRar(filePath); const cbrResult = await extractComicInfoXMLFromRar(filePath);
console.log(CbrResult); return Object.assign({}, ...cbrResult);
return Object.assign({}, ...CbrResult);
default: default:
console.log( console.log(