|
|
|
@@ -3,6 +3,7 @@
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import shutil
|
|
|
|
from textwrap import dedent
|
|
|
|
from textwrap import dedent
|
|
|
|
from .__about__ import __version__
|
|
|
|
from .__about__ import __version__
|
|
|
|
from ._markitdown import MarkItDown, DocumentConverterResult
|
|
|
|
from ._markitdown import MarkItDown, DocumentConverterResult
|
|
|
|
@@ -74,6 +75,8 @@ def main():
|
|
|
|
parser.add_argument("filename", nargs="?")
|
|
|
|
parser.add_argument("filename", nargs="?")
|
|
|
|
args = parser.parse_args()
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
which_exiftool = shutil.which("exiftool")
|
|
|
|
|
|
|
|
|
|
|
|
if args.use_docintel:
|
|
|
|
if args.use_docintel:
|
|
|
|
if args.endpoint is None:
|
|
|
|
if args.endpoint is None:
|
|
|
|
raise ValueError(
|
|
|
|
raise ValueError(
|
|
|
|
@@ -81,9 +84,9 @@ def main():
|
|
|
|
)
|
|
|
|
)
|
|
|
|
elif args.filename is None:
|
|
|
|
elif args.filename is None:
|
|
|
|
raise ValueError("Filename is required when using Document Intelligence.")
|
|
|
|
raise ValueError("Filename is required when using Document Intelligence.")
|
|
|
|
markitdown = MarkItDown(docintel_endpoint=args.endpoint)
|
|
|
|
markitdown = MarkItDown(exiftool_path=which_exiftool, docintel_endpoint=args.endpoint)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
markitdown = MarkItDown()
|
|
|
|
markitdown = MarkItDown(exiftool_path=which_exiftool)
|
|
|
|
|
|
|
|
|
|
|
|
if args.filename is None:
|
|
|
|
if args.filename is None:
|
|
|
|
result = markitdown.convert_stream(sys.stdin.buffer)
|
|
|
|
result = markitdown.convert_stream(sys.stdin.buffer)
|
|
|
|
|