Commit Graph

100 Commits

Author SHA1 Message Date
Fabio Manganiello 59c693d6a0
[#394] All `manifest.yaml` converted to `manifest.json`.
YAML isn't part of the Python standard library, while JSON is.

If we want `setup.py` to dynamically parse the available integration
manifest files in order to populate the extra dependencies, then it's
better to rely on a JSON format for manifest files - the parser is part
of the standard library and it doesn't require the user to install
`pyyaml` before `platypush`.
2024-05-17 02:21:57 +02:00
Fabio Manganiello 13bde4adba
[#398] Replaced `camera` response objects with schemas.
continuous-integration/drone/push Build is passing Details
2024-05-09 01:41:15 +02:00
Fabio Manganiello e58f5d2fa1
[Camera] The `wait_for_either` barrier should be enabled on streaming by default.
continuous-integration/drone/push Build is passing Details
`camera.pi*` plugins are an exception, as they handle the lifecycle of
the camera streaming process through the `picamera*` libraries.

Otherwise, the streaming thread should explicitly wait on either the
plugin stop or streaming stop events and exit accordingly, or the camera
thread may be streaming indefinitely.
2024-02-26 01:28:25 +01:00
Fabio Manganiello 1c14450781 FIX: Remove `wait_for_either` barrier from the streaming thread.
continuous-integration/drone/push Build is passing Details
The `_accept_client` logic will be executed anyway at the next
iteration, unless the server socket is closed - in that case, the thread
will fail and exit anyway.

The `wait_for_either` barrier in the streaming thread may instead
prevent other connections from being established after the first one is
closed.
2024-02-25 16:02:52 +01:00
Fabio Manganiello 4c92bdd11c
FIX: Handle `stop_streaming` exceptions in the main loop of the camera plugin.
continuous-integration/drone/push Build is passing Details
Otherwise camera process teardown errors may bubble up and prevent the
plugin from restarting the streaming.
2024-02-24 21:36:08 +01:00
Fabio Manganiello 8999a226b1
[WIP] Updated documentation for `camera.pi`.
continuous-integration/drone/push Build is passing Details
2024-02-24 21:16:43 +01:00
Fabio Manganiello e46704010b
[WIP] Rewritten `camera.pi.legacy` plugin.
continuous-integration/drone/push Build is passing Details
2024-02-24 14:07:07 +01:00
Fabio Manganiello 9ad9bd20e4
Added `stream_on_start` argument to `camera` plugins.
continuous-integration/drone/push Build is passing Details
It replaces the functionalities of the deprecated `camera` backends.
2024-02-24 01:31:05 +01:00
Fabio Manganiello 9cf95125a6 [WIP] Added streaming support to camera.pi using new picamera2 API
continuous-integration/drone/push Build is passing Details
2024-02-22 22:52:52 +01:00
Fabio Manganiello 659c33837e [WIP] Using new picamera2 module for camera.pi, and moved old picamera integration to camera.pi.legacy
continuous-integration/drone/push Build is passing Details
2024-02-19 00:07:29 +00:00
Fabio Manganiello c59446fdb1
Fixed setting of `output_file` on `FfmpegWriter`.
continuous-integration/drone/push Build is passing Details
Also, fixed parameters passed to camera
writer objects.
2024-02-17 00:01:47 +01:00
Fabio Manganiello a38ef6bc7a Workaround for possible `multiple camera parameter` error.
continuous-integration/drone/push Build was killed Details
2024-02-15 00:51:04 +00:00
Fabio Manganiello 905d6632e0
Misc documentation improvements. 2023-09-29 18:09:15 +02:00
Fabio Manganiello c3337ccc6c
[#311] Docs deps autogen sphinx plugin.
continuous-integration/drone/push Build is passing Details
Added an `add_dependencies` plugin to the Sphinx build process that
parses the manifest files of the scanned backends and plugins and
automatically generates the documentation for the required dependencies
and triggered events.

This means that those dependencies are no longer required to be listed
in the docstring of the class itself.

Also in this commit:

- Black/LINT for some integrations that hadn't been touched in a long
  time.

- Deleted some leftovers from previous refactors (deprecated
  `backend.mqtt`, `backend.zwave.mqtt`, `backend.http.request.rss`).

- Deleted deprecated `inotify` backend - replaced by `file.monitor` (see
  #289).
2023-09-24 17:00:08 +02:00
Fabio Manganiello 761f2768cb
[#316] Added RPM dependencies.
continuous-integration/drone/push Build is passing Details
2023-09-21 23:20:06 +02:00
Fabio Manganiello 98e9abde18
Extended manifest files with Python system packages (if available).
continuous-integration/drone/push Build is passing Details
- If a Python optional dependency is available as a system package on
  the target system, try and install it that route rather than pip. It's
  usually faster and it decreases the risk of breaking system packages.

- Added support for apk dependencies in manifest files. This brings the
  number of distros officially supported by all the extensions to four:

  - Alpine
  - Arch
  - Debian
  - Ubuntu
2023-08-16 22:43:51 +02:00
Fabio Manganiello 27cf1bec52
Removed some optional top-level imports.
Optional top-level imports in Tornado route declarations will trigger
`ImportError`. While this will just mean that those routes will be
skipped, it will also generate a lot of noise on the logs.
2023-07-01 03:13:38 +02:00
Fabio Manganiello 2f4229d7b1
pylint fixes for the camera plugin. 2023-06-16 15:40:05 +02:00
Fabio Manganiello 4587b262b0
Stream camera frames over HTTP using a Redis pub/sub mechanism. 2023-06-05 20:40:12 +02:00
Fabio Manganiello d7208c6bbc
Refactored Tornado routes for native pub/sub support.
The Redis pub/sub mechanism is now a native feature for Tornado routes
through the `PubSubMixin`.

(Plus, lint/black chore for the sound plugin)
2023-05-30 21:58:27 +02:00
Fabio Manganiello 8b5eb82497
Camera stream writer fixes.
- The readiness condition should be `multiprocessing.Condition`, not
  `threading.Condition` - in most of the cases it will be checked in a
  multiprocess environment.

- Fixed parameter name for `write`.
2023-05-30 11:06:48 +02:00
Fabio Manganiello 4fffabd82a
Revert "Removed `camera.gstreamer`."
This reverts commit b4d714df8a.
2023-05-29 22:13:24 +02:00
Fabio Manganiello 4bf9c01ac9
Moved camera routes.
Camera routes migrated from Flask blueprints to Tornado handlers.
2023-05-27 22:24:45 +02:00
Fabio Manganiello b4d714df8a
Removed `camera.gstreamer`.
Too much of a pain in the ass to handle, too many format options to
think of, too many combinations of pipelines to support, and if I don't
think of those beforehand then I'll have to offload all of that
complexity on the user.
2023-05-27 22:19:50 +02:00
Fabio Manganiello 1c40e5e843
Black'd the camera plugin and writer.
Also, proper fix for the multi-inheritance problem of
the ffmpeg writers.
2023-05-23 20:42:59 +02:00
Fabio Manganiello 56dc8d0972
Migrated the webapp to Tornado.
It was just too painful to find a combination of versions of  gunicorn,
gevent, eventlet, pyuwsgi etc. that could work on all of my systems.

On the other hand, Tornado works out of the box with no headaches.

Also in this commit:

- Updated a bunch of outdated/required integration dependencies.
- Black'd and LINTed a couple of old plugins.
2023-05-08 02:06:45 +02:00
Fabio Manganiello 2c254e8eb9
numpy and PIL should be required dependencies for all camera plugins. 2023-05-04 23:44:42 +02:00
Fabio Manganiello 94bb3e0541
Added TOC to readme and more LGTM fixes 2022-02-09 21:06:49 +01:00
Fabio Manganiello 29a7eff15a
Fixed/suppressed LGTM warnings 2022-02-08 21:51:37 +01:00
Fabio Manganiello f147c44a8a Fixed docs issues 2021-09-22 00:19:14 +02:00
Fabio Manganiello 3bfc5b83ef Moved to manifest files for describing plugins and backends and their dependencies 2021-09-16 17:53:40 +02:00
Fabio Manganiello f1faa1141e More LINT fixes 2021-04-06 21:10:48 +02:00
Fabio Manganiello 2a78f81a7b Major LINT fixes 2021-04-05 00:58:44 +02:00
Fabio Manganiello 05b0a7f14d Added GStreamer media plugin [closes #151] 2020-09-29 15:32:40 +02:00
Fabio Manganiello 6ad5397a25 Removed unused import 2020-09-28 22:13:42 +02:00
Fabio Manganiello 0a9c4fc3a7 Added GStreamer camera plugin [relates to #151] 2020-09-28 22:10:56 +02:00
Fabio Manganiello e9d9ef252f Frames directory should be created in 0o755 mode 2020-09-28 02:33:27 +02:00
Fabio Manganiello df1e03f0af Added FFmpeg camera plugin [relates to #150] 2020-09-27 12:52:07 +02:00
Fabio Manganiello 6e6092e4b2 Do proper decapsulation for PiCamera wrapped object when reinitialized 2020-09-25 18:25:33 +02:00
Fabio Manganiello ac42f7eba4 Make sure that the PiCamera session is properly closed and re-opened on each stream request 2020-09-25 18:06:27 +02:00
Fabio Manganiello 258a9b57ce release_device should not fail hard if stop_recording or close fail on ConnectionError 2020-09-25 17:42:21 +02:00
Fabio Manganiello 28409b8688 The device should be released after each streaming session 2020-09-25 17:34:53 +02:00
Fabio Manganiello c12e7bab90 The streaming thread shouldn't fail and exit if it fails closing a client socket 2020-09-25 17:28:25 +02:00
Fabio Manganiello 09f9e974b1 Camera plugins refactor 2020-09-25 17:19:43 +02:00
Fabio Manganiello 4d0d467292 PIL JPEG format name typo fix 2020-09-08 18:14:49 +02:00
Fabio Manganiello 83122becdb Applied degrees -> PIL rotation ID conversion to the output image 2020-09-08 18:03:18 +02:00
Fabio Manganiello 53ddbad7ce Refactored MLX90640 plugin and HTTP route to work with direct BytesIO - it improves performance over using temporary files or base64-encoded responses 2020-09-08 17:51:46 +02:00
Fabio Manganiello d560823887 Replaced deprecated options in PiCamera module 2020-06-27 13:55:18 +02:00
Fabio Manganiello a130edb74f Made QR-code scan work also on picamera 2020-03-11 01:06:07 +01:00
Fabio Manganiello 141275ecdf Support for scanning QR-codes and barcodes through a camera plugin 2020-03-10 22:35:50 +01:00