🔬 Image analysis flyout scaffold
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"use strict";
|
||||
import axios from "axios";
|
||||
import {
|
||||
Context,
|
||||
Service,
|
||||
@@ -6,9 +7,8 @@ import {
|
||||
ServiceSchema,
|
||||
Errors,
|
||||
} from "moleculer";
|
||||
import {
|
||||
resizeImage,
|
||||
} from "../utils/imagetransformation.utils";
|
||||
import path from "path";
|
||||
import { analyze, resizeImage } from "../utils/imagetransformation.utils";
|
||||
export default class ImageTransformation extends Service {
|
||||
// @ts-ignore
|
||||
public constructor(
|
||||
@@ -53,6 +53,20 @@ export default class ImageTransformation extends Service {
|
||||
return { resizeOperationStatus: resizeResult };
|
||||
},
|
||||
},
|
||||
analyze: {
|
||||
rest: "POST /analyze",
|
||||
params: {},
|
||||
handler: async (
|
||||
ctx: Context<{ imageFilePath: string }>
|
||||
) => {
|
||||
const url = new URL(ctx.params.imageFilePath);
|
||||
const pathName = url.pathname;
|
||||
const decodedImageFileURI = decodeURI(pathName);
|
||||
|
||||
|
||||
return await analyze(path.resolve("." + decodedImageFileURI));
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {},
|
||||
},
|
||||
|
||||
@@ -52,7 +52,6 @@ import {
|
||||
import { unrarArchive } from "../utils/uncompression.utils";
|
||||
import { extractCoverFromFile2 } from "../utils/uncompression.utils";
|
||||
import { scrapeIssuesFromDOM } from "../utils/scraping.utils";
|
||||
import axios from "axios";
|
||||
const ObjectId = require("mongoose").Types.ObjectId;
|
||||
import fsExtra from "fs-extra";
|
||||
const through2 = require("through2");
|
||||
@@ -517,6 +516,7 @@ export default class ImportService extends Service {
|
||||
options: IExtractionOptions;
|
||||
}>
|
||||
) {
|
||||
console.log(ctx.params);
|
||||
return await unrarArchive(
|
||||
ctx.params.filePath,
|
||||
ctx.params.options
|
||||
|
||||
@@ -120,6 +120,14 @@ export default class QueueService extends Service {
|
||||
});
|
||||
},
|
||||
},
|
||||
unarchiveComicBook: {
|
||||
rest: "POST /unarchiveComicBook",
|
||||
params: {},
|
||||
handler: async (ctx:Context<{}>) => {
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
methods: {},
|
||||
async started(): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user