Improve EPUB restoration, book terminology and Calibre QA workflow
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import argparse
|
||||
import hashlib
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -33,11 +34,15 @@ def run_preprocess(args):
|
||||
if structure_path.exists() and not args.force:
|
||||
logger.info(f"Reusing existing structure: {structure_path}")
|
||||
structure = BookStructure.load(structure_path)
|
||||
if structure.source_sha256 != hashlib.sha256(input_path.read_bytes()).hexdigest():
|
||||
structure = BookStructure.load(EpubCleaner(input_path, work["root"]).clean())
|
||||
else:
|
||||
logger.info("Cleaning EPUB...")
|
||||
cleaner = EpubCleaner(input_path, work["root"])
|
||||
structure_path = cleaner.clean()
|
||||
structure = BookStructure.load(structure_path)
|
||||
if structure.source_sha256 != hashlib.sha256(input_path.read_bytes()).hexdigest():
|
||||
structure = BookStructure.load(EpubCleaner(input_path, work["root"]).clean())
|
||||
|
||||
# 2. Extract Text
|
||||
logger.info("Extracting text segments...")
|
||||
|
||||
Reference in New Issue
Block a user