Merge pull request #6 from pathintegral-institute/rong/tech-150-add-kwarg
add converters
This commit is contained in:
commit
237753db15
2 changed files with 3 additions and 3 deletions
|
|
@ -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":
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue