meltingplot.rpi-camera 0.0.1__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.
@@ -0,0 +1 @@
1
+ """Initialize the meltingplot package."""
@@ -0,0 +1,5 @@
1
+ """Initialize the meltingplot.rpi_camera package."""
2
+
3
+ from . import _version
4
+
5
+ __version__ = _version.get_versions()['version']
@@ -0,0 +1,22 @@
1
+ """Define the main entry point for the package."""
2
+ import click
3
+
4
+ from .cli.install import install
5
+ from .server import start
6
+
7
+
8
+ @click.group()
9
+ def cli():
10
+ """Define the main entry point for the command-line interface."""
11
+ pass
12
+
13
+
14
+ def main():
15
+ """Define the main entry point for the command-line interface."""
16
+ cli.add_command(start)
17
+ cli.add_command(install)
18
+ cli()
19
+
20
+
21
+ if __name__ == '__main__':
22
+ main()
@@ -0,0 +1,21 @@
1
+
2
+ # This file was generated by 'versioneer.py' (0.29) from
3
+ # revision-control system data, or from the parent directory name of an
4
+ # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
+ # of this file.
6
+
7
+ import json
8
+
9
+ version_json = '''
10
+ {
11
+ "date": "2024-11-27T19:31:28+0100",
12
+ "dirty": false,
13
+ "error": null,
14
+ "full-revisionid": "c2ac713eb8d48385bedba1d4abb3e8d401ca0b42",
15
+ "version": "0.0.1"
16
+ }
17
+ ''' # END VERSION_JSON
18
+
19
+
20
+ def get_versions():
21
+ return json.loads(version_json)
@@ -0,0 +1 @@
1
+ """Initialize the meltingplot.rpi_camera.cli package."""
@@ -0,0 +1,55 @@
1
+ """Install the RPi Camera as a systemd service."""
2
+
3
+ import click
4
+
5
+
6
+ @click.command()
7
+ def install():
8
+ """Install the RPi Camera as a systemd service."""
9
+ import os
10
+ import getpass
11
+ import grp
12
+ import subprocess
13
+ import sys
14
+ import tempfile
15
+
16
+ # Get the path of the service file
17
+ service_file = os.path.join(sys.prefix, 'rpi-camera.service')
18
+
19
+ service_content = None
20
+
21
+ # Read the content of the service file
22
+ with open(service_file, 'r') as file:
23
+ service_content = file.read()
24
+
25
+ # Replace User and Group with the current user and group
26
+ current_user = getpass.getuser()
27
+ current_group = grp.getgrgid(os.getgid()).gr_name
28
+ service_content = service_content.replace('User=pi', f'User={current_user}', 1)
29
+ service_content = service_content.replace('Group=pi', f'Group={current_group}', 1)
30
+
31
+ click.echo(f"Installing the service as user/group: {current_user}/{current_group}")
32
+
33
+ # Save the modified content to a temp file
34
+ with tempfile.NamedTemporaryFile('wt+') as tmp_file:
35
+ tmp_file.write(service_content)
36
+ tmp_file.flush()
37
+
38
+ # Copy the service file to /etc/systemd/system
39
+ subprocess.check_output(['sudo', 'cp', tmp_file.name, '/etc/systemd/system/rpi-camera.service'])
40
+
41
+ # Reload the systemd daemon
42
+ subprocess.run(['sudo', 'systemctl', 'daemon-reload'])
43
+
44
+ # Enable the service
45
+ subprocess.run(['sudo', 'systemctl', 'enable', 'rpi-camera'])
46
+
47
+ # Start the service
48
+ subprocess.run(['sudo', 'systemctl', 'start', 'rpi-camera'])
49
+
50
+ executable_file = os.path.join(sys.prefix, 'bin/rpi-camera')
51
+
52
+ # Make the rpi-camera command available outside the venv
53
+ subprocess.run(['sudo', 'ln', '-sf', executable_file, '/usr/local/bin/rpi-camera'])
54
+
55
+ print('The RPi Camera has been installed as a systemd service.')
@@ -0,0 +1,197 @@
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ This script sets up an HTTP server to stream video from a Raspberry Pi camera using the Picamera2 library.
5
+
6
+ It is based on the official Picamera2 example for streaming video from a Raspberry Pi camera using the MJPEG format.
7
+
8
+ https://github.com/raspberrypi/picamera2/blob/main/examples/mjpeg_server_2.py
9
+
10
+ Which is licensed under the BSD 2-Clause License (https://github.com/raspberrypi/picamera2/blob/main/LICENSE)
11
+
12
+ It provides both a web interface for viewing the stream and an endpoint for fetching the current frame as a JPEG image.
13
+ Classes:
14
+ StreamingOutput: A class that buffers the video frames and notifies waiting threads when a new frame is available.
15
+ StreamingHandler: A request handler for serving the MJPEG stream.
16
+ HttpHandler: A request handler for serving the HTML page and current frame as a JPEG image.
17
+ StreamingServer: A server class that supports threading and reuses addresses.
18
+ Functions:
19
+ main: The main function that configures the camera, starts recording, and sets up the HTTP servers.
20
+ HTML Page:
21
+ The HTML page includes a link to the stream and a link to fetch the current frame.
22
+ Endpoints:
23
+ / or /index.html: Serves the HTML page.
24
+ /picture/1/current/: Serves the current frame as a JPEG image.
25
+ /webcam: Serves the MJPEG stream.
26
+ Usage:
27
+ Run the script to start the HTTP servers on ports 80 and 8081.
28
+ """
29
+
30
+ import asyncio
31
+ import io
32
+ import logging
33
+ import socketserver
34
+ from http import server
35
+ from threading import Condition
36
+ from urllib.parse import urlparse
37
+
38
+ import click
39
+
40
+ from libcamera import controls
41
+
42
+ from picamera2 import Picamera2
43
+ from picamera2.encoders import MJPEGEncoder
44
+ from picamera2.outputs import FileOutput
45
+
46
+
47
+ PAGE = """\
48
+ <html>
49
+ <head>
50
+ <title>Meltingplot RPi Camera MJPEG streaming</title>
51
+ </head>
52
+ <body>
53
+ <h1>Meltingplot RPi Camera</h1>
54
+ <img src="data:image/png;base64,AAAAHGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZgAAA1ptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABwaWN0AAAAAAAAAAAAAAAAAAAAAA5waXRtAAAAAAABAAAARmlsb2MAAAAAREAAAwACAAAAAAN+AAEAAAAAAAAFYQABAAAAAAjfAAEAAAAAAAAB4gADAAAAAArBAAEAAAAAAAAAvgAAAE1paW5mAAAAAAADAAAAFWluZmUCAAAAAAEAAGF2MDEAAAAAFWluZmUCAAAAAAIAAGF2MDEAAAAAFWluZmUCAAABAAMAAEV4aWYAAAACZGlwcnAAAAI+aXBjbwAAAbRjb2xycklDQwAAAahsY21zAhAAAG1udHJSR0IgWFlaIAfcAAEAGQADACkAOWFjc3BBUFBMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD21gABAA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zbIAAAAAGRXhpZgAASUkqAAgAAAAGABIBAwABAAAAAQAAABoBBQABAAAAVgAAABsBBQABAAAAXgAAACgBAwABAAAAAgAAABMCAwABAAAAAQAAAGmHBAABAAAAZgAAAAAAAAC+wwEA6AMAAL7DAQDoAwAABgAAkAcABAAAADAyMTABkQcABAAAAAECAwAAoAcABAAAADAxMDABoAMAAQAAAP//AAACoAQAAQAAAKAAAAADoAQAAQAAAEIAAAAAAAAA" width=160 height=66></img>
55
+ <p><a href="picture/1/current/">Screenshot URL</a> <span>picture/1/current/</span></p>
56
+ <p><a id="streamLink" href="">Stream URL</a> <span>Streaming URL hostname:8081</span></p>
57
+ <script type="text/javascript">
58
+ document.addEventListener("DOMContentLoaded", function() {
59
+ var hostname = window.location.hostname;
60
+ var streamLink = document.getElementById("streamLink");
61
+ streamLink.href = "http://" + hostname + ":8081";
62
+ });
63
+ </script>
64
+ </body>
65
+ </html>
66
+ """ # noqa:E501
67
+
68
+
69
+ class StreamingOutput(io.BufferedIOBase):
70
+ """A class that buffers the video frames and notifies waiting threads when a new frame is available."""
71
+
72
+ def __init__(self):
73
+ """Initialize the streaming output with a frame buffer and condition."""
74
+ self.frame = None
75
+ self.condition = Condition()
76
+
77
+ def write(self, buf):
78
+ """Write the buffer to the stream and notify waiting threads."""
79
+ with self.condition:
80
+ self.frame = buf
81
+ self.condition.notify_all()
82
+
83
+
84
+ class StreamingHandler(server.BaseHTTPRequestHandler):
85
+ """A request handler for serving the MJPEG stream."""
86
+
87
+ frame_buffer = None
88
+
89
+ def do_GET(self): # noqa:N802
90
+ """Serve the MJPEG stream."""
91
+ url = urlparse(self.path)
92
+ if url.path == '/' or url.path == '/webcam':
93
+ self.send_response(200)
94
+ self.send_header('Age', 0)
95
+ self.send_header('Cache-Control', 'no-cache, private')
96
+ self.send_header('Pragma', 'no-cache')
97
+ self.send_header('Content-Type', 'multipart/x-mixed-replace; boundary=FRAME')
98
+ self.end_headers()
99
+ try:
100
+ while True:
101
+ with self.frame_buffer.condition:
102
+ self.frame_buffer.condition.wait()
103
+ frame = self.frame_buffer.frame
104
+ self.wfile.write(b'--FRAME\r\n')
105
+ self.send_header('Content-Type', 'image/jpeg')
106
+ self.send_header('Content-Length', len(frame))
107
+ self.end_headers()
108
+ self.wfile.write(frame)
109
+ self.wfile.write(b'\r\n')
110
+ except Exception as e:
111
+ logging.warning('Removed streaming client %s: %s', self.client_address, str(e))
112
+ else:
113
+ self.send_error(404)
114
+ self.end_headers()
115
+
116
+
117
+ class HttpHandler(server.BaseHTTPRequestHandler):
118
+ """A request handler for serving the HTML page and current frame as a JPEG image."""
119
+
120
+ frame_buffer = None
121
+
122
+ def do_GET(self): # noqa:N802
123
+ """Serve the HTML page or the current frame as a JPEG image."""
124
+ url = urlparse(self.path)
125
+
126
+ if url.path == '/' or url.path == '/index.html':
127
+ content = PAGE.encode('utf-8')
128
+ self.send_response(200)
129
+ self.send_header('Content-Type', 'text/html')
130
+ self.send_header('Content-Length', len(content))
131
+ self.end_headers()
132
+ self.wfile.write(content)
133
+ elif url.path == '/picture/1/current/':
134
+ self.send_response(200)
135
+ self.send_header('Age', 0)
136
+ self.send_header('Cache-Control', 'no-cache, private')
137
+ self.send_header('Pragma', 'no-cache')
138
+ try:
139
+ with self.frame_buffer.condition:
140
+ self.frame_buffer.condition.wait()
141
+ frame = self.frame_buffer.frame
142
+ self.send_header('Content-Type', 'image/jpeg')
143
+ self.send_header('Content-Length', len(frame))
144
+ self.end_headers()
145
+ self.wfile.write(frame)
146
+ self.wfile.write(b'\r\n')
147
+ except Exception as e:
148
+ logging.warning('Removed client %s: %s', self.client_address, str(e))
149
+ else:
150
+ self.send_error(404)
151
+ self.end_headers()
152
+
153
+
154
+ class StreamingServer(socketserver.ThreadingMixIn, server.HTTPServer):
155
+ """This class extends the HTTPServer class to support threading and reuse addresses."""
156
+
157
+ allow_reuse_address = True
158
+ daemon_threads = True
159
+
160
+
161
+ @click.command()
162
+ def start():
163
+ """
164
+ Initialize and start the Raspberry Pi camera for video streaming.
165
+
166
+ Configure the camera to record video at 1920x1080 resolution,
167
+ set up the streaming output, and start the HTTP and streaming servers on
168
+ specified ports (80 and 8081). Set the autofocus mode to continuous.
169
+
170
+ Ensure that the camera recording is stopped properly when the
171
+ servers are no longer running.
172
+
173
+ Raise:
174
+ Exception: If there is an error during the server execution or camera operation.
175
+ """
176
+ frame_buffer = StreamingOutput()
177
+ HttpHandler.frame_buffer = frame_buffer
178
+ StreamingHandler.frame_buffer = frame_buffer
179
+
180
+ picam2 = Picamera2()
181
+ picam2.configure(picam2.create_video_configuration(main={"size": (1920, 1080)}))
182
+ picam2.start_recording(MJPEGEncoder(), FileOutput(frame_buffer))
183
+ picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous})
184
+
185
+ try:
186
+
187
+ async def start_server(handler, port):
188
+ address = ('', port)
189
+ server = StreamingServer(address, handler)
190
+ with server:
191
+ await asyncio.get_event_loop().run_in_executor(None, server.serve_forever)
192
+
193
+ loop = asyncio.get_event_loop()
194
+ tasks = [start_server(HttpHandler, 80), start_server(StreamingHandler, 8081)]
195
+ loop.run_until_complete(asyncio.gather(*tasks))
196
+ finally:
197
+ picam2.stop_recording()
@@ -0,0 +1,18 @@
1
+ [Unit]
2
+ Description=RPi Camera MJPEG Server
3
+ After=network.target
4
+
5
+ [Service]
6
+ Type=simple
7
+ Restart=always
8
+ StartLimitInterval=0
9
+ StartLimitBurst=1440
10
+ RestartSec=60
11
+ ExecStart=/usr/local/bin/rpi-camera start
12
+ WorkingDirectory=/home/pi
13
+ User=pi
14
+ Group=pi
15
+ AmbientCapabilities=CAP_NET_BIND_SERVICE
16
+
17
+ [Install]
18
+ WantedBy=multi-user.target
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,292 @@
1
+ Metadata-Version: 2.1
2
+ Name: meltingplot.rpi_camera
3
+ Version: 0.0.1
4
+ Summary: RPi Camera MJPEG Streamer.
5
+ Home-page:
6
+ Author: Tim Schneider
7
+ Author-email: tim@meltingplot.net
8
+ License: Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship, whether in Source or
43
+ Object form, made available under the License, as indicated by a
44
+ copyright notice that is included in or attached to the work
45
+ (an example is provided in the Appendix below).
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other modifications
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean any work of authorship, including
56
+ the original version of the Work and any modifications or additions
57
+ to that Work or Derivative Works thereof, that is intentionally
58
+ submitted to Licensor for inclusion in the Work by the copyright owner
59
+ or by an individual or Legal Entity authorized to submit on behalf of
60
+ the copyright owner. For the purposes of this definition, "submitted"
61
+ means any form of electronic, verbal, or written communication sent
62
+ to the Licensor or its representatives, including but not limited to
63
+ communication on electronic mailing lists, source code control systems,
64
+ and issue tracking systems that are managed by, or on behalf of, the
65
+ Licensor for the purpose of discussing and improving the Work, but
66
+ excluding communication that is conspicuously marked or otherwise
67
+ designated in writing by the copyright owner as "Not a Contribution."
68
+
69
+ "Contributor" shall mean Licensor and any individual or Legal Entity
70
+ on behalf of whom a Contribution has been received by Licensor and
71
+ subsequently incorporated within the Work.
72
+
73
+ 2. Grant of Copyright License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a
90
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
91
+ or a Contribution incorporated within the Work constitutes direct
92
+ or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate
94
+ as of the date such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, then any Derivative Works that You distribute must
115
+ include a readable copy of the attribution notices contained
116
+ within such NOTICE file, excluding those notices that do not
117
+ pertain to any part of the Derivative Works, in at least one
118
+ of the following places: within a NOTICE text file distributed
119
+ as part of the Derivative Works; within the Source form or
120
+ documentation, if provided along with the Derivative Works; or,
121
+ within a display generated by the Derivative Works, if and
122
+ wherever such third-party notices normally appear. The contents
123
+ of the NOTICE file are for informational purposes only and
124
+ do not modify the License. You may add Your own attribution
125
+ notices within Derivative Works that You distribute, alongside
126
+ or as an addendum to the NOTICE text from the Work, provided
127
+ that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+
137
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
138
+ any Contribution intentionally submitted for inclusion in the Work
139
+ by You to the Licensor shall be under the terms and conditions of
140
+ this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify
142
+ the terms of any separate license agreement you may have executed
143
+ with Licensor regarding such Contributions.
144
+
145
+ 6. Trademarks. This License does not grant permission to use the trade
146
+ names, trademarks, service marks, or product names of the Licensor,
147
+ except as required for reasonable and customary use in describing the
148
+ origin of the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty. Unless required by applicable law or
151
+ agreed to in writing, Licensor provides the Work (and each
152
+ Contributor provides its Contributions) on an "AS IS" BASIS,
153
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154
+ implied, including, without limitation, any warranties or conditions
155
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156
+ PARTICULAR PURPOSE. You are solely responsible for determining the
157
+ appropriateness of using or redistributing the Work and assume any
158
+ risks associated with Your exercise of permissions under this License.
159
+
160
+ 8. Limitation of Liability. In no event and under no legal theory,
161
+ whether in tort (including negligence), contract, or otherwise,
162
+ unless required by applicable law (such as deliberate and grossly
163
+ negligent acts) or agreed to in writing, shall any Contributor be
164
+ liable to You for damages, including any direct, indirect, special,
165
+ incidental, or consequential damages of any character arising as a
166
+ result of this License or out of the use or inability to use the
167
+ Work (including but not limited to damages for loss of goodwill,
168
+ work stoppage, computer failure or malfunction, or any and all
169
+ other commercial damages or losses), even if such Contributor
170
+ has been advised of the possibility of such damages.
171
+
172
+ 9. Accepting Warranty or Additional Liability. While redistributing
173
+ the Work or Derivative Works thereof, You may choose to offer,
174
+ and charge a fee for, acceptance of support, warranty, indemnity,
175
+ or other liability obligations and/or rights consistent with this
176
+ License. However, in accepting such obligations, You may act only
177
+ on Your own behalf and on Your sole responsibility, not on behalf
178
+ of any other Contributor, and only if You agree to indemnify,
179
+ defend, and hold each Contributor harmless for any liability
180
+ incurred by, or claims asserted against, such Contributor by reason
181
+ of your accepting any such warranty or additional liability.
182
+
183
+ END OF TERMS AND CONDITIONS
184
+
185
+ APPENDIX: How to apply the Apache License to your work.
186
+
187
+ To apply the Apache License to your work, attach the following
188
+ boilerplate notice, with the fields enclosed by brackets "[]"
189
+ replaced with your own identifying information. (Don't include
190
+ the brackets!) The text should be enclosed in the appropriate
191
+ comment syntax for the file format. We also recommend that a
192
+ file or class name and description of purpose be included on the
193
+ same "printed page" as the copyright notice for easier
194
+ identification within third-party archives.
195
+
196
+ Copyright [yyyy] [name of copyright owner]
197
+
198
+ Licensed under the Apache License, Version 2.0 (the "License");
199
+ you may not use this file except in compliance with the License.
200
+ You may obtain a copy of the License at
201
+
202
+ http://www.apache.org/licenses/LICENSE-2.0
203
+
204
+ Unless required by applicable law or agreed to in writing, software
205
+ distributed under the License is distributed on an "AS IS" BASIS,
206
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207
+ See the License for the specific language governing permissions and
208
+ limitations under the License.
209
+
210
+ Description-Content-Type: text/x-rst
211
+ License-File: LICENSE
212
+ Requires-Dist: click
213
+ Provides-Extra: test
214
+ Requires-Dist: pytest-cov; extra == "test"
215
+ Requires-Dist: pytest-mock; extra == "test"
216
+ Requires-Dist: pytest-asyncio; extra == "test"
217
+ Requires-Dist: flake8; extra == "test"
218
+ Requires-Dist: flake8-import-order; extra == "test"
219
+ Requires-Dist: flake8-blind-except; extra == "test"
220
+ Requires-Dist: flake8-builtins; extra == "test"
221
+ Requires-Dist: flake8-docstrings; extra == "test"
222
+ Requires-Dist: flake8-bugbear; extra == "test"
223
+ Requires-Dist: flake8-comprehensions; extra == "test"
224
+ Requires-Dist: flake8-commas; extra == "test"
225
+ Requires-Dist: pep8-naming; extra == "test"
226
+ Requires-Dist: bandit; extra == "test"
227
+ Requires-Dist: yapf; extra == "test"
228
+ Requires-Dist: versioneer; extra == "test"
229
+ Requires-Dist: twine; extra == "test"
230
+
231
+ MeltingPlot RPi Camera
232
+ ======================
233
+
234
+ Overview
235
+ --------
236
+
237
+ MeltingPlot RPi Camera is a Python project designed to interface with a Raspberry Pi camera module.
238
+ It captures images and videos, processes them, and provides various functionalities for image analysis
239
+ and manipulation.
240
+
241
+ Features
242
+ --------
243
+
244
+ - Capture images and videos
245
+ - Image processing and analysis
246
+ - Integration with Raspberry Pi camera module
247
+ - Easy-to-use interface
248
+
249
+ Installation
250
+ ------------
251
+
252
+ To install the required dependencies, run:
253
+
254
+ .. code-block:: bash
255
+
256
+ sudo apt update
257
+ sudo apt upgrade -y
258
+ sudo apt install -y python3-picamera2
259
+ python3 -m venv --system-site-packages venv
260
+ source venv/bin/activate
261
+ pip install meltingplot.rpi_camera
262
+ sudo rpi-camera install
263
+
264
+ Usage
265
+ -----
266
+
267
+ To start streaming images, run:
268
+
269
+ .. code-block:: bash
270
+
271
+ sudo rpi-camera start
272
+
273
+ or as a service:
274
+
275
+ .. code-block:: bash
276
+
277
+ sudo systemctl start rpi-camera
278
+
279
+ Contributing
280
+ ------------
281
+
282
+ Contributions are welcome! Please fork the repository and submit a pull request.
283
+
284
+ License
285
+ -------
286
+
287
+ This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.
288
+
289
+ Contact
290
+ -------
291
+
292
+ For any questions or inquiries, please contact Tim at tim@meltingplot.net
@@ -0,0 +1,14 @@
1
+ meltingplot/__init__.py,sha256=l1LMHWb-t2Q9o2S7eo5WI0b5Ff2l4fCSNPyaH__hCdM,42
2
+ meltingplot/rpi_camera/__init__.py,sha256=c-2V88mwlrMxXoxAi9K81FVcqAwfpFXYAk2EmMQcfA8,127
3
+ meltingplot/rpi_camera/__main__.py,sha256=LySc5jnmlL8jWoofh8chsRVz1LRSbLg_AOI4LUR2lWc,421
4
+ meltingplot/rpi_camera/_version.py,sha256=bknjfULbx8EnrIbV8Re15tu022fzrbhN8vFrCJbMXk0,497
5
+ meltingplot/rpi_camera/server.py,sha256=6Aehfbpt5cfaLADATLb1aqtUCkgs2xiyYiFEo7ei8GQ,11325
6
+ meltingplot/rpi_camera/cli/__init__.py,sha256=jijW03X_SpNS4Vs_BPwNGtNvFYOyiBD1jYA_dZl0RLQ,57
7
+ meltingplot/rpi_camera/cli/install.py,sha256=Tv6t7EBc8Prjs1IKx4bxRRV94lGRzt4YIKPfv9-wCv0,1821
8
+ meltingplot.rpi_camera-0.0.1.data/data/rpi-camera.service,sha256=zUDawjLo-gPUzFaR-i7ngNRvX30cshsyQcEmMEUotEE,321
9
+ meltingplot.rpi_camera-0.0.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
10
+ meltingplot.rpi_camera-0.0.1.dist-info/METADATA,sha256=A-TFHVaLnBmMYZ8J0eebM8ZEgwrMYvcUO0ByvOPHoCw,15216
11
+ meltingplot.rpi_camera-0.0.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
12
+ meltingplot.rpi_camera-0.0.1.dist-info/entry_points.txt,sha256=9_VeMTkZSGrFycMJFc0ZOOX3b8HfYCjdXNRQU-MTVTM,68
13
+ meltingplot.rpi_camera-0.0.1.dist-info/top_level.txt,sha256=Flugb-9U0lxl5i6Lsq6PjWBeX7GpQRqcCN6ZRvW21yw,12
14
+ meltingplot.rpi_camera-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.6.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ rpi-camera = meltingplot.rpi_camera.__main__:main
@@ -0,0 +1 @@
1
+ meltingplot