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): third-party media formats installed while Cicada is open turn on Save meeting audio and playback without a restart

wqugurue3566d184bb5
diff --git a/linux/cicada/app/main.py b/linux/cicada/app/main.py
index 5ab57ff..0e29fdb 100644
--- a/linux/cicada/app/main.py
+++ b/linux/cicada/app/main.py
@@ -141,6 +141,7 @@ class Controller:
def _recorder(self, sid: str):
"""The new meeting's recorder, or None (setting off, or no AAC encoder here)."""
from . import media
+ media.rescan() # formats installed since launch record this meeting
if not self.settings.recordAudio or media.encoder() is None:
return None
rec = media.Recorder(self.store.audio_path(sid))
@@ -265,6 +266,8 @@ class Controller:
self.notes_window.show_all()
def show_records(self) -> None:
+ from . import media
+ media.rescan() # a recording plays once the formats are installed, no restart
if self.records_window is None:
from .records_window import RecordsWindow
self.records_window = RecordsWindow(self)
diff --git a/linux/cicada/app/media.py b/linux/cicada/app/media.py
index bda559b..8ceaa3b 100644
--- a/linux/cicada/app/media.py
+++ b/linux/cicada/app/media.py
@@ -45,6 +45,17 @@ def can_play() -> bool:
return _has("playbin") and any(_has(d) for d in DECODERS)
+def rescan() -> None:
+ """Looks again for what was missing: the third-party media formats installed while Cicada runs
+ (Settings says to) work without a restart. GStreamer read its plugin registry once at init; the
+ rescan takes ~0.1 s after a new plugin and nothing when none changed."""
+ if Gst is None or (encoder() is not None and can_play()):
+ return
+ Gst.update_registry()
+ for name in [n for n, found in _found.items() if not found]:
+ del _found[name]
+
+
def codecs() -> dict:
"""What this computer has (debug, the log)."""
return {"gst": Gst is not None, "encoder": encoder(), "decoders": [d for d in DECODERS if _has(d)], "play": can_play()}
diff --git a/linux/cicada/app/settings_window.py b/linux/cicada/app/settings_window.py
index 7827e4f..aa8ba0e 100644
--- a/linux/cicada/app/settings_window.py
+++ b/linux/cicada/app/settings_window.py
@@ -315,22 +315,32 @@ class SettingsWindow(Gtk.Window):
return ui.prow(title, box, L("在任何窗口里都能用"))
def _record_row(self) -> Gtk.Widget:
- """保存会议录音: on by default, as on the Mac; greyed out, saying why, without an AAC encoder."""
+ """保存会议录音: on by default, as on the Mac; greyed out, saying why, without an AAC encoder.
+ Checked again each time Settings shows: the formats may have been installed meanwhile."""
app = self.app
sw = Gtk.Switch()
sw.set_valign(Gtk.Align.CENTER)
- ok = app.can_record
- sw.set_active(ok and app.settings.recordAudio)
- sw.set_sensitive(ok)
+ hint = ui.text("", 11, "tertiary", width_chars=50)
+ state = {"ok": False}
+
+ def check(*_):
+ from . import media
+ media.rescan()
+ ok = state["ok"] = app.can_record
+ sw.set_active(ok and app.settings.recordAudio)
+ sw.set_sensitive(ok)
+ ui.retext(hint, L("只存在这台电脑上") if ok else L("这台电脑缺少 AAC 编码器,装上“第三方媒体格式”后可用"))
def toggled(w, _p):
- if not ok:
+ if not state["ok"]:
return
app.settings.recordAudio = w.get_active()
app.settings.save()
app.settings_changed()
+ check()
sw.connect("notify::active", toggled)
- return ui.prow(L("保存会议录音"), sw, L("只存在这台电脑上") if ok else L("这台电脑缺少 AAC 编码器,装上“第三方媒体格式”后可用"))
+ self.connect("show", check)
+ return ui.prow(L("保存会议录音"), sw, subtitle_widget=hint)
def scroll_to_general(self) -> None:
"""Brings 通用 into view (the records window's 保存会议录音 link), once it is laid out."""
diff --git a/site/changelog.json b/site/changelog.json
index 45a25e9..5d41399 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -209,6 +209,14 @@
"title": "英文界面下,自建 AI 服务出错或连不上时,提示里的服务名也是英文。",
"text": "原来写成“其他(兼容 OpenAI)”夹在英文句子里;还没出第一句时的出错提示也不再被截断。"
},
+ {
+ "kind": "fixed",
+ "platforms": [
+ "linux"
+ ],
+ "title": "开着知了装上第三方媒体格式后,不用重开,“保存会议录音”就能打开,会议记录里的录音也能播放。",
+ "text": "重新打开设置或会议记录时会再找一遍 AAC 编码器和解码器。"
+ },
{
"kind": "fixed",
"platforms": [