Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix(linux): a meeting's lines keep whether they were heard in the room, so a Mac + Room record opened on Linux stays the same

wquguru5e956985c046
diff --git a/linux/cicada/core/models.py b/linux/cicada/core/models.py
index fc312fb..8da4b41 100644
--- a/linux/cicada/core/models.py
+++ b/linux/cicada/core/models.py
@@ -41,19 +41,21 @@ class TranscriptLine:
srcLang: str = ""
dstLang: str = ""
voice: int | None = None # experimental voice id on the Mac; Linux doesn't tell voices apart
+ via: str | None = None # 电脑和会议室: "room" when the room mic heard it; absent for the computer's audio
def copy(self) -> "TranscriptLine":
- return TranscriptLine(self.id, self.t, self.speaker, self.src, self.dst, self.srcLang, self.dstLang, self.voice)
+ return TranscriptLine(self.id, self.t, self.speaker, self.src, self.dst, self.srcLang, self.dstLang, self.voice, self.via)
def to_json(self) -> dict:
return {"id": self.id, "t": self.t, "speaker": self.speaker, "src": self.src, "dst": self.dst,
- "srcLang": self.srcLang, "dstLang": self.dstLang, "voice": self.voice}
+ "srcLang": self.srcLang, "dstLang": self.dstLang, "voice": self.voice, "via": self.via}
@staticmethod
def from_json(o: dict) -> "TranscriptLine":
return TranscriptLine(id=string(o.get("id")) or "", t=_num(o.get("t"), 0.0), speaker=string(o.get("speaker")) or "them",
src=string(o.get("src")) or "", dst=string(o.get("dst")), srcLang=string(o.get("srcLang")) or "",
- dstLang=string(o.get("dstLang")) or "", voice=integer(o.get("voice")))
+ dstLang=string(o.get("dstLang")) or "", voice=integer(o.get("voice")),
+ via=string(o.get("via")))
def _num(v, fallback):
diff --git a/linux/tests/test_core.py b/linux/tests/test_core.py
index e00c280..c867dda 100644
--- a/linux/tests/test_core.py
+++ b/linux/tests/test_core.py
@@ -202,6 +202,15 @@ class Records(Base):
self.assertIsNone(s.notes.topics[0].point_time(1))
self.assertEqual(MAC, s.write())
+ def test_keeps_where_a_line_was_heard(self):
+ # 电脑和会议室 on the Mac: a room line says "via" : "room"; written back unchanged.
+ text = MAC.replace(' "t" : 2.5,\n "voice" : 1\n', ' "t" : 2.5,\n "via" : "room",\n "voice" : 1\n')
+ self.assertNotEqual(MAC, text)
+ s = Session.read(text)
+ self.assertEqual("room", s.lines[0].via)
+ self.assertEqual("room", s.lines[0].copy().via)
+ self.assertEqual(text, s.write())
+
def test_json_edge_cases(self):
self.assertEqual("3", jsonfmt.number(3.0))
self.assertEqual("0.0001", jsonfmt.number(0.0001))