Skip to content
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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,13 @@ The repository deliberately does not publish live user configuration, signed pla

## Optional sounds

Recorder and the Coordinator use separate optional local sound files:
Recorder and the Coordinator use optional local sound files from the shared `sounds/` folder:

```text
alarm.wav
sounds/refresh.wav
sounds/launch.wav
sounds/
alarm.wav
refresh.wav
launch.wav
```

- `alarm.wav` — recording-engine alarm sound for serious runtime conditions.
Expand Down
8 changes: 6 additions & 2 deletions record_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2316,12 +2316,16 @@ def _alarm_beep_fallback_loop(
stop_event.wait(float(NM3U8DL_ALARM_BEEP_GAP_SEC))

def _resolve_alarm_sound_path() -> Optional[str]:
# ALARM_SOUND_FILENAME may be absolute or relative to this script folder.
# ALARM_SOUND_FILENAME may be absolute or relative to the shared sounds folder.
try:
if os.path.isabs(ALARM_SOUND_FILENAME):
p = ALARM_SOUND_FILENAME
else:
p = os.path.join(os.path.dirname(os.path.abspath(__file__)), ALARM_SOUND_FILENAME)
p = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"sounds",
ALARM_SOUND_FILENAME,
)
except Exception:
return None
return p
Expand Down
8 changes: 8 additions & 0 deletions tests/test_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def test_recorder_and_coordinator_share_sound_snooze_runtime_core(self):
self.assertIn("from recorder_runtime import sound as runtime_sound", recorder)
self.assertIn("from recorder_runtime import sound as runtime_sound", coordinator)

def test_recorder_alarm_uses_shared_sounds_directory(self):
recorder=(ROOT/"record_dynamic.py").read_text(encoding="utf-8")
start=recorder.index("def _resolve_alarm_sound_path()")
end=recorder.index("def _shared_alarm_sound_loop(", start)
resolver=recorder[start:end]
self.assertIn('"sounds"', resolver)
self.assertIn("ALARM_SOUND_FILENAME", resolver)

def test_coordinator_config_and_acquisition_have_single_module_owners(self):
entry=(ROOT/"recorder_event_coordinator.py").read_text(encoding="utf-8")
config=(ROOT/"recorder_coordinator"/"configuration.py").read_text(encoding="utf-8")
Expand Down
Loading