add multi-apps 5 examples by ruisheng 2024-03-06
This commit is contained in:
@@ -40,20 +40,23 @@ def get_audio_in_slide(env, config: Dict[str, str]):
|
||||
audio_file_path = audio_file_path.replace('\\', '/')
|
||||
|
||||
# Create a temporary directory to extract the audio file
|
||||
with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
# Extract the audio file
|
||||
myzip.extract(audio_file_path, tmpdirname)
|
||||
# Get the full path of the extracted audio file
|
||||
extracted_audio_path = os.path.join(tmpdirname, audio_file_path)
|
||||
# Return the extracted audio file path
|
||||
audio_file_path = extracted_audio_path
|
||||
|
||||
tmpdirname = os.path.dirname(ppt_file_localhost_path)
|
||||
myzip.extract(audio_file_path, tmpdirname)
|
||||
audio_file_path = os.path.join(tmpdirname, audio_file_path)
|
||||
return audio_file_path
|
||||
# with tempfile.TemporaryDirectory() as tmpdirname:
|
||||
# # Extract the audio file
|
||||
# myzip.extract(audio_file_path, tmpdirname)
|
||||
# # Get the full path of the extracted audio file
|
||||
# extracted_audio_path = os.path.join(tmpdirname, audio_file_path)
|
||||
# # Return the extracted audio file path
|
||||
# audio_file_path = extracted_audio_path
|
||||
else:
|
||||
# the audio file is external to the .pptx file
|
||||
# Return the audio file path
|
||||
assert target.startswith("file://"), target
|
||||
audio_file_path = target[7:]
|
||||
|
||||
break
|
||||
if audio_file_path is None:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user