1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import logger from "#logger";
- import {chapter_insert, searchChapterInfoForPath, getChaptersByBookId, getFileBymd5, getBookInfo} from "#db";
- import cliProgress from 'cli-progress';
- import {EPub} from "epub2";
- import path from "node:path";
- import fs from "node:fs";
- export async function saveAllFiles(epub, zipEpubExtract, file_md5, author_id) {
- // const chapterIndex = epub.flow.findIndex(elm => elm.id === fileRow.source_id);
- const bookInfo = await getBookInfo(file_md5)
- // 图片、css、html
- console.log(12, bookInfo)
- /*files_insert({
- file_id = "",
- source_id = "",
- md5 = "",
- mimetype = "",
- size = "",
- name = "",
- path = "",
- content = "",
- old_path
- book_id = "",
- })*/
- // console.log("\nSPINE:\n");
- // console.log(epub.flow)
- for (let i = 0; i < epub.flow.length; i++) {
- const elm = epub.flow[i]
- const isImage = elm.mediaType.includes('image')
- const isCss = elm.mediaType.includes('text/css')
- // console.log(15, {
- // title: elm.title,
- // id: elm.id,
- // order: elm.order,
- // mediaType: elm.mediaType
- // })
- console.log(elm)
- }
- }
|