]> xmof Git - DeDRM.git/commitdiff
Remove unnecessary “.voucher” suffix handling
authorcalibre-user <sutemeado2023+calibre@gmail.com>
Tue, 24 Jun 2025 01:06:39 +0000 (10:06 +0900)
committercalibre-user <sutemeado2023+calibre@gmail.com>
Tue, 24 Jun 2025 01:06:39 +0000 (10:06 +0900)
DeDRM_plugin/standalone/remove_drm.py

index 61fd66964b1e12ca4bcee3f37c82de1d6fce48f9..8f26d921ae809cb72179084ba17e26761ae4efb8 100644 (file)
@@ -153,28 +153,6 @@ def dedrm_single_file(input_file, output_file):
         from .__init__ import kfx_skeyfile
         keyfile = kfx_skeyfile
         temp_keyfile = None
-        # Some key files omit the trailing '.voucher' on the voucher ID.
-        # Add a duplicate entry with the suffix so the ion parser can match.
-        if keyfile and os.path.isfile(keyfile):
-            with open(keyfile, "r", encoding="utf8") as fh:
-                lines = fh.read().splitlines()
-            amended = []
-            changed = False
-            for line in lines:
-                amended.append(line)
-                parts = line.split("$", 1)
-                if len(parts) > 1:
-                    vid, rest = parts[0], parts[1]
-                    if not vid.endswith(".voucher"):
-                        amended.append(f"{vid}.voucher${rest}")
-                        changed = True
-            if changed:
-                import tempfile
-                tf = tempfile.NamedTemporaryFile("w", delete=False)
-                tf.write("\n".join(amended) + "\n")
-                tf.close()
-                temp_keyfile = tf.name
-                keyfile = temp_keyfile
         try:
             book = KFXZipBook(input_file, keyfile)
             book.processBook([''])