🔧 Fixing the ebook-meta path

This commit is contained in:
2021-09-07 08:47:13 -07:00
parent c7d431343d
commit 36d1c4fe33
2 changed files with 1 additions and 8 deletions

View File

@@ -43,10 +43,8 @@ export const calculateLevenshteinDistance = async (
imagePath1: string, imagePath1: string,
imagePath2: string imagePath2: string
): Promise<Record<string, unknown>> => { ): Promise<Record<string, unknown>> => {
console.log("AGANTUK", imagePath1)
const hash1 = await imghash.hash(imagePath1); const hash1 = await imghash.hash(imagePath1);
const hash2 = await imghash.hash(imagePath2); const hash2 = await imghash.hash(imagePath2);
console.log("HASHISH", hash1)
if (!isNull(hash1) && !isNull(hash2)) { if (!isNull(hash1) && !isNull(hash2)) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve({ levenshteinDistance: leven(hash1, hash2) }); resolve({ levenshteinDistance: leven(hash1, hash2) });

View File

@@ -31,13 +31,10 @@ SOFTWARE.
* Initial: 2021/05/04 Rishi Ghan * Initial: 2021/05/04 Rishi Ghan
*/ */
import { createReadStream, createWriteStream, readFileSync, stat } from "fs";
const fse = require("fs-extra"); const fse = require("fs-extra");
import path from "path"; import path from "path";
import { each, isEmpty, map, flatten } from "lodash";
import { import {
IExplodedPathResponse,
IExtractComicBookCoverErrorResponse, IExtractComicBookCoverErrorResponse,
IExtractedComicBookCoverFile, IExtractedComicBookCoverFile,
IExtractionOptions, IExtractionOptions,
@@ -45,11 +42,9 @@ import {
ISharpResizedImageStats, ISharpResizedImageStats,
} from "threetwo-ui-typings"; } from "threetwo-ui-typings";
import { logger } from "./logger.utils"; import { logger } from "./logger.utils";
import { validateComicBookMetadata } from "../utils/validation.utils";
import { import {
constructPaths, constructPaths,
explodePath, explodePath,
isValidImageFileExtension,
} from "../utils/file.utils"; } from "../utils/file.utils";
import { resizeImage } from "./imagetransformation.utils"; import { resizeImage } from "./imagetransformation.utils";
const { writeFile, readFile } = require("fs").promises; const { writeFile, readFile } = require("fs").promises;
@@ -89,7 +84,7 @@ export const extractCoverFromFile = async (
let result: string; let result: string;
const targetCoverImageFilePath = path.resolve(constructedPaths.targetPath + "/" + walkedFolder.name + "_cover.jpg") const targetCoverImageFilePath = path.resolve(constructedPaths.targetPath + "/" + walkedFolder.name + "_cover.jpg")
result = await calibre.run( result = await calibre.run(
`/opt/calibre/ebook-meta`, `ebook-meta`,
[path.resolve(constructedPaths.inputFilePath)], [path.resolve(constructedPaths.inputFilePath)],
{ {
getCover: targetCoverImageFilePath, getCover: targetCoverImageFilePath,