Skip to content
Snippets Groups Projects
Commit 229e155c authored by Ahmet Öner's avatar Ahmet Öner
Browse files

Fix JSON serialization of segments due to Faster Whisper v1.1.0 changes

parent 74bf823b
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,10 @@ Changelog ...@@ -4,6 +4,10 @@ Changelog
Unreleased Unreleased
---------- ----------
### Fixed
- Fix JSON serialization of segments due to Faster Whisper v1.1.0 changes
[1.7.0] (2024-12-17) [1.7.0] (2024-12-17)
-------------------- --------------------
......
import json import json
import os import os
from dataclasses import asdict
from typing import TextIO, BinaryIO from typing import TextIO, BinaryIO
import ffmpeg import ffmpeg
...@@ -88,6 +89,8 @@ class WriteJSON(ResultWriter): ...@@ -88,6 +89,8 @@ class WriteJSON(ResultWriter):
extension: str = "json" extension: str = "json"
def write_result(self, result: dict, file: TextIO): def write_result(self, result: dict, file: TextIO):
if "segments" in result:
result["segments"] = [asdict(segment) for segment in result["segments"]]
json.dump(result, file) json.dump(result, file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment