Pure functions for action log management and SRT subtitle generation.
The action log records user-facing browser commands with timestamps, enabling SRT subtitle export for video overlays. All functions are pure — no atoms, no side effects, no Playwright dependency.
Action entry shape: {:idx long ;; 1-based sequence number :timestamp long ;; epoch millis (System/currentTimeMillis) :action string ;; command name ("click", "navigate", etc.) :target string|nil ;; ref or selector ("@e12345") :args map|nil ;; additional arguments :session string|nil} ;; session name
SRT format: 1 00:00:01,200 --> 00:00:03,500 click @e12345
2 00:00:03,500 --> 00:00:05,800 fill @e67890 "search text"
Pure functions for action log management and SRT subtitle generation.
The action log records user-facing browser commands with timestamps,
enabling SRT subtitle export for video overlays. All functions are
pure — no atoms, no side effects, no Playwright dependency.
Action entry shape:
{:idx long ;; 1-based sequence number
:timestamp long ;; epoch millis (System/currentTimeMillis)
:action string ;; command name ("click", "navigate", etc.)
:target string|nil ;; ref or selector ("@e12345")
:args map|nil ;; additional arguments
:session string|nil} ;; session name
SRT format:
1
00:00:01,200 --> 00:00:03,500
click @e12345
2
00:00:03,500 --> 00:00:05,800
fill @e67890 "search text"(actions->srt entries)(actions->srt entries opts)Converts a vector of action log entries to an SRT subtitle string.
Each action becomes one subtitle cue. Timing is computed as offsets from the first entry's timestamp. Each cue's end time is the next cue's start time (or start + 3000ms for the last cue).
Options: :min-duration-ms Minimum cue duration in ms (default: 1000) :max-duration-ms Maximum cue duration in ms (default: 5000)
Returns an SRT-formatted string, or empty string if entries is empty.
Converts a vector of action log entries to an SRT subtitle string. Each action becomes one subtitle cue. Timing is computed as offsets from the first entry's timestamp. Each cue's end time is the next cue's start time (or start + 3000ms for the last cue). Options: :min-duration-ms Minimum cue duration in ms (default: 1000) :max-duration-ms Maximum cue duration in ms (default: 5000) Returns an SRT-formatted string, or empty string if entries is empty.
(format-action-description entry)Formats an action entry into a human-readable description for subtitles.
Examples: {:action "click" :target "@e12345"} → "click @e12345" {:action "navigate" :args {"url" "https://example.org"}} → "navigate https://example.org" {:action "fill" :target "@e67890" :args {"value" "hello"}} → "fill @e67890 "hello"" {:action "press" :target "@e11111" :args {"key" "Enter"}} → "press @e11111 Enter"
Formats an action entry into a human-readable description for subtitles.
Examples:
{:action "click" :target "@e12345"} → "click @e12345"
{:action "navigate" :args {"url" "https://example.org"}} → "navigate https://example.org"
{:action "fill" :target "@e67890" :args {"value" "hello"}} → "fill @e67890 \"hello\""
{:action "press" :target "@e11111" :args {"key" "Enter"}} → "press @e11111 Enter"(millis->srt-time millis)Converts a millisecond offset to SRT time format: HH:MM:SS,mmm Example: 3661200 → "01:01:01,200"
Converts a millisecond offset to SRT time format: HH:MM:SS,mmm Example: 3661200 → "01:01:01,200"
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |