Access any serial device in your lan
Project description
WSWebcam
A WSWebcam é uma biblioteca para facilitar streaming de dispostivos de video via rede utilizando o protocolo websocket.
Sua arquitetura é baseada no modelo cliente/servidor. Onde o Dispotivo serial é o servidor e qualquer cliente que conheca seu endereço e porta pode se comunicar com ele.
Uso/Exemplos
# python -m wswebcam -h
usage: __main__.py [-h] [-c] [-s] [-p PORT] [-a ADDRESS] [-d DEVICE] [-v] [-g]
wswebcam - Websocket to WebcamBridge
options:
-h, --help show this help message and exit
-c, --client Run as a client
-s, --server Run as a server
-p PORT, --port PORT Port to listen on
-a ADDRESS, --address ADDRESS
Address to connect to (default: localhost)
-d DEVICE, --device DEVICE
Serial device to connect to (default: 0)
-v, --verbose Enable verbose logging
-g, --gui Run GUI to view the frame
Server - [Cmdlt, Instance and Context Manager]
# Start a server at 8050 with command line
python -m wswebcam -s -p 8050
# Server as Instance
from wswebcam.server import Server
import asyncio
async def main():
await Server("0.0.0.0", 8050, 0).run()
asyncio.run(main())
# Server as context manager]
from wswebcam.server import Server
import asyncio
async def main():
async with Server("0.0.0.0", 8050, 0) as server:
await asyncio.sleep(10)
asyncio.run(main())
Client - [Cmdlt, Instance and Context Manager]
# Connect a client on server at 0.0.0.0:8050
python -m wswebcam -c -a 0.0.0.0 -p 8050
# Client as Instance
from wswebcam.client import Device as Client
from wswebcam.protocol import package
import asyncio
async def main():
await client = Client("ws://0.0.0.0:8050")
await client.connect()
await client.read()
await client.disconnect()
asyncio.run(main())
# Client as context manager
from wswebcam.client import Camera as Client
import asyncio
async def main():
async with Client("ws://0.0.0.0:8050") as client:
await client.read()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wswebcam-1.1.0.tar.gz
(8.1 kB
view details)
Built Distribution
File details
Details for the file wswebcam-1.1.0.tar.gz
.
File metadata
- Download URL: wswebcam-1.1.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad3036b65b43a39090e7fe82024d768b209630f1f245f96becf58eda84c5a54b |
|
MD5 | 28704371036b5e0d6432483fe81b0403 |
|
BLAKE2b-256 | 1d820c4357de2f2bbd2e43d67e51c825f8eb689b7364d0d828d477e87a8c378f |
File details
Details for the file wswebcam-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: wswebcam-1.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc24ca4f0f9c2e3a060b8f8771fad9dfc973083886f74c704a2e9243d0e70d79 |
|
MD5 | fcbebe5c618f2acdf8f7243f4dcba1ff |
|
BLAKE2b-256 | 0aa1bcc421a09f2864da94b0b1e609488f70b61f5e461b37821c805e5b8790a3 |