🪢 Rewired the download -> import to lib workflow

This commit is contained in:
2022-05-11 10:57:30 -07:00
parent cf75e8f9ff
commit 0b195d6ff3
4 changed files with 9 additions and 20 deletions

View File

@@ -71,6 +71,7 @@ export default class QueueService extends Service {
const {
name,
filePath,
fileSize,
extension,
cover,
containedIn,
@@ -100,7 +101,7 @@ export default class QueueService extends Service {
rawFileDetails: {
name,
filePath,
fileSize: job.data.fileObject.fileSize,
fileSize,
extension,
containedIn,
cover,

View File

@@ -332,9 +332,9 @@ export default class ImportService extends Service {
);
console.log(result);
await Comic.findOneAndUpdate({ _id: new ObjectId(ctx.params.comicObjectId) }, {
rawFileDetails: {
rawFileDetails: result,
acquisition: { wanted: false, }
}
})
}
},

View File

@@ -31,7 +31,7 @@ export default class OpdsService extends Service {
},
hooks: {},
actions: {
opds: {
serve: {
rest: "POST /serve",
handler: async (ctx) => {
return buildAsync(
@@ -137,18 +137,4 @@ export default class OpdsService extends Service {
)
);
}
}
// router.use("/file/*", async (req, res) => {
// const file: string = req.params[0];
// const ext = extname(file);
// if ([".cbr", ".cbz", ".cb7", ".cba", ".cbt"].includes(ext)) {
// const content = await fs.readFile(join(path_of_books, file));
// const mime = lookup(ext) || "application/octet-stream";
// res.set("Content-Type", mime);
// return responseStream(res, content);
// }
// res.status(404).end(`'${file}' not exists`);
// });
}

View File

@@ -31,7 +31,7 @@ SOFTWARE.
* Initial: 2021/05/04 Rishi Ghan
*/
import { createReadStream, createWriteStream, existsSync } from "fs";
import { createReadStream, createWriteStream, existsSync, statSync } from "fs";
import { isEmpty, isNil, isUndefined, remove, each, map } from "lodash";
import * as p7zip from "p7zip-threetwo";
import path from "path";
@@ -160,6 +160,7 @@ export const extractComicInfoXMLFromRar = async (
name: fileNameWithoutExtension,
extension,
containedIn: targetDirectory,
fileSize: fse.statSync(filePath).size,
cover: {
filePath: path.relative(
process.cwd(),
@@ -284,6 +285,7 @@ export const extractComicInfoXMLFromZip = async (
name: fileNameWithoutExtension,
extension,
containedIn: targetDirectory,
fileSize: fse.statSync(filePath).size,
cover: {
filePath: path.relative(
process.cwd(),