Skip to content

Commit

Permalink
Add new lines in TXT segments (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidiwilliams committed May 1, 2023
1 parent 0804c27 commit 5892e3a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions buzz/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,7 @@ def write_output(path: str, segments: List[Segment], output_format: OutputFormat
if output_format == OutputFormat.TXT:
for (i, segment) in enumerate(segments):
file.write(segment.text)
if i < len(segments) - 1:
file.write(' ')
file.write('\n')
file.write('\n')

elif output_format == OutputFormat.VTT:
file.write('WEBVTT\n\n')
Expand Down
2 changes: 1 addition & 1 deletion tests/transcriber_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_transcribe(self):
@pytest.mark.parametrize(
'output_format,output_text',
[
(OutputFormat.TXT, 'Bien venue dans\n'),
(OutputFormat.TXT, 'Bien\nvenue dans\n'),
(
OutputFormat.SRT,
'1\n00:00:00,040 --> 00:00:00,299\nBien\n\n2\n00:00:00,299 --> 00:00:00,329\nvenue dans\n\n'),
Expand Down
2 changes: 1 addition & 1 deletion tests/widgets/transcription_viewer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ def test_should_export_segments(self, tmp_path: pathlib.Path, qtbot: QtBot, task
export_button.menu().actions()[0].trigger()

output_file = open(output_file_path, 'r', encoding='utf-8')
assert 'Bien venue dans' in output_file.read()
assert 'Bien\nvenue dans' in output_file.read()

0 comments on commit 5892e3a

Please sign in to comment.