Merge pull request #6 from pathintegral-institute/rong/tech-150-add-kwarg

add  converters
This commit is contained in:
rong-xyz 2025-04-23 20:45:38 +08:00 committed by GitHub
commit 237753db15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -55,13 +55,13 @@ class MarkItUp:
for plugin_name, converter in plugins.items(): for plugin_name, converter in plugins.items():
self.converters[plugin_name] = converter self.converters[plugin_name] = converter
def convert(self, stream: BinaryIO, file_name: str) -> Dict[DocumentConverterResult, StreamInfo]: def convert(self, stream: BinaryIO, file_name: str, **kwargs) -> Dict[DocumentConverterResult, StreamInfo]:
stream_info: StreamInfo = self._get_stream_info(stream, file_name) stream_info: StreamInfo = self._get_stream_info(stream, file_name)
# Deal with unsupported file types # Deal with unsupported file types
try: try:
if stream_info.category in self.converters.keys(): if stream_info.category in self.converters.keys():
converter = self.converters[stream_info.category](config=self.config) converter = self.converters[stream_info.category](config=self.config)
return converter.convert(stream, stream_info), stream_info return converter.convert(stream, stream_info, **kwargs), stream_info
else: else:
match stream_info.category: match stream_info.category:
case "ppt": case "ppt":

View file

@ -20,7 +20,7 @@ class AudioConverter(DocumentConverter):
file_stream: BinaryIO, file_stream: BinaryIO,
stream_info: StreamInfo, stream_info: StreamInfo,
** kwargs: Any, # Options to pass to the converter ** kwargs: Any, # Options to pass to the converter
) -> Tuple[DocumentConverterResult, StreamInfo]: ) -> DocumentConverterResult:
md_content = "" md_content = ""
# Transcribe # Transcribe