streamembed 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {streamembed-0.3.2 → streamembed-0.3.4}/PKG-INFO +7 -5
- {streamembed-0.3.2 → streamembed-0.3.4}/PYPI.md +2 -2
- {streamembed-0.3.2 → streamembed-0.3.4}/README.md +2 -2
- {streamembed-0.3.2 → streamembed-0.3.4}/docs/reference.md +3 -3
- {streamembed-0.3.2 → streamembed-0.3.4}/pyproject.toml +9 -4
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/__init__.py +1 -1
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/api.py +4 -4
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/capture.py +61 -3
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/cli.py +41 -1
- streamembed-0.3.4/src/streamembed/sckgrab.py +160 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/service.py +6 -1
- streamembed-0.3.4/tests/test_sckgrab.py +58 -0
- streamembed-0.3.4/tests/test_screen_permission.py +31 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/.gitignore +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/.hgignore +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/LICENSE +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/NOTICE +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/examples/main.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/__main__.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/ann.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/config.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/defaults.toml +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/encoder.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/__init__.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/config.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/engine.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/llm.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/macs.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/model.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/pause.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/qwen_embedder.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/spatial.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/temporal.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/engine/vit.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/gate.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/index.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/models.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/queryserver.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/static/results.html +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/visualize.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/src/streamembed/webui.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/conftest.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_api.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_config.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_defer.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_encoder_order.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_front.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_idle.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_models.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_pause.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_prune.py +0 -0
- {streamembed-0.3.2 → streamembed-0.3.4}/tests/test_search_wait.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: streamembed
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Search your own screen history by describing what you saw, from screenshots, on your machine
|
|
5
|
+
Project-URL: Repository, https://github.com/StarTrail-org/StreamEmbed
|
|
5
6
|
License-Expression: Apache-2.0
|
|
6
7
|
License-File: LICENSE
|
|
7
8
|
License-File: NOTICE
|
|
@@ -17,10 +18,11 @@ Requires-Dist: mss<11,>=9
|
|
|
17
18
|
Requires-Dist: numpy>=2.2
|
|
18
19
|
Requires-Dist: pillow>=11
|
|
19
20
|
Requires-Dist: pyobjc-framework-quartz>=10; sys_platform == 'darwin'
|
|
21
|
+
Requires-Dist: pyobjc-framework-screencapturekit>=10.1; sys_platform == 'darwin'
|
|
20
22
|
Requires-Dist: qwen-vl-utils==0.0.14
|
|
21
23
|
Requires-Dist: safetensors>=0.4
|
|
22
|
-
Requires-Dist: torch==2.
|
|
23
|
-
Requires-Dist: torchvision==0.
|
|
24
|
+
Requires-Dist: torch==2.14.1
|
|
25
|
+
Requires-Dist: torchvision==0.29.2
|
|
24
26
|
Requires-Dist: transformers==5.17.0
|
|
25
27
|
Provides-Extra: dev
|
|
26
28
|
Requires-Dist: pytest>=8; extra == 'dev'
|
|
@@ -39,7 +41,7 @@ uv tool install streamembed # the streamembed command, in an environment of
|
|
|
39
41
|
uv pip install streamembed # or into your project's environment
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow
|
|
44
|
+
Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow screen capture for Python when asked (System Settings > Privacy & Security > Screen & System Audio Recording; nothing records audio, only the name mentions it). StreamEmbed opens that pane and prints what to turn on; then run `streamembed start` again.
|
|
43
45
|
|
|
44
46
|
## Quick Start
|
|
45
47
|
|
|
@@ -89,7 +91,7 @@ capture.stop()
|
|
|
89
91
|
|
|
90
92
|
## Requirements
|
|
91
93
|
|
|
92
|
-
Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.
|
|
94
|
+
Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.14.1 and transformers 5.17.0, so install it in an environment of its own if your project needs other versions.
|
|
93
95
|
|
|
94
96
|
## License
|
|
95
97
|
|
|
@@ -9,7 +9,7 @@ uv tool install streamembed # the streamembed command, in an environment of
|
|
|
9
9
|
uv pip install streamembed # or into your project's environment
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow
|
|
12
|
+
Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow screen capture for Python when asked (System Settings > Privacy & Security > Screen & System Audio Recording; nothing records audio, only the name mentions it). StreamEmbed opens that pane and prints what to turn on; then run `streamembed start` again.
|
|
13
13
|
|
|
14
14
|
## Quick Start
|
|
15
15
|
|
|
@@ -59,7 +59,7 @@ capture.stop()
|
|
|
59
59
|
|
|
60
60
|
## Requirements
|
|
61
61
|
|
|
62
|
-
Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.
|
|
62
|
+
Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.14.1 and transformers 5.17.0, so install it in an environment of its own if your project needs other versions.
|
|
63
63
|
|
|
64
64
|
## License
|
|
65
65
|
|
|
@@ -9,7 +9,7 @@ uv tool install streamembed # the streamembed command, in an environment of
|
|
|
9
9
|
uv pip install streamembed # or into your project's environment
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow
|
|
12
|
+
Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow screen capture for Python when asked (System Settings > Privacy & Security > Screen & System Audio Recording; nothing records audio, only the name mentions it). StreamEmbed opens that pane and prints what to turn on; then run `streamembed start` again.
|
|
13
13
|
|
|
14
14
|
## Quick Start
|
|
15
15
|
|
|
@@ -59,7 +59,7 @@ capture.stop()
|
|
|
59
59
|
|
|
60
60
|
## Requirements
|
|
61
61
|
|
|
62
|
-
Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.
|
|
62
|
+
Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.14.1 and transformers 5.17.0, so install it in an environment of its own if your project needs other versions.
|
|
63
63
|
|
|
64
64
|
## Reference
|
|
65
65
|
|
|
@@ -4,9 +4,9 @@ Everything the README leaves out: every command and function, all settings, the
|
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
Python 3.12 or later. Tested on macOS 15 (Apple silicon, GPU), Ubuntu 24.04 under X11 (Xvfb; CPU) and Windows Server 2025 (CPU): installing, indexing a folder, searching, capturing, and the background service (start, pause, resume, stop, restart after a reboot). Not tested: Wayland (not supported), Windows with several monitors, CUDA GPUs. On macOS, capturing the screen needs Screen Recording permission for the app that runs Python
|
|
7
|
+
Python 3.12 or later. Tested on macOS 15 (Apple silicon, GPU), Ubuntu 24.04 under X11 (Xvfb; CPU) and Windows Server 2025 (CPU): installing, indexing a folder, searching, capturing, and the background service (start, pause, resume, stop, restart after a reboot). Not tested: Wayland (not supported), Windows with several monitors, CUDA GPUs. On macOS, capturing the screen needs the Screen & System Audio Recording permission (Screen Recording before macOS 15; no audio is recorded) for the app that runs Python: the terminal app, or for the background service the Python itself. No command can grant it: `build_index_from_now` opens that pane in System Settings and raises `PermissionError` saying what to turn on, until it is granted. On macOS 14 and later the screen is grabbed with ScreenCaptureKit; mss grabs it on macOS 13, Linux and Windows, and also takes over any grab ScreenCaptureKit cannot make. On Windows, capture needs a logged-in desktop session: while the screen is locked, captures fail and are retried. Indexing `~/Desktop` on macOS needs access to it for the terminal (or, for `streamembed start --folder`, the service's Python): allow it in System Settings > Privacy & Security > Files and Folders; without it, indexing stops with a permission error.
|
|
8
8
|
|
|
9
|
-
Dependencies are pinned to torch 2.
|
|
9
|
+
Dependencies are pinned to torch 2.14.1 and transformers 5.17.0: the stream encoder re-implements parts of the Qwen3-VL forward pass against transformers internals, and its outputs were checked for equality with these versions. Install StreamEmbed in its own environment (for example `uv tool`, `pipx`, or a venv) if your project needs other versions.
|
|
10
10
|
|
|
11
11
|
The `hnsw` index type needs the `hnsw` extra (`pip install "streamembed[hnsw]"`), which installs chroma-hnswlib 0.7.6: hnswlib with prebuilt wheels (the `hnswlib` package itself is a source package that needs a C++ compiler). Its wheels cover Python 3.12; on later Python versions it is built from source. It does not use OpenMP and runs in one process with torch (checked on macOS with torch 2.8.0 on MPS). The other types need only numpy. On Windows, the `hnsw` extra needs the Microsoft C++ Build Tools: it has no prebuilt wheel there. The index type is a setting, not an install choice: `streamembed config set index_type pq` switches an existing index without indexing again.
|
|
12
12
|
|
|
@@ -149,7 +149,7 @@ se.uninstall_service() # stops it and removes it; the
|
|
|
149
149
|
|
|
150
150
|
| System | Service | Notes |
|
|
151
151
|
|---|---|---|
|
|
152
|
-
| macOS | launchd user agent `org.streamembed.capture` (`~/Library/LaunchAgents/`) | The first start asks for
|
|
152
|
+
| macOS | launchd user agent `org.streamembed.capture` (`~/Library/LaunchAgents/`) | The first start asks for screen capture permission for this Python (System Settings > Privacy & Security > Screen & System Audio Recording; Screen Recording before macOS 15), opens that pane and writes the Python to turn on to `service.log`; `streamembed start` then prints it as a warning and exits with 1 (nothing when capture is allowed). Allow it, then run `streamembed start` (or `install_service()`) again. With `--folder ~/Desktop`, this Python also needs access to the Desktop folder (Files and Folders); without it, `service.log` says so and the service captures without the folder |
|
|
153
153
|
| Linux | systemd user service `streamembed-capture.service` (`~/.config/systemd/user/`) | X11 only. Install from a terminal in your desktop session: the service keeps that session's `DISPLAY` |
|
|
154
154
|
| Windows | Task Scheduler task `StreamEmbedCapture`, at logon, run with `pythonw` (no console window) | Stopping it ends the process at once; the index drops a half-written row when it is next opened |
|
|
155
155
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "streamembed"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.4"
|
|
4
4
|
description = "Search your own screen history by describing what you saw, from screenshots, on your machine"
|
|
5
5
|
readme = "PYPI.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -15,10 +15,11 @@ classifiers = [
|
|
|
15
15
|
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
16
16
|
]
|
|
17
17
|
# The engine re-implements parts of the Qwen3-VL forward against transformers internals, so torch and transformers stay pinned
|
|
18
|
-
# to the versions its outputs were checked for equality with.
|
|
18
|
+
# to the versions its outputs were checked for equality with. torch 2.13 and later free the MPS graph cache in torch.mps.empty_cache();
|
|
19
|
+
# with 2.8 the capture process grew by about 5 MB per encoded frame on Apple silicon (issue #1).
|
|
19
20
|
dependencies = [
|
|
20
|
-
"torch==2.
|
|
21
|
-
"torchvision==0.
|
|
21
|
+
"torch==2.14.1",
|
|
22
|
+
"torchvision==0.29.2",
|
|
22
23
|
"transformers==5.17.0",
|
|
23
24
|
"qwen-vl-utils==0.0.14",
|
|
24
25
|
"huggingface-hub>=0.30",
|
|
@@ -27,8 +28,12 @@ dependencies = [
|
|
|
27
28
|
"pillow>=11",
|
|
28
29
|
"mss>=9,<11", # mss.MSS from 10.2, mss.mss before (capture._grabber)
|
|
29
30
|
"pyobjc-framework-Quartz>=10; sys_platform == 'darwin'",
|
|
31
|
+
"pyobjc-framework-ScreenCaptureKit>=10.1; sys_platform == 'darwin'", # screen grabs on macOS 14+ (sckgrab); mss elsewhere
|
|
30
32
|
]
|
|
31
33
|
|
|
34
|
+
[project.urls]
|
|
35
|
+
Repository = "https://github.com/StarTrail-org/StreamEmbed"
|
|
36
|
+
|
|
32
37
|
[project.optional-dependencies]
|
|
33
38
|
dev = ["pytest>=8"]
|
|
34
39
|
# index_type="hnsw". chroma-hnswlib is hnswlib (same module and API) with prebuilt wheels; hnswlib itself ships only a source
|
|
@@ -4,7 +4,7 @@ from .api import (Capture, Result, Results, available_index_types, available_mod
|
|
|
4
4
|
from .config import get_config, reset_config, set_config
|
|
5
5
|
from .service import install_service, service_status, uninstall_service
|
|
6
6
|
|
|
7
|
-
__version__ = "0.3.
|
|
7
|
+
__version__ = "0.3.4"
|
|
8
8
|
__all__ = ["Capture", "Result", "Results", "available_index_types", "available_models", "build_index_from_directory", "build_index_from_now", "configure", "query_index",
|
|
9
9
|
"visualize_results", "install_service", "service_status", "uninstall_service", "pause", "resume", "is_paused",
|
|
10
10
|
"get_config", "set_config", "reset_config"]
|
|
@@ -28,7 +28,8 @@ import numpy as np
|
|
|
28
28
|
from typing import Callable, Iterator
|
|
29
29
|
|
|
30
30
|
from .ann import require_hnswlib
|
|
31
|
-
from .capture import fit_width, folder_files, load_frames, screen_frames, screen_permission
|
|
31
|
+
from .capture import (fit_width, folder_files, load_frames, open_screen_settings, screen_frames, screen_permission,
|
|
32
|
+
screen_permission_help)
|
|
32
33
|
from .gate import Gate
|
|
33
34
|
from .index import INDEX_TYPES, Index
|
|
34
35
|
from . import models as _models
|
|
@@ -713,9 +714,8 @@ def build_index_from_now(interval: float | None = None, duration: float | None =
|
|
|
713
714
|
"after 30 s." if _state["capture"].stalled else ""))
|
|
714
715
|
if frames is None:
|
|
715
716
|
interval = max(interval, MIN_LIVE_INTERVAL)
|
|
716
|
-
if not screen_permission():
|
|
717
|
-
raise PermissionError(
|
|
718
|
-
"> Screen Recording, then run again.")
|
|
717
|
+
if not screen_permission(): # opens the pane too: the system prompt shows only the first time
|
|
718
|
+
raise PermissionError(screen_permission_help(opened=open_screen_settings()))
|
|
719
719
|
frames = screen_frames(_settings()["width"], monitors)
|
|
720
720
|
_index()._writable() # check the lock and load the model before the thread starts, so errors surface here
|
|
721
721
|
try:
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
5
|
import re
|
|
6
|
+
import subprocess
|
|
6
7
|
import sys
|
|
7
8
|
import time
|
|
8
9
|
from collections import deque
|
|
@@ -170,6 +171,52 @@ def screen_permission() -> bool:
|
|
|
170
171
|
return False
|
|
171
172
|
|
|
172
173
|
|
|
174
|
+
# macOS 15 renamed the pane "Screen & System Audio Recording"; only the name changed (nothing here records audio). No command can
|
|
175
|
+
# turn the permission on (it is kept in the SIP-protected TCC database), so we open the pane and say what to turn on in it.
|
|
176
|
+
SCREEN_PANE = "System Settings > Privacy & Security > Screen & System Audio Recording (Screen Recording before macOS 15)"
|
|
177
|
+
SCREEN_SETTINGS_URL = "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"
|
|
178
|
+
TERMINALS = {"Apple_Terminal": "Terminal", "iTerm.app": "iTerm", "vscode": "Visual Studio Code (or Cursor)", "WezTerm": "WezTerm",
|
|
179
|
+
"ghostty": "Ghostty", "WarpTerminal": "Warp", "tmux": "the terminal app that runs tmux"}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def python_app() -> str:
|
|
183
|
+
"""The Python macOS lists in the pane when Python itself is asked (the background service, started by launchd): Python.app for a
|
|
184
|
+
framework build (python.org, Homebrew), else the interpreter with symlinks resolved (a venv's python links to it)."""
|
|
185
|
+
app = Path(sys.base_prefix) / "Resources" / "Python.app"
|
|
186
|
+
return str(app if app.is_dir() else Path(os.path.realpath(sys.executable)))
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def permission_app() -> str:
|
|
190
|
+
"""What to turn on in the pane: macOS asks for the app that started this process, the terminal app when it runs in one."""
|
|
191
|
+
term = os.environ.get("TERM_PROGRAM")
|
|
192
|
+
return TERMINALS.get(term, term) if term else python_app()
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def turn_on(app: str) -> str:
|
|
196
|
+
"""'turn on X' for the pane; a path is added with + when it is not listed yet."""
|
|
197
|
+
if not app.startswith("/"):
|
|
198
|
+
return f"turn on {app}"
|
|
199
|
+
name = Path(app).stem if app.endswith(".app") else Path(app).name # as the pane lists it
|
|
200
|
+
return f"turn on {name}, or add it with + (press Cmd-Shift-G and paste {app})"
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def open_screen_settings() -> bool:
|
|
204
|
+
"""Open the pane in System Settings (macOS). False when it could not be opened, or elsewhere."""
|
|
205
|
+
if not MACOS:
|
|
206
|
+
return False
|
|
207
|
+
try:
|
|
208
|
+
return subprocess.run(["open", SCREEN_SETTINGS_URL], capture_output=True, timeout=10).returncode == 0
|
|
209
|
+
except (OSError, subprocess.SubprocessError):
|
|
210
|
+
return False
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def screen_permission_help(opened: bool = False) -> str:
|
|
214
|
+
"""How to allow screen capture, in one message. `opened`: the pane was opened (open_screen_settings)."""
|
|
215
|
+
return (f"Screen capture needs a permission that only you can give: in {SCREEN_PANE}, {turn_on(permission_app())}, then run "
|
|
216
|
+
"it again. Nothing records audio; only the pane's name mentions it. "
|
|
217
|
+
+ ("System Settings is open at that pane now." if opened else f"To open the pane: open '{SCREEN_SETTINGS_URL}'"))
|
|
218
|
+
|
|
219
|
+
|
|
173
220
|
def _preflight() -> bool:
|
|
174
221
|
"""Whether this process may record the screen (macOS), without asking for it."""
|
|
175
222
|
try:
|
|
@@ -224,8 +271,19 @@ def private(app: str | None, title: str | None) -> bool:
|
|
|
224
271
|
return any(x.casefold() in a for x in lists[0]) or any(x.casefold() in t for x in lists[1])
|
|
225
272
|
|
|
226
273
|
|
|
274
|
+
_SCK: list = [] # sckgrab.available(), checked once
|
|
275
|
+
|
|
276
|
+
|
|
227
277
|
def _grabber():
|
|
228
|
-
"""mss.MSS (mss 10.2 and later; mss.mss
|
|
278
|
+
"""macOS 14 and later: ScreenCaptureKit (sckgrab.Grab, mss for a grab it cannot make). Elsewhere mss.MSS (mss 10.2 and later; mss.mss
|
|
279
|
+
is deprecated there), else mss.mss."""
|
|
280
|
+
if MACOS:
|
|
281
|
+
if not _SCK:
|
|
282
|
+
from . import sckgrab
|
|
283
|
+
_SCK.append(sckgrab.available())
|
|
284
|
+
if _SCK[0]:
|
|
285
|
+
from .sckgrab import Grab
|
|
286
|
+
return Grab
|
|
229
287
|
import mss
|
|
230
288
|
return getattr(mss, "MSS", None) or mss.mss
|
|
231
289
|
|
|
@@ -387,8 +445,8 @@ def screen_frames(width: int, monitors: str | list[int] = "all",
|
|
|
387
445
|
took = time.monotonic() - t0
|
|
388
446
|
if took > SLOW_GRAB_S and not slow:
|
|
389
447
|
slow = True
|
|
390
|
-
why = (" The app that started Python has no
|
|
391
|
-
|
|
448
|
+
why = (f" The app that started Python has no permission to record the screen: {SCREEN_PANE}."
|
|
449
|
+
if MACOS and not _preflight() else
|
|
392
450
|
" Another app that records the screen at the same time can slow it down.")
|
|
393
451
|
print(f"streamembed: a screen grab took {took:.0f} s.{why}", file=sys.stderr, flush=True)
|
|
394
452
|
img = Image.frombytes("RGB", shot.size, shot.rgb) # full size: _ingest fits it to `width`
|
|
@@ -146,6 +146,40 @@ def _service_index_dir(se, given: str | None):
|
|
|
146
146
|
return None
|
|
147
147
|
|
|
148
148
|
|
|
149
|
+
def _screen_allowed(log, offset: int, timeout: float = 20.0) -> bool | None:
|
|
150
|
+
"""Whether the service just started may record the screen (macOS): its first line in `log` after `offset` says so.
|
|
151
|
+
None when its first line is something else (a bad setting stops it before the check) or it wrote nothing within `timeout` s."""
|
|
152
|
+
from .service import SCREEN_ALLOWED, SCREEN_NOT_ALLOWED
|
|
153
|
+
end = time.monotonic() + timeout
|
|
154
|
+
while time.monotonic() < end:
|
|
155
|
+
try:
|
|
156
|
+
with open(log, encoding="utf-8", errors="replace") as f:
|
|
157
|
+
f.seek(offset)
|
|
158
|
+
lines = f.read().splitlines()
|
|
159
|
+
except FileNotFoundError:
|
|
160
|
+
lines = []
|
|
161
|
+
for line in lines:
|
|
162
|
+
if line in (SCREEN_ALLOWED, SCREEN_NOT_ALLOWED):
|
|
163
|
+
return line == SCREEN_ALLOWED
|
|
164
|
+
if line.startswith("streamembed service:"):
|
|
165
|
+
return None
|
|
166
|
+
time.sleep(0.2)
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _warn_screen_permission() -> None:
|
|
171
|
+
"""The service cannot record the screen: say what to turn on, as a warning on stderr."""
|
|
172
|
+
import os
|
|
173
|
+
from .capture import SCREEN_PANE, python_app, turn_on
|
|
174
|
+
head = "Warning: the background service cannot record the screen yet, so it stopped."
|
|
175
|
+
if sys.stderr.isatty() and not os.environ.get("NO_COLOR"):
|
|
176
|
+
head = f"\033[1;33m{head}\033[0m"
|
|
177
|
+
print(f"{head}\n"
|
|
178
|
+
f" In {SCREEN_PANE},\n"
|
|
179
|
+
f" {turn_on(python_app())}.\n"
|
|
180
|
+
" Then run `streamembed start` again. Only the pane's name mentions audio: nothing records sound.", file=sys.stderr)
|
|
181
|
+
|
|
182
|
+
|
|
149
183
|
def _stamp(ts: float | None, default: str) -> str:
|
|
150
184
|
return time.strftime("%Y-%m-%d %H:%M", time.localtime(ts)) if ts is not None else default
|
|
151
185
|
|
|
@@ -178,7 +212,12 @@ def _run(a) -> int:
|
|
|
178
212
|
if settings:
|
|
179
213
|
se.configure(**settings)
|
|
180
214
|
if a.command == "start":
|
|
215
|
+
log = Path(_settings()["index_dir"]).expanduser().resolve() / "service.log" # where install_service points the service
|
|
216
|
+
offset = log.stat().st_size if log.is_file() else 0
|
|
181
217
|
path = se.install_service(interval=a.interval, monitors=a.monitors, skip_unchanged=a.skip_unchanged, directory=a.folder)
|
|
218
|
+
if sys.platform == "darwin" and _screen_allowed(log, offset) is False:
|
|
219
|
+
_warn_screen_permission()
|
|
220
|
+
return 1
|
|
182
221
|
print(f"Started. It runs from now on and after every login ({path}).\nstreamembed status | pause | resume | stop")
|
|
183
222
|
elif a.command == "stop":
|
|
184
223
|
paused = se.service_status()["paused"]
|
|
@@ -221,8 +260,9 @@ def _run(a) -> int:
|
|
|
221
260
|
cap = se.build_index_from_now(interval=a.interval, monitors=a.monitors, skip_unchanged=a.skip_unchanged, block=True)
|
|
222
261
|
if cap.stalled:
|
|
223
262
|
cap.stop(timeout=0)
|
|
263
|
+
from .capture import SCREEN_PANE
|
|
224
264
|
print(f"streamembed: error: screen capture has not returned for {se.api.STALL_S:.0f} s ({_n(cap.stats['encoded'], 'screen')} "
|
|
225
|
-
"indexed). Check
|
|
265
|
+
f"indexed). Check {SCREEN_PANE}, then run it again.", file=sys.stderr)
|
|
226
266
|
return 1
|
|
227
267
|
print(f"Stopped: {_n(cap.stats['encoded'], 'screen')} indexed.")
|
|
228
268
|
elif a.command == "search":
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""macOS 14 and later: screen grabs with ScreenCaptureKit, behind the part of the mss interface that capture.screen_frames uses.
|
|
2
|
+
|
|
3
|
+
mss grabs with CGWindowListCreateImage, which Apple deprecated in macOS 14 and obsoleted in the macOS 15 SDK; on macOS 26 a capture-only
|
|
4
|
+
process using it was seen to grow over a day (issue #1). This grabs each display with SCScreenshotManager instead:
|
|
5
|
+
with Grab() as sct:
|
|
6
|
+
sct.monitors # as mss: [all displays, display 1 (main), display 2, ...], left/top/width/height in points
|
|
7
|
+
shot = sct.grab(sct.monitors[1])
|
|
8
|
+
shot.size, shot.rgb # as mss.ScreenShot: (width, height) and packed RGB bytes, at point resolution like mss
|
|
9
|
+
Displays are listed as mss lists them (CGGetActiveDisplayList order, CGDisplayBounds), so display numbers and stream keys do not
|
|
10
|
+
change. A grab that ScreenCaptureKit cannot make is made with mss instead (reported once per process).
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
import threading
|
|
16
|
+
import time
|
|
17
|
+
from dataclasses import dataclass
|
|
18
|
+
|
|
19
|
+
TIMEOUT_S = 45.0 # below the capture's 60 s "has not returned" watchdog, so the mss fallback still has a chance
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class Shot:
|
|
24
|
+
size: tuple[int, int]
|
|
25
|
+
rgb: bytes
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def available() -> bool:
|
|
29
|
+
"""macOS 14 or later with the ScreenCaptureKit bindings (pyobjc-framework-ScreenCaptureKit) installed."""
|
|
30
|
+
if sys.platform != "darwin":
|
|
31
|
+
return False
|
|
32
|
+
import platform
|
|
33
|
+
try:
|
|
34
|
+
if int(platform.mac_ver()[0].split(".")[0]) < 14:
|
|
35
|
+
return False
|
|
36
|
+
import ScreenCaptureKit
|
|
37
|
+
return hasattr(ScreenCaptureKit, "SCScreenshotManager")
|
|
38
|
+
except (ImportError, ValueError):
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _wait(start):
|
|
43
|
+
"""start(handler), then the arguments the completion handler was called with. On the main thread the run loop turns while
|
|
44
|
+
waiting, since a handler may be delivered on the main queue."""
|
|
45
|
+
done, out = threading.Event(), []
|
|
46
|
+
|
|
47
|
+
def handler(*args):
|
|
48
|
+
out.append(args)
|
|
49
|
+
done.set()
|
|
50
|
+
|
|
51
|
+
start(handler)
|
|
52
|
+
if threading.current_thread() is threading.main_thread():
|
|
53
|
+
import CoreFoundation as CF
|
|
54
|
+
end = time.monotonic() + TIMEOUT_S
|
|
55
|
+
while not done.is_set() and time.monotonic() < end:
|
|
56
|
+
CF.CFRunLoopRunInMode(CF.kCFRunLoopDefaultMode, 0.01, False)
|
|
57
|
+
else:
|
|
58
|
+
done.wait(TIMEOUT_S)
|
|
59
|
+
if not done.is_set():
|
|
60
|
+
raise TimeoutError(f"ScreenCaptureKit did not answer in {TIMEOUT_S:.0f} s")
|
|
61
|
+
return out[0]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _active_displays() -> list[int]:
|
|
65
|
+
import Quartz
|
|
66
|
+
_, ids, n = Quartz.CGGetActiveDisplayList(32, None, None)
|
|
67
|
+
return list(ids[:n])
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class Grab:
|
|
71
|
+
_content = None # SCShareableContent, kept while the set of displays stays the same
|
|
72
|
+
_content_ids: tuple = ()
|
|
73
|
+
_fallback_said = False
|
|
74
|
+
|
|
75
|
+
def __init__(self):
|
|
76
|
+
self._monitors = None
|
|
77
|
+
self._mss = None
|
|
78
|
+
|
|
79
|
+
def __enter__(self):
|
|
80
|
+
return self
|
|
81
|
+
|
|
82
|
+
def __exit__(self, *exc):
|
|
83
|
+
self.close()
|
|
84
|
+
return False
|
|
85
|
+
|
|
86
|
+
def close(self) -> None:
|
|
87
|
+
if self._mss is not None:
|
|
88
|
+
self._mss.close()
|
|
89
|
+
self._mss = None
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def monitors(self) -> list[dict]:
|
|
93
|
+
"""Listed once per Grab (screen_frames makes a new one for every capture)."""
|
|
94
|
+
if self._monitors is None:
|
|
95
|
+
import Quartz
|
|
96
|
+
out = []
|
|
97
|
+
for did in _active_displays():
|
|
98
|
+
r = Quartz.CGRectStandardize(Quartz.CGDisplayBounds(did))
|
|
99
|
+
w, h = r.size.width, r.size.height
|
|
100
|
+
if Quartz.CGDisplayRotation(did) in (90.0, -90.0):
|
|
101
|
+
w, h = h, w
|
|
102
|
+
out.append({"left": int(r.origin.x), "top": int(r.origin.y), "width": int(w), "height": int(h), "id": int(did)})
|
|
103
|
+
if out:
|
|
104
|
+
left, top = min(m["left"] for m in out), min(m["top"] for m in out)
|
|
105
|
+
right, bottom = max(m["left"] + m["width"] for m in out), max(m["top"] + m["height"] for m in out)
|
|
106
|
+
whole = {"left": left, "top": top, "width": right - left, "height": bottom - top}
|
|
107
|
+
else:
|
|
108
|
+
whole = {"left": 0, "top": 0, "width": 0, "height": 0}
|
|
109
|
+
self._monitors = [whole] + out
|
|
110
|
+
return self._monitors
|
|
111
|
+
|
|
112
|
+
def grab(self, monitor: dict):
|
|
113
|
+
try:
|
|
114
|
+
return self._grab(monitor)
|
|
115
|
+
except Exception as e:
|
|
116
|
+
if not Grab._fallback_said:
|
|
117
|
+
Grab._fallback_said = True
|
|
118
|
+
print(f"streamembed: ScreenCaptureKit could not grab the screen ({type(e).__name__}: {e}); using mss when it fails",
|
|
119
|
+
file=sys.stderr, flush=True)
|
|
120
|
+
if self._mss is None:
|
|
121
|
+
import mss
|
|
122
|
+
self._mss = (getattr(mss, "MSS", None) or mss.mss)()
|
|
123
|
+
return self._mss.grab({k: monitor[k] for k in ("left", "top", "width", "height")})
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def _display(cls, did: int):
|
|
127
|
+
import ScreenCaptureKit as SCK
|
|
128
|
+
ids = tuple(_active_displays())
|
|
129
|
+
if cls._content is None or ids != cls._content_ids:
|
|
130
|
+
content, err = _wait(SCK.SCShareableContent.getShareableContentWithCompletionHandler_)
|
|
131
|
+
if content is None:
|
|
132
|
+
raise PermissionError(f"ScreenCaptureKit cannot list the displays: {err}")
|
|
133
|
+
cls._content, cls._content_ids = content, ids
|
|
134
|
+
for d in cls._content.displays():
|
|
135
|
+
if d.displayID() == did:
|
|
136
|
+
return d
|
|
137
|
+
cls._content = None
|
|
138
|
+
raise LookupError(f"display {did} is not available to ScreenCaptureKit")
|
|
139
|
+
|
|
140
|
+
def _grab(self, monitor: dict) -> Shot:
|
|
141
|
+
import objc
|
|
142
|
+
import Quartz
|
|
143
|
+
import ScreenCaptureKit as SCK
|
|
144
|
+
from PIL import Image
|
|
145
|
+
did = monitor.get("id") or next(m["id"] for m in self.monitors[1:]
|
|
146
|
+
if all(m[k] == monitor[k] for k in ("left", "top", "width", "height")))
|
|
147
|
+
with objc.autorelease_pool():
|
|
148
|
+
display = self._display(did)
|
|
149
|
+
filt = SCK.SCContentFilter.alloc().initWithDisplay_excludingWindows_(display, [])
|
|
150
|
+
cfg = SCK.SCStreamConfiguration.alloc().init()
|
|
151
|
+
cfg.setWidth_(monitor["width"]) # points, as mss (kCGWindowImageNominalResolution)
|
|
152
|
+
cfg.setHeight_(monitor["height"])
|
|
153
|
+
cfg.setShowsCursor_(False) # mss has no cursor either
|
|
154
|
+
image, err = _wait(lambda h: SCK.SCScreenshotManager.captureImageWithFilter_configuration_completionHandler_(filt, cfg, h))
|
|
155
|
+
if image is None:
|
|
156
|
+
raise RuntimeError(f"ScreenCaptureKit capture failed: {err}")
|
|
157
|
+
w, h = Quartz.CGImageGetWidth(image), Quartz.CGImageGetHeight(image)
|
|
158
|
+
data = Quartz.CGDataProviderCopyData(Quartz.CGImageGetDataProvider(image))
|
|
159
|
+
img = Image.frombuffer("RGB", (w, h), bytes(data), "raw", "BGRX", Quartz.CGImageGetBytesPerRow(image), 1)
|
|
160
|
+
return Shot((w, h), img.tobytes())
|
|
@@ -33,6 +33,8 @@ LABEL = "org.streamembed.capture" # launchd
|
|
|
33
33
|
UNIT = "streamembed-capture.service" # systemd
|
|
34
34
|
TASK = "StreamEmbedCapture" # Task Scheduler
|
|
35
35
|
ENV_KEYS = ("HF_HOME", "HF_HUB_CACHE", "STREAMEMBED_MODELS") # passed on to the service, which starts with no shell environment
|
|
36
|
+
# the service's first line on macOS; `streamembed start` waits for it to warn only when capture cannot work
|
|
37
|
+
SCREEN_ALLOWED, SCREEN_NOT_ALLOWED = "streamembed service: screen capture allowed", "streamembed service: screen capture not allowed"
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
def _run(*args: str) -> subprocess.CompletedProcess:
|
|
@@ -293,6 +295,9 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
293
295
|
interval = max(_coerce("interval", get_config("interval") if a.interval is None else a.interval), se.api.MIN_LIVE_INTERVAL)
|
|
294
296
|
except (KeyError, ValueError, ImportError) as e: # a bad setting: restarting would not help
|
|
295
297
|
return _bad_setting(e)
|
|
298
|
+
if sys.platform == "darwin": # first thing, so that `streamembed start` can say at once whether capture will work
|
|
299
|
+
from .capture import _preflight
|
|
300
|
+
print(SCREEN_ALLOWED if _preflight() else SCREEN_NOT_ALLOWED, flush=True)
|
|
296
301
|
if a.folder:
|
|
297
302
|
def interrupt(*_):
|
|
298
303
|
raise KeyboardInterrupt # build_index_from_directory stops after the screenshot in progress
|
|
@@ -312,7 +317,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
312
317
|
try:
|
|
313
318
|
cap = se.build_index_from_now(interval=interval, monitors=monitors, skip_unchanged=a.skip_unchanged)
|
|
314
319
|
except PermissionError as e:
|
|
315
|
-
print(f"streamembed service: {e}
|
|
320
|
+
print(f"streamembed service: {e} To run it again: `streamembed start` (or se.install_service()).", flush=True)
|
|
316
321
|
return 0 # a clean exit: not restarted until it is installed again
|
|
317
322
|
except (ValueError, NotImplementedError) as e:
|
|
318
323
|
return _bad_setting(e)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Screen grabs on macOS 14+ go through ScreenCaptureKit (sckgrab.Grab); mss elsewhere, and for a grab ScreenCaptureKit cannot make."""
|
|
2
|
+
import sys
|
|
3
|
+
import types
|
|
4
|
+
|
|
5
|
+
from streamembed import capture, sckgrab
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_grabber_choice(monkeypatch):
|
|
9
|
+
import mss
|
|
10
|
+
stock = getattr(mss, "MSS", None) or mss.mss
|
|
11
|
+
monkeypatch.setattr(capture, "MACOS", True)
|
|
12
|
+
monkeypatch.setattr(capture, "_SCK", [True])
|
|
13
|
+
assert capture._grabber() is sckgrab.Grab
|
|
14
|
+
monkeypatch.setattr(capture, "_SCK", [False]) # macOS 13 or no bindings
|
|
15
|
+
assert capture._grabber() is stock
|
|
16
|
+
monkeypatch.setattr(capture, "MACOS", False)
|
|
17
|
+
monkeypatch.setattr(capture, "_SCK", [True])
|
|
18
|
+
assert capture._grabber() is stock
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_available_needs_macos_14_and_the_bindings(monkeypatch):
|
|
22
|
+
import platform
|
|
23
|
+
monkeypatch.setattr(sys, "platform", "darwin")
|
|
24
|
+
monkeypatch.setitem(sys.modules, "ScreenCaptureKit", types.SimpleNamespace(SCScreenshotManager=object))
|
|
25
|
+
monkeypatch.setattr(platform, "mac_ver", lambda: ("13.6.1", ("", "", ""), ""))
|
|
26
|
+
assert not sckgrab.available()
|
|
27
|
+
monkeypatch.setattr(platform, "mac_ver", lambda: ("26.6", ("", "", ""), ""))
|
|
28
|
+
assert sckgrab.available()
|
|
29
|
+
monkeypatch.setitem(sys.modules, "ScreenCaptureKit", None) # not installed: import fails
|
|
30
|
+
assert not sckgrab.available()
|
|
31
|
+
monkeypatch.setattr(sys, "platform", "linux")
|
|
32
|
+
assert not sckgrab.available()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_a_failed_grab_uses_mss_and_is_reported_once(monkeypatch, capsys):
|
|
36
|
+
import mss
|
|
37
|
+
grabbed = []
|
|
38
|
+
|
|
39
|
+
class FakeMSS:
|
|
40
|
+
def grab(self, m):
|
|
41
|
+
grabbed.append(m)
|
|
42
|
+
return types.SimpleNamespace(size=(m["width"], m["height"]), rgb=b"\0" * 3 * m["width"] * m["height"])
|
|
43
|
+
|
|
44
|
+
def close(self):
|
|
45
|
+
grabbed.append("closed")
|
|
46
|
+
|
|
47
|
+
def fail(self, monitor):
|
|
48
|
+
raise TimeoutError("ScreenCaptureKit did not answer in 45 s")
|
|
49
|
+
|
|
50
|
+
monkeypatch.setattr(mss, "MSS", FakeMSS, raising=False)
|
|
51
|
+
monkeypatch.setattr(sckgrab.Grab, "_grab", fail)
|
|
52
|
+
monkeypatch.setattr(sckgrab.Grab, "_fallback_said", False)
|
|
53
|
+
m = {"left": 0, "top": 0, "width": 4, "height": 2, "id": 1}
|
|
54
|
+
with sckgrab.Grab() as g:
|
|
55
|
+
assert g.grab(m).size == (4, 2)
|
|
56
|
+
assert g.grab(m).size == (4, 2)
|
|
57
|
+
assert grabbed == [{"left": 0, "top": 0, "width": 4, "height": 2}] * 2 + ["closed"]
|
|
58
|
+
assert capsys.readouterr().err.count("ScreenCaptureKit could not grab the screen") == 1
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""`streamembed start` on macOS reads the service's first log line to warn only when screen capture is not allowed."""
|
|
2
|
+
from streamembed.cli import _screen_allowed, _warn_screen_permission
|
|
3
|
+
from streamembed.service import SCREEN_ALLOWED, SCREEN_NOT_ALLOWED
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _log(tmp_path, *lines):
|
|
7
|
+
p = tmp_path / "service.log"
|
|
8
|
+
p.write_text("".join(l + "\n" for l in lines), encoding="utf-8")
|
|
9
|
+
return p
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_allowed_and_not_allowed(tmp_path):
|
|
13
|
+
assert _screen_allowed(_log(tmp_path, SCREEN_ALLOWED), 0, timeout=1) is True
|
|
14
|
+
assert _screen_allowed(_log(tmp_path, SCREEN_NOT_ALLOWED, "streamembed service: Screen capture needs ..."), 0, timeout=1) is False
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_reads_only_after_offset(tmp_path):
|
|
18
|
+
old = SCREEN_NOT_ALLOWED + "\n" # an earlier run's line stays in the log
|
|
19
|
+
p = _log(tmp_path, SCREEN_NOT_ALLOWED, SCREEN_ALLOWED)
|
|
20
|
+
assert _screen_allowed(p, len(old.encode()), timeout=1) is True
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_other_first_line_or_nothing(tmp_path):
|
|
24
|
+
assert _screen_allowed(_log(tmp_path, "streamembed service: unknown model x. Fix the setting"), 0, timeout=5) is None
|
|
25
|
+
assert _screen_allowed(tmp_path / "missing.log", 0, timeout=0.3) is None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_warning_text(capsys):
|
|
29
|
+
_warn_screen_permission()
|
|
30
|
+
err = capsys.readouterr().err
|
|
31
|
+
assert err.startswith("Warning: ") and "Screen & System Audio Recording" in err and "streamembed start" in err
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|