Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unimplemented error #409

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Related issues / PRs
## Related issues / PRs. Summarize issues.
- #

## Summarize Changes
Expand Down
16 changes: 16 additions & 0 deletions modules/utils/subtitle_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def write_result(
):
raise NotImplementedError

def to_segments(self, file_path: str):
raise NotImplementedError


class WriteTXT(ResultWriter):
extension: str = "txt"
Expand All @@ -101,6 +104,19 @@ def write_result(
for segment in result["segments"]:
print(segment["text"].strip(), file=file, flush=True)

def to_segments(self, file_path: str):
segments = []

blocks = read_file(file_path).split('\n')

for block in blocks:
segments.append(Segment(
start=None,
end=None,
text=block
))
return segments


class SubtitlesWriter(ResultWriter):
always_include_hours: bool
Expand Down