Fix library of crypto for current Windows (#159)

* Fix library of crypto for current Windows

* Modify obok import statement

Only import this module when necessary

---------

Co-authored-by: Hsieh Chin Fan <pham@topo.tw>
This commit is contained in:
Hsieh Chin Fan 2023-03-13 18:59:52 +08:00 committed by GitHub
parent 5d2c89a841
commit 0a1991d8ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,6 @@ import json
import os import os
from os import environ as env from os import environ as env
import book_maker.obok as obok
from book_maker.loader import BOOK_LOADER_DICT from book_maker.loader import BOOK_LOADER_DICT
from book_maker.translator import MODEL_DICT from book_maker.translator import MODEL_DICT
from book_maker.utils import LANGUAGES, TO_LANGUAGE_CODE from book_maker.utils import LANGUAGES, TO_LANGUAGE_CODE
@ -190,6 +189,8 @@ def main():
OPENAI_API_KEY = "" OPENAI_API_KEY = ""
if options.book_from == "kobo": if options.book_from == "kobo":
import book_maker.obok as obok
device_path = options.device_path device_path = options.device_path
if device_path is None: if device_path is None:
raise Exception( raise Exception(

View File

@ -1,6 +1,9 @@
# The original code comes from: # The original code comes from:
# https://github.com/apprenticeharper/DeDRM_tools # https://github.com/apprenticeharper/DeDRM_tools
# Version 4.1.2 March 2023
# Update library for crypto for current Windows
# Version 4.1.1 March 2023 # Version 4.1.1 March 2023
# Make obok.py works as file selector # Make obok.py works as file selector
@ -161,7 +164,7 @@
"""Manage all Kobo books, either encrypted or DRM-free.""" """Manage all Kobo books, either encrypted or DRM-free."""
from __future__ import print_function from __future__ import print_function
__version__ = "4.0.0" __version__ = "4.1.2"
__about__ = "Obok v{0}\nCopyright © 2012-2020 Physisticated et al.".format(__version__) __about__ = "Obok v{0}\nCopyright © 2012-2020 Physisticated et al.".format(__version__)
import base64 import base64
@ -211,7 +214,7 @@ def _load_crypto_libcrypto():
from ctypes.util import find_library from ctypes.util import find_library
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
libcrypto = find_library("libeay32") libcrypto = find_library("libcrypto")
else: else:
libcrypto = find_library("crypto") libcrypto = find_library("crypto")