Skip to content

Commit 46f6dfb

Browse files
committed
Update to v0.17
1 parent f73e42e commit 46f6dfb

25 files changed

+681
-293
lines changed

src/dsf/CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
## v0.17.0 (2025-05-04)
2+
3+
### Feat
4+
5+
- add software encoding for mjpg and jpeg (#105)
6+
7+
## v0.16.3 (2025-03-09)
8+
9+
### Fix
10+
11+
- fix --disable_webrtc to update the module variable correctly (#102)
12+
13+
## v0.16.2 (2025-02-26)
14+
15+
### Fix
16+
17+
- fix crash for picamera2 v0.3.23+ (#100)
18+
19+
## v0.16.1 (2025-02-24)
20+
21+
### Fix
22+
23+
- fix controls_style.css path to relative path in camera_options.py (#98)
24+
25+
## v0.16.0 (2025-02-24)
26+
27+
### Feat
28+
29+
- add WebRTC stream (#84)
30+
131
## v0.15.0 (2024-08-14)
232

333
### Feat

src/dsf/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ all:
1818
$(MAKE) help
1919

2020
install: ## Install Spyglass as service
21+
@if [ "$$(id -u)" -eq 0 ]; then \
22+
echo "Please run without sudo/not as root"; \
23+
exit 1; \
24+
fi
2125
@mkdir -p $(CONF_PATH)
26+
@printf "\nInstall virtual environment ...\n"
27+
@python -m venv --system-site-packages .venv
28+
@. .venv/bin/activate && pip install -r requirements.txt
2229
@printf "\nCopying systemd service file ...\n"
2330
@sudo cp -f "${PWD}/resources/spyglass.service" $(SYSTEMD)
2431
@sudo sed -i "s/%USER%/$(USER)/g" $(SYSTEMD)/spyglass.service

src/dsf/README.md

Lines changed: 167 additions & 125 deletions
Large diffs are not rendered by default.

src/dsf/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mock_use_standalone_module = true
1313

1414
[tool.commitizen]
1515
name = "cz_conventional_commits"
16-
version = "0.15.0"
16+
version = "0.17.0"
1717
tag_format = "v$version"
1818
version_files = [
1919
"spyglass/__version__.py",

src/dsf/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
setuptools~=72.1.0
1+
aiortc~=1.9.0
2+
setuptools~=75.1.0

src/dsf/resources/spyglass.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ SNAPSHOT_URL="/snapshot"
3535
#### NOTE: use format as shown below to stay MJPG-Streamer URL compatible
3636
## SNAPSHOT_URL="/?action=snapshot"
3737

38+
#### Use Software JPG Encoding (BOOL)[default: false]
39+
#USE_SW_JPG_ENCODING="true"
40+
41+
#### WebRTC URL (STRING)[default: /webrtc]
42+
WEBRTC_URL="/webrtc"
43+
44+
#### Disable WebRTC (BOOL)[default: false]
45+
#DISABLE_WEBRTC="true"
46+
3847
#### Autofocus behavior (STRING:manual,continuous)[default: continuous]
3948
AUTO_FOCUS="continuous"
4049

src/dsf/scripts/spyglass

100755100644
Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,36 @@ run_spyglass() {
9393
bind_adress="0.0.0.0"
9494
fi
9595

96+
if [[ "${USE_SW_JPG_ENCODING:-false}" == "true" ]]; then
97+
use_sw_jpg_encoding="--use_sw_jpg_encoding"
98+
else
99+
use_sw_jpg_encoding=""
100+
fi
101+
102+
if [[ "${DISABLE_WEBRTC:-false}" == "true" ]]; then
103+
disable_webrtc="--disable_webrtc"
104+
else
105+
disable_webrtc=""
106+
fi
107+
96108
"${PY_BIN}" "$(dirname "${BASE_SPY_PATH}")/run.py" \
97109
--camera_num "${CAMERA_NUM:-0}" \
98110
--bindaddress "${bind_adress}" \
99111
--port "${HTTP_PORT:-8080}" \
100112
--resolution "${RESOLUTION:-640x480}" \
101113
--fps "${FPS:-15}" \
102-
--stream_url "${STREAM_URL:-\/stream}" \
103-
--snapshot_url "${SNAPSHOT_URL:-\/snapshot}" \
114+
--stream_url "${STREAM_URL:-/stream}" \
115+
--snapshot_url "${SNAPSHOT_URL:-/snapshot}" \
116+
${use_sw_jpg_encoding} \
117+
--webrtc_url "${WEBRTC_URL:-/webrtc}" \
118+
${disable_webrtc} \
104119
--autofocus "${AUTO_FOCUS:-continuous}" \
105120
--lensposition "${FOCAL_DIST:-0.0}" \
106121
--autofocusspeed "${AF_SPEED:-normal}" \
107122
--orientation_exif "${ORIENTATION_EXIF:-h}" \
108123
--tuning_filter "${TUNING_FILTER:-}"\
109124
--tuning_filter_dir "${TUNING_FILTER_DIR:-}" \
110-
--controls-string "${CONTROLS:-0=0}" & # 0=0 to prevent error on empty string
125+
--controls-string "${CONTROLS:-0=0}" # 0=0 to prevent error on empty string
111126
}
112127

113128
#### MAIN
@@ -140,13 +155,7 @@ check_py_version
140155
get_config
141156
run_spyglass
142157

143-
### Wait for termination request
144-
pid=$!
145-
146-
onSigTerm() {
147-
kill -TERM "$pid" 2>/dev/null
148-
}
149-
trap onSigTerm SIGTERM
150-
151-
wait "$pid"
152-
158+
### Loop to keep running
159+
while true; do
160+
sleep 1
161+
done

src/dsf/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = spyglass
3-
version = 0.15.0
3+
version = 0.17.0
44
description = A simple mjpeg server for Picamera2
55
url = https://github.com/roamingthings/spyglass
66
license = GPL-3.0-only

src/dsf/spyglass/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
"""init py module."""
22
import logging
3+
import importlib.util
34

45
logging.basicConfig(level=logging.INFO)
56
logger = logging.getLogger(__name__)
7+
8+
if importlib.util.find_spec("aiortc"):
9+
WEBRTC_ENABLED=True
10+
else:
11+
WEBRTC_ENABLED=False
12+
13+
def set_webrtc_enabled(enabled):
14+
global WEBRTC_ENABLED
15+
WEBRTC_ENABLED = enabled

src/dsf/spyglass/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.15.0"
1+
__version__ = "0.17.0"

0 commit comments

Comments
 (0)