示例#1
0
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)
示例#2
0
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)
示例#3
0
def procedure(file_path):
    epub_extractor = EpubExtractor(file_path)
    meta = epub_extractor.meta
    metadata = meta.as_ordered_dict()
    epub_extractor.close()
    return metadata
示例#4
0
def procedure(file_path):
    epub_extractor = EpubExtractor(file_path)
    toc_table = epub_extractor.get_toc_table()
    epub_extractor.close()
    return toc_table
示例#5
0
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()