Skip to content
Snippets Groups Projects
Unverified Commit 872e6497 authored by Ahmet Öner's avatar Ahmet Öner Committed by GitHub
Browse files

Merge pull request #265 from ahmetoner/fix-faster-whisper-json

Fix JSON serialization of segments due to Faster Whisper v1.1.0 changes
parents 74bf823b 229e155c
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ Changelog
Unreleased
----------
### Fixed
- Fix JSON serialization of segments due to Faster Whisper v1.1.0 changes
[1.7.0] (2024-12-17)
--------------------
......
import json
import os
from dataclasses import asdict
from typing import TextIO, BinaryIO
import ffmpeg
......@@ -88,6 +89,8 @@ class WriteJSON(ResultWriter):
extension: str = "json"
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment