Commit Graph
11 Commits
Author SHA1 Message Date
Isaac ConnorandClaude Opus 5 428c048bac feat: measure the audio level on demand, with a meter in the editor
Reverts the previous commit's always-on measurement. Decoding audio for every
monitor that has it spends CPU on a number almost nothing reads, which is the
wrong trade even though it did solve the chicken and egg of picking a
threshold without ever seeing a level.

Measure when something is actually going to use the reading instead:

 - AudioDetection is on, as before, so nothing changes for a monitor that
   scores on audio; or
 - somebody asked. SharedData gains audio_level_until, a wall clock second
   the capture thread keeps measuring up to. The monitor editor's new level
   meter pushes it forward while it is on screen and the measurement lapses a
   few seconds after the page is left, so nothing has to send a stop and a
   crashed browser cannot leave a monitor decoding forever.

When the reading stops being wanted the decoder is released and the published
level and peak are cleared, so a stale number is not left looking current and
an old peak does not land on the next frame row written.

audio_level_until is carved out of analysis_pad rather than appended, so
SharedData stays 888 bytes and no existing offset moves; the static_asserts,
Memory.pm and Monitor.php are updated together and all three now agree the
field is at +880.

The meter itself is on the audio settings, shown whether or not
AudioDetection is checked, because the level is what you need in order to
choose a threshold. It draws the threshold currently in the input as a mark on
the bar so a reading can be judged against it before saving, and a monitor
whose zmc is not running reads "no reading" rather than a confident 0, which
would be indistinguishable from silence.

Frames.AudioLevel is therefore 0 again on monitors that do not score on audio.
That is what the graph already treats as "no audio data", so it draws no line
rather than a flat one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JpiSWBmtQkR5bcgpHWY4ME
2026-09-20 18:17:44 -05:00
Isaac ConnorandClaude Opus 4.8 03f3af3d36 fix: replace Cyrillic С with Latin C in monitor ajax error message
web/ajax/monitor.php built its permission-error text with
translate('СonjOr'), where the leading С is Cyrillic Es (U+0421), not
Latin C. Two consequences:

- The lookup key did not match the defined 'ConjOr' translation (Latin C,
  en_gb.php), so translate() fell through to echoing the raw key instead of
  the conjunction "or".
- The multi-byte UTF-8 sequence (0xD0 0xA1) is corrupted by some reverse
  proxies, surfacing as a stray control byte in the served response.

Use the Latin 'ConjOr' key, matching every other caller (e.g.
web/includes/FilterTerm.php). A full Cyrillic/Greek homoglyph sweep of the
first-party tree (excluding lang/ and vendored assets) found this as the
only remaining occurrence.

refs https://github.com/ZoneMinder/zoneminder/discussions/4993

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KQipwf632JGgNH4W7p8cqs
2026-07-19 23:16:48 -04:00
IgorA100 dde477e005 Revert to "translate('СonjOr')" (monitor.php)
Because the translation translate('СonjOr') is already used with a lowercase letter
2026-06-13 17:32:21 +03:00
IgorA100 3b05c03e1f Added "is_string($_REQUEST['monitorName'])" check (monitor.php) 2026-06-13 17:03:39 +03:00
IgorA100 f49235fc3e Use translate('conjOr') instead of translate('ConjOr') (monitor.php)
Because this translation is used in the middle of a string, spelling rules require it to be written with a lowercase first letter.
2026-06-13 16:41:41 +03:00
IgorA100 cef7abcb18 Update monitor.php 2026-06-04 10:16:36 +03:00
IgorA100 a4a97b79f6 Check the 'action' parameter passed to the request (monitor.php)
And use 'ConjOr' instead of 'or' for translation
2026-06-04 10:14:01 +03:00
IgorA100 12430ea98b - Added a check for editing permissions for a specific monitor
- English translation correction
2026-06-01 13:21:32 +03:00
IgorA100 c2820d1317 - Don't create symlinks if the monitor name is equal to its ID. This was previously broken in https://github.com/IgorA100/zoneminder/commit/9561ed894738a707814f0b25a11420241b89b29d
- Moved $oldLinkPathFound analysis outside the storages loop
- More correct check for an empty $_REQUEST['monitorName'] value
2026-05-27 12:12:38 +03:00
IgorA100andCopilot Autofix powered by AI d4bbf23c98 Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-27 09:57:42 +03:00
IgorA100 ad269916f3 - Monitor name validation is now performed via an AJAX request in a PHP file.
- Added translations for English and Russian.
- Added a method to the Monitor class for retrieving default settings. This is necessary to retrieve the 'filter_regexp' of the monitor name, so as not to re-specify 'filter_regexp' during an AJAX request.
- Added the \web\ajax\monitor.php file.
2026-05-26 16:23:39 +03:00