cv-frames 0.0.2__tar.gz → 0.0.3__tar.gz

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.
Files changed (23) hide show
  1. {cv_frames-0.0.2 → cv_frames-0.0.3}/PKG-INFO +1 -1
  2. {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/PKG-INFO +1 -1
  3. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/iterate.py +1 -1
  4. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/server.py +11 -9
  5. {cv_frames-0.0.2 → cv_frames-0.0.3}/.github/workflows/publish.yml +0 -0
  6. {cv_frames-0.0.2 → cv_frames-0.0.3}/.github/workflows/tests.yml +0 -0
  7. {cv_frames-0.0.2 → cv_frames-0.0.3}/.gitignore +0 -0
  8. {cv_frames-0.0.2 → cv_frames-0.0.3}/.pre-commit-config.yaml +0 -0
  9. {cv_frames-0.0.2 → cv_frames-0.0.3}/README.rst +0 -0
  10. {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/SOURCES.txt +0 -0
  11. {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/dependency_links.txt +0 -0
  12. {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/entry_points.txt +0 -0
  13. {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/requires.txt +0 -0
  14. {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/top_level.txt +0 -0
  15. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/__init__.py +0 -0
  16. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/cli.py +0 -0
  17. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/__init__.py +0 -0
  18. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/client.py +0 -0
  19. {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/static/index.html +0 -0
  20. {cv_frames-0.0.2 → cv_frames-0.0.3}/pyproject.toml +0 -0
  21. {cv_frames-0.0.2 → cv_frames-0.0.3}/requirements.txt +0 -0
  22. {cv_frames-0.0.2 → cv_frames-0.0.3}/setup.cfg +0 -0
  23. {cv_frames-0.0.2 → cv_frames-0.0.3}/tests/test_iterate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cv-frames
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Read frames from OpenCV like humans
5
5
  Description-Content-Type: text/x-rst
6
6
  Requires-Dist: opencv-python
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cv-frames
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Read frames from OpenCV like humans
5
5
  Description-Content-Type: text/x-rst
6
6
  Requires-Dist: opencv-python
@@ -55,7 +55,7 @@ def iterate_generic(
55
55
  count = start_frame
56
56
 
57
57
  if not capture.is_opened():
58
- return
58
+ raise RuntimeError(f"Cannot open video file: {ipath}")
59
59
 
60
60
  try:
61
61
  while True:
@@ -33,14 +33,20 @@ async def broadcast_task(
33
33
  frame = await frame_queue.get()
34
34
  async with clients_lock:
35
35
  to_remove = set()
36
+ tasks = []
36
37
  for ws in clients:
37
38
  if ws.closed:
38
39
  to_remove.add(ws)
39
40
  continue
40
- try:
41
- await ws.send_bytes(frame)
42
- except Exception:
43
- to_remove.add(ws)
41
+
42
+ async def send(ws):
43
+ try:
44
+ await ws.send_bytes(frame)
45
+ except Exception:
46
+ to_remove.add(ws)
47
+
48
+ tasks.append(asyncio.create_task(send(ws)))
49
+ await asyncio.gather(*tasks, return_exceptions=True)
44
50
  for ws in to_remove:
45
51
  clients.remove(ws)
46
52
  frame_queue.task_done()
@@ -135,7 +141,6 @@ async def websocket_handler(request):
135
141
 
136
142
  async def main(http_port: int, tcp_port: int):
137
143
  app = web.Application()
138
-
139
144
  frame_queue: asyncio.Queue = asyncio.Queue()
140
145
  clients: set[web.WebSocketResponse] = set()
141
146
  clients_lock = asyncio.Lock()
@@ -150,11 +155,8 @@ async def main(http_port: int, tcp_port: int):
150
155
 
151
156
  # Get static paths relative to package
152
157
  index = pkg_resources.files("cvframes.web.static").joinpath("index.html")
153
- static = pkg_resources.files("cvframes.web.static")
154
-
155
- app.router.add_get("/", lambda request: web.FileResponse(index))
158
+ app.router.add_get("/", lambda request: web.FileResponse(str(index)))
156
159
  app.router.add_get("/ws", websocket_handler)
157
- app.router.add_static("/static/", path=static, name="static")
158
160
 
159
161
  runner = web.AppRunner(app)
160
162
  await runner.setup()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes