python-aidot-cameras 1.3.2__py3-none-any.whl → 1.3.3__py3-none-any.whl
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.
- aidot_cameras/camera/constants.py +5 -4
- aidot_cameras/camera/sd_listing.py +99 -7
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/METADATA +1 -1
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/RECORD +9 -9
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/WHEEL +0 -0
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/entry_points.txt +0 -0
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/licenses/LICENSE +0 -0
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/licenses/aidot_cameras/_vendor/aiortc/LICENSE +0 -0
- {python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/top_level.txt +0 -0
|
@@ -170,10 +170,11 @@ IOTYPE_USER_IPCAM_SPEAKERSTART_WEB_RTC_RESP = 0x353 # 851
|
|
|
170
170
|
#: with one byte, 0 for done.
|
|
171
171
|
IOTYPE_USER_IPCAM_DELLISTEVENT_REQ = 0x4B7
|
|
172
172
|
IOTYPE_USER_IPCAM_DELLISTEVENT_RESP = 0x4B8
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
#: Thumbnails of card recordings (the app's getThumbnais, sent as its
|
|
174
|
+
#: "custom command"): 0x4b9 asks for a list of recordings, 0x4ba brings one
|
|
175
|
+
#: picture per reply.
|
|
176
|
+
IOTYPE_USER_IPCAM_SD_THUMBNAIL_REQ = 0x4B9
|
|
177
|
+
IOTYPE_USER_IPCAM_SD_THUMBNAIL_RESP = 0x4BA
|
|
177
178
|
IOTYPE_USER_IPCAM_HASLISTEVENT_REQ = 0x4B5
|
|
178
179
|
IOTYPE_USER_IPCAM_HASLISTEVENT_RESP = 0x4B6
|
|
179
180
|
IOTYPE_USER_IPCAM_PTZ_COMMAND = 0x1001 # 4097
|
|
@@ -12,6 +12,7 @@ are all ordinary, and each of them has to arrive in a media browser as an empty
|
|
|
12
12
|
list rather than as a traceback.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
+
import calendar
|
|
15
16
|
import logging
|
|
16
17
|
import struct
|
|
17
18
|
import time
|
|
@@ -21,6 +22,8 @@ from typing import Any, List, Optional
|
|
|
21
22
|
from .constants import (
|
|
22
23
|
IOTYPE_USER_IPCAM_DELLISTEVENT_REQ,
|
|
23
24
|
IOTYPE_USER_IPCAM_DELLISTEVENT_RESP,
|
|
25
|
+
IOTYPE_USER_IPCAM_SD_THUMBNAIL_REQ,
|
|
26
|
+
IOTYPE_USER_IPCAM_SD_THUMBNAIL_RESP,
|
|
24
27
|
)
|
|
25
28
|
from .controls import _session_is_live as _control_session_is_live
|
|
26
29
|
from .sd_events import (
|
|
@@ -427,9 +430,35 @@ class _CameraSdMixin:
|
|
|
427
430
|
|
|
428
431
|
|
|
429
432
|
# --------------------------------------------------------------------------- #
|
|
430
|
-
#
|
|
433
|
+
# Thumbnails and deletion of card recordings
|
|
431
434
|
# --------------------------------------------------------------------------- #
|
|
432
435
|
|
|
436
|
+
#: The thumbnail request names recordings by their start as epoch
|
|
437
|
+
#: milliseconds (the app's Long per recording); the reply carries the request
|
|
438
|
+
#: channel, the time back, and the picture.
|
|
439
|
+
_THUMB_HEADER = struct.Struct("<Iq")
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
def _record_epoch_s(record: Any) -> int:
|
|
443
|
+
"""A record's UTC start as epoch SECONDS.
|
|
444
|
+
|
|
445
|
+
The camera matches a thumbnail request against a recording by this value,
|
|
446
|
+
and the app sends epoch seconds (it divides the record's millisecond time
|
|
447
|
+
by 1000 - KVSWebRTCChannel.getThumbnais / SDEventsPresenter). Sending
|
|
448
|
+
milliseconds matches nothing and the camera returns no picture; this cost
|
|
449
|
+
the feature its first ship (2.41.0). Measured live 2026-11-13: seconds
|
|
450
|
+
returns the JPEGs, milliseconds returns empty replies.
|
|
451
|
+
"""
|
|
452
|
+
fields = (
|
|
453
|
+
record.year,
|
|
454
|
+
record.month,
|
|
455
|
+
record.day,
|
|
456
|
+
record.hour,
|
|
457
|
+
record.minute,
|
|
458
|
+
record.second,
|
|
459
|
+
)
|
|
460
|
+
return calendar.timegm((*fields, 0, 0, 0))
|
|
461
|
+
|
|
433
462
|
|
|
434
463
|
def _record_stime(record: Any) -> bytes:
|
|
435
464
|
"""A record's start as the TUTK STimeDay the delete request carries."""
|
|
@@ -447,6 +476,25 @@ def _record_stime(record: Any) -> bytes:
|
|
|
447
476
|
)
|
|
448
477
|
|
|
449
478
|
|
|
479
|
+
def sd_thumbnail_request(records: "list", channel: int) -> bytes:
|
|
480
|
+
"""The 0x4b9 payload: request channel (u32 LE) then each recording's start
|
|
481
|
+
as epoch SECONDS (i64 LE), as the app's getThumbnais builds it."""
|
|
482
|
+
out = struct.pack("<I", channel)
|
|
483
|
+
for r in records:
|
|
484
|
+
out += struct.pack("<q", _record_epoch_s(r))
|
|
485
|
+
return out
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
def parse_sd_thumbnail(payload: bytes) -> "Optional[tuple[int, int, bytes]]":
|
|
489
|
+
"""A 0x4ba reply as (request channel, start epoch seconds, picture bytes), or
|
|
490
|
+
None when it is too short to be one. Read as the app reads it: 4 bytes,
|
|
491
|
+
8 bytes, then everything else is the picture."""
|
|
492
|
+
if len(payload) < _THUMB_HEADER.size:
|
|
493
|
+
return None
|
|
494
|
+
channel, when = _THUMB_HEADER.unpack_from(payload, 0)
|
|
495
|
+
return channel, when, bytes(payload[_THUMB_HEADER.size :])
|
|
496
|
+
|
|
497
|
+
|
|
450
498
|
def sd_delete_request(
|
|
451
499
|
records: "list", *, delete_type: int = 0, event_type: int = 0
|
|
452
500
|
) -> bytes:
|
|
@@ -462,13 +510,57 @@ def sd_delete_request(
|
|
|
462
510
|
|
|
463
511
|
|
|
464
512
|
class _CameraSdExtrasMixin:
|
|
465
|
-
"""
|
|
513
|
+
"""Thumbnails and deletion for card recordings; mixed into CameraMixin."""
|
|
466
514
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
515
|
+
async def async_get_sd_thumbnails(
|
|
516
|
+
self,
|
|
517
|
+
records: "list",
|
|
518
|
+
*,
|
|
519
|
+
session: Any = None,
|
|
520
|
+
timeout: float = 8.0,
|
|
521
|
+
more_timeout: float = 3.0,
|
|
522
|
+
) -> "dict[Any, bytes]":
|
|
523
|
+
"""Pictures for ``records`` (SdEvent), keyed by record, from the camera
|
|
524
|
+
over a live session.
|
|
525
|
+
|
|
526
|
+
The app asks for these from its live screen, which already holds the
|
|
527
|
+
session; a caller here does the same, passing the session or relying
|
|
528
|
+
on the one the serve loop holds. Each reply carries one picture and
|
|
529
|
+
the recording's start it belongs to; a recording the camera has no
|
|
530
|
+
picture for simply gets no reply. Returns what came back, possibly
|
|
531
|
+
nothing: an empty dict means no pictures, not a failure.
|
|
532
|
+
"""
|
|
533
|
+
if session is None:
|
|
534
|
+
session = getattr(self, "_stream_session", None)
|
|
535
|
+
if not records or not _session_is_live(session):
|
|
536
|
+
return {}
|
|
537
|
+
by_s = {_record_epoch_s(r): r for r in records}
|
|
538
|
+
channel = (getattr(self, "_sd_thumb_channel", 0) % 1000) + 1
|
|
539
|
+
self._sd_thumb_channel = channel
|
|
540
|
+
try:
|
|
541
|
+
replies = await session.async_avio_request_all(
|
|
542
|
+
IOTYPE_USER_IPCAM_SD_THUMBNAIL_REQ,
|
|
543
|
+
sd_thumbnail_request(records, channel),
|
|
544
|
+
response_cmd=IOTYPE_USER_IPCAM_SD_THUMBNAIL_RESP,
|
|
545
|
+
timeout=timeout,
|
|
546
|
+
more_timeout=more_timeout,
|
|
547
|
+
max_replies=len(records),
|
|
548
|
+
)
|
|
549
|
+
except Exception as exc:
|
|
550
|
+
_LOGGER.debug(
|
|
551
|
+
"SD thumbnails failed for %s: %s", getattr(self, "device_id", "?"), exc
|
|
552
|
+
)
|
|
553
|
+
return {}
|
|
554
|
+
out: "dict[Any, bytes]" = {}
|
|
555
|
+
for reply in replies:
|
|
556
|
+
parsed = parse_sd_thumbnail(reply.payload)
|
|
557
|
+
if parsed is None:
|
|
558
|
+
continue
|
|
559
|
+
_ch, when, picture = parsed
|
|
560
|
+
record = by_s.get(when)
|
|
561
|
+
if record is not None and picture:
|
|
562
|
+
out[record] = picture
|
|
563
|
+
return out
|
|
472
564
|
|
|
473
565
|
async def async_delete_sd_recordings(
|
|
474
566
|
self,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-aidot-cameras
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Control AiDot/Leedarson WiFi lights and cameras (WebRTC streaming, two-way audio, PTZ, controls)
|
|
5
5
|
Author-email: cbrightly <chris.brightly@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -54,7 +54,7 @@ aidot_cameras/camera/__init__.py,sha256=Z-yw5TVoANQUhEfyB-TMObmjkfGS1kOc3PddEjjW
|
|
|
54
54
|
aidot_cameras/camera/aac_track.py,sha256=fn038WSG9XLo3Tm0Y0KRyOVQ0rG0IQblrnhAwRqYUUc,18917
|
|
55
55
|
aidot_cameras/camera/agc.py,sha256=IkLu3skeJkNTxi8Ib3oMH2PYlbxjNpB1UTqpleb7lVg,6752
|
|
56
56
|
aidot_cameras/camera/client.py,sha256=pzraz3MKHYMNJBnv7sAOcEoVGUEAMG9M1lNpjmsCKF0,363438
|
|
57
|
-
aidot_cameras/camera/constants.py,sha256=
|
|
57
|
+
aidot_cameras/camera/constants.py,sha256=ef2RI380ysGbunF86r5AXFHsTXRwrwWEFGUvgX6Xlig,10007
|
|
58
58
|
aidot_cameras/camera/controls.py,sha256=3_5vQQXNX4fi-qP91dHM_pAm0JsDOZeHZbeYLEcFIoo,33881
|
|
59
59
|
aidot_cameras/camera/go2rtc.py,sha256=xGUbmfUouKVpUjkOUprCpcNT1UJcdqnnn_I_yk8yAPs,14104
|
|
60
60
|
aidot_cameras/camera/h264_sps.py,sha256=MTzsNlV-OufklTdXJC-k9e9BLw0mVTC_mI6o8K932Jc,10197
|
|
@@ -68,7 +68,7 @@ aidot_cameras/camera/recording.py,sha256=fDhCRbhwNOcdbZ-F5WT-2jIWZcobPFmUza9Cy3L
|
|
|
68
68
|
aidot_cameras/camera/rtp_h264.py,sha256=74Ibw1x0gzTD8JoIvzhAB4IODZ3PSJPTWpKCjKTo838,4593
|
|
69
69
|
aidot_cameras/camera/rtsp_publish.py,sha256=1tD_GMRJuHmuh9rKGEu_VlhAwW31Ba1IQQY6VthCx2g,83699
|
|
70
70
|
aidot_cameras/camera/sd_events.py,sha256=q6PorBjD8F5vA1585wv3DGlJ-hl90Wh6PesBijDpN6k,13936
|
|
71
|
-
aidot_cameras/camera/sd_listing.py,sha256=
|
|
71
|
+
aidot_cameras/camera/sd_listing.py,sha256=XqQ9jHHL1nnjLgotsh48JINj9XtIqxW7ZdlUlTrkJlM,24213
|
|
72
72
|
aidot_cameras/camera/sd_playback.py,sha256=ptQxho2wY2pTli2jjd4n02J0sFm9Jjre-Wv-jxPZnjI,34233
|
|
73
73
|
aidot_cameras/camera/sdes.py,sha256=JqEowyAesSrSYYFer_3KzurGTMYw-Sxqj4CXQlN0ZeA,30754
|
|
74
74
|
aidot_cameras/camera/sdes_open.py,sha256=JIIzzDqYQB5OndIDXJ_lOPSrx87mOsfHT-lMNUUK9c8,445114
|
|
@@ -76,10 +76,10 @@ aidot_cameras/camera/ts_fanout.py,sha256=T5qA8aTOWFQJzvE7gE8vfZQjRgg5if5b0V5j2sC
|
|
|
76
76
|
aidot_cameras/camera/ts_tee.py,sha256=4MFDdj4xxFpggj6LLKygsisFgS5aDohcZZWaFLBdhXU,13899
|
|
77
77
|
aidot_cameras/camera/webrtc.py,sha256=2CLrdcCo1pN93rwODLUnDaSUrNA1kzLdgr7pCUD712Q,12362
|
|
78
78
|
aidot_cameras/camera/webrtc_open.py,sha256=FuWR_wiMcouWR98HWFYKdsrBHy08LS5QVFKMXWUMwik,229283
|
|
79
|
-
python_aidot_cameras-1.3.
|
|
80
|
-
python_aidot_cameras-1.3.
|
|
81
|
-
python_aidot_cameras-1.3.
|
|
82
|
-
python_aidot_cameras-1.3.
|
|
83
|
-
python_aidot_cameras-1.3.
|
|
84
|
-
python_aidot_cameras-1.3.
|
|
85
|
-
python_aidot_cameras-1.3.
|
|
79
|
+
python_aidot_cameras-1.3.3.dist-info/licenses/LICENSE,sha256=fh4OpwR6o6ISEqsDcCCaJokiqZw_cjnNrYwXHjmK2OM,1118
|
|
80
|
+
python_aidot_cameras-1.3.3.dist-info/licenses/aidot_cameras/_vendor/aiortc/LICENSE,sha256=vsdbWlm7-J6Xnky3ZHdet7XQFnxekHE55vmVNpjIEbY,1502
|
|
81
|
+
python_aidot_cameras-1.3.3.dist-info/METADATA,sha256=WNZ7oLuIxVP1PDftt71LT91jSLFgM2yEwOFpRNGrIoY,28787
|
|
82
|
+
python_aidot_cameras-1.3.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
83
|
+
python_aidot_cameras-1.3.3.dist-info/entry_points.txt,sha256=3dckqtvsQdFBvgl3i9KoNh5z8THCXDZ3tHxzorTtIZg,61
|
|
84
|
+
python_aidot_cameras-1.3.3.dist-info/top_level.txt,sha256=UYMBE_4_Qd_yERQyNLu2ZamsMYRIU4fN_vpHvM0JeCY,14
|
|
85
|
+
python_aidot_cameras-1.3.3.dist-info/RECORD,,
|
|
File without changes
|
{python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_aidot_cameras-1.3.2.dist-info → python_aidot_cameras-1.3.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|