Skip to content

Commit

Permalink
Merge pull request #234 from jhj0517/fix/safe-filename
Browse files Browse the repository at this point in the history
Disable `safe_filename()` on local file
  • Loading branch information
jhj0517 authored Aug 16, 2024
2 parents 60697fb + 4c5ae77 commit 3093cad
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions modules/whisper/whisper_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def transcribe_file(self,
)

file_name, file_ext = os.path.splitext(os.path.basename(file.name))
file_name = safe_filename(file_name)
subtitle, file_path = self.generate_and_write_file(
file_name=file_name,
transcribed_segments=transcribed_segments,
Expand Down Expand Up @@ -365,26 +364,25 @@ def generate_and_write_file(file_name: str,
output_path: str
output file path
"""
timestamp = datetime.now().strftime("%m%d%H%M%S")
if add_timestamp:
timestamp = datetime.now().strftime("%m%d%H%M%S")
output_path = os.path.join(output_dir, f"{file_name}-{timestamp}")
else:
output_path = os.path.join(output_dir, f"{file_name}")

if file_format == "SRT":
content = get_srt(transcribed_segments)
output_path += '.srt'
write_file(content, output_path)

elif file_format == "WebVTT":
content = get_vtt(transcribed_segments)
output_path += '.vtt'
write_file(content, output_path)

elif file_format == "txt":
content = get_txt(transcribed_segments)
output_path += '.txt'
write_file(content, output_path)

write_file(content, output_path)
return content, output_path

@staticmethod
Expand Down

0 comments on commit 3093cad

Please sign in to comment.