def test(): project_dir = os.path.dirname(os.path.dirname(__file__)) # epub_file = os.path.join( # project_dir, 'test-epubs', 'BT000027007500100101900206_001.epub') epub_file = os.path.join(project_dir, 'test-epubs', 'BT000012354200100101900206_001.epub') data = procedure(epub_file) EpubExtractor.print_json(data)
def main(): parser = argparse.ArgumentParser(description='Dump EPUB Meta information.') parser.add_argument('epub_files', metavar='EPUB-Files', type=str, nargs='+', help='Target Epub Files') args = parser.parse_args() if len(args.epub_files) > 1: out = [] for epub_file in args.epub_files: out.append(procedure(epub_file)) else: out = procedure(args.epub_files[0]) EpubExtractor.print_json(out)
def procedure(file_path): epub_extractor = EpubExtractor(file_path) meta = epub_extractor.meta metadata = meta.as_ordered_dict() epub_extractor.close() return metadata
def procedure(file_path): epub_extractor = EpubExtractor(file_path) toc_table = epub_extractor.get_toc_table() epub_extractor.close() return toc_table
def procedure(file_path, convert_png=True, delete_exists_dir=False): epub_extractor = EpubExtractor(file_path) epub_extractor.extract_images( convert_png=convert_png, delete_exists_dir=delete_exists_dir) epub_extractor.close()