OctoPrint-BitBang 0.2.1__tar.gz → 0.2.2__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 (32) hide show
  1. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2/OctoPrint_BitBang.egg-info}/PKG-INFO +21 -1
  2. {octoprint_bitbang-0.2.1/OctoPrint_BitBang.egg-info → octoprint_bitbang-0.2.2}/PKG-INFO +21 -1
  3. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/README.md +20 -0
  4. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/__init__.py +1 -1
  5. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/static/js/bitbang.js +29 -8
  6. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/pyproject.toml +1 -1
  7. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/LICENSE +0 -0
  8. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/MANIFEST.in +0 -0
  9. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/OctoPrint_BitBang.egg-info/SOURCES.txt +0 -0
  10. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/OctoPrint_BitBang.egg-info/dependency_links.txt +0 -0
  11. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/OctoPrint_BitBang.egg-info/entry_points.txt +0 -0
  12. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/OctoPrint_BitBang.egg-info/requires.txt +0 -0
  13. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/OctoPrint_BitBang.egg-info/top_level.txt +0 -0
  14. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/__main__.py +0 -0
  15. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/_plugin.py +0 -0
  16. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/app.py +0 -0
  17. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/bin/bitbang-linux-amd64 +0 -0
  18. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/bin/bitbang-linux-arm64 +0 -0
  19. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/bin/bitbang-linux-armv7 +0 -0
  20. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/camera.py +0 -0
  21. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/flip_track.py +0 -0
  22. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/index.html +0 -0
  23. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/octoprint_adapter.py +0 -0
  24. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/pi_camera_track.py +0 -0
  25. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/pi_h264_source.py +0 -0
  26. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/static/favicon.png +0 -0
  27. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/templates/bitbang_navbar.jinja2 +0 -0
  28. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/templates/bitbang_settings.jinja2 +0 -0
  29. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/usb_camera_source.py +0 -0
  30. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/octoprint_bitbang/v4l2_h264_source.py +0 -0
  31. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/setup.cfg +0 -0
  32. {octoprint_bitbang-0.2.1 → octoprint_bitbang-0.2.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OctoPrint-BitBang
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Remote OctoPrint access with live H.264 video via BitBang WebRTC
5
5
  Author-email: Rich LeGrand <rich.m.legrand@gmail.com>
6
6
  License-Expression: MIT
@@ -79,6 +79,8 @@ pip install OctoPrint-BitBang
79
79
 
80
80
  Restart OctoPrint.
81
81
 
82
+ > **Pi CSI camera:** `picamera2` (the Pi camera driver) is a system package, so the venv must be created with `python3 -m venv --system-site-packages` to see it. Without that, the CSI camera isn't detected and the plugin falls back to USB. USB webcams aren't affected -- details in [Installation Notes](#installation-notes).
83
+
82
84
  ### Did it work?
83
85
 
84
86
  After OctoPrint restarts, you should see a **BitBang** button in the navbar and a new **BitBang** entry in Settings. If both are there, you're done -- continue to [Usage](#usage).
@@ -203,6 +205,24 @@ pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
203
205
 
204
206
  `av` wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
205
207
 
208
+ ### Pi CSI camera not detected (falls back to USB)
209
+
210
+ The Pi CSI camera is driven through [`picamera2`](https://github.com/raspberrypi/picamera2), a **system** package installed via `apt` -- it is not on PyPI. Your OctoPrint venv can only import it if the venv was created with access to system site-packages. If it can't, CSI auto-detect fails and the plugin **silently falls back to a USB webcam** (or no camera) -- the plugin still loads, so the only symptom is the wrong camera.
211
+
212
+ Check from inside your OctoPrint venv:
213
+
214
+ ```bash
215
+ python -c "import picamera2" # ImportError -> the venv cannot see picamera2
216
+ ```
217
+
218
+ If that errors, recreate the venv with system site-packages and reinstall OctoPrint and the plugin into it:
219
+
220
+ ```bash
221
+ python3 -m venv --system-site-packages /path/to/oprint
222
+ ```
223
+
224
+ USB webcams work in a plain venv -- this only affects the Pi CSI camera.
225
+
206
226
  ### Diagnostic mode
207
227
 
208
228
  If the video stack fails to import for any reason, the plugin still loads -- settings and navbar are visible, and `octoprint.log` shows a clear `BitBang video stack unavailable: <reason>` line. You can see the missing piece in OctoPrint instead of grepping logs.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OctoPrint-BitBang
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Remote OctoPrint access with live H.264 video via BitBang WebRTC
5
5
  Author-email: Rich LeGrand <rich.m.legrand@gmail.com>
6
6
  License-Expression: MIT
@@ -79,6 +79,8 @@ pip install OctoPrint-BitBang
79
79
 
80
80
  Restart OctoPrint.
81
81
 
82
+ > **Pi CSI camera:** `picamera2` (the Pi camera driver) is a system package, so the venv must be created with `python3 -m venv --system-site-packages` to see it. Without that, the CSI camera isn't detected and the plugin falls back to USB. USB webcams aren't affected -- details in [Installation Notes](#installation-notes).
83
+
82
84
  ### Did it work?
83
85
 
84
86
  After OctoPrint restarts, you should see a **BitBang** button in the navbar and a new **BitBang** entry in Settings. If both are there, you're done -- continue to [Usage](#usage).
@@ -203,6 +205,24 @@ pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
203
205
 
204
206
  `av` wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
205
207
 
208
+ ### Pi CSI camera not detected (falls back to USB)
209
+
210
+ The Pi CSI camera is driven through [`picamera2`](https://github.com/raspberrypi/picamera2), a **system** package installed via `apt` -- it is not on PyPI. Your OctoPrint venv can only import it if the venv was created with access to system site-packages. If it can't, CSI auto-detect fails and the plugin **silently falls back to a USB webcam** (or no camera) -- the plugin still loads, so the only symptom is the wrong camera.
211
+
212
+ Check from inside your OctoPrint venv:
213
+
214
+ ```bash
215
+ python -c "import picamera2" # ImportError -> the venv cannot see picamera2
216
+ ```
217
+
218
+ If that errors, recreate the venv with system site-packages and reinstall OctoPrint and the plugin into it:
219
+
220
+ ```bash
221
+ python3 -m venv --system-site-packages /path/to/oprint
222
+ ```
223
+
224
+ USB webcams work in a plain venv -- this only affects the Pi CSI camera.
225
+
206
226
  ### Diagnostic mode
207
227
 
208
228
  If the video stack fails to import for any reason, the plugin still loads -- settings and navbar are visible, and `octoprint.log` shows a clear `BitBang video stack unavailable: <reason>` line. You can see the missing piece in OctoPrint instead of grepping logs.
@@ -46,6 +46,8 @@ pip install OctoPrint-BitBang
46
46
 
47
47
  Restart OctoPrint.
48
48
 
49
+ > **Pi CSI camera:** `picamera2` (the Pi camera driver) is a system package, so the venv must be created with `python3 -m venv --system-site-packages` to see it. Without that, the CSI camera isn't detected and the plugin falls back to USB. USB webcams aren't affected -- details in [Installation Notes](#installation-notes).
50
+
49
51
  ### Did it work?
50
52
 
51
53
  After OctoPrint restarts, you should see a **BitBang** button in the navbar and a new **BitBang** entry in Settings. If both are there, you're done -- continue to [Usage](#usage).
@@ -170,6 +172,24 @@ pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
170
172
 
171
173
  `av` wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
172
174
 
175
+ ### Pi CSI camera not detected (falls back to USB)
176
+
177
+ The Pi CSI camera is driven through [`picamera2`](https://github.com/raspberrypi/picamera2), a **system** package installed via `apt` -- it is not on PyPI. Your OctoPrint venv can only import it if the venv was created with access to system site-packages. If it can't, CSI auto-detect fails and the plugin **silently falls back to a USB webcam** (or no camera) -- the plugin still loads, so the only symptom is the wrong camera.
178
+
179
+ Check from inside your OctoPrint venv:
180
+
181
+ ```bash
182
+ python -c "import picamera2" # ImportError -> the venv cannot see picamera2
183
+ ```
184
+
185
+ If that errors, recreate the venv with system site-packages and reinstall OctoPrint and the plugin into it:
186
+
187
+ ```bash
188
+ python3 -m venv --system-site-packages /path/to/oprint
189
+ ```
190
+
191
+ USB webcams work in a plain venv -- this only affects the Pi CSI camera.
192
+
173
193
  ### Diagnostic mode
174
194
 
175
195
  If the video stack fails to import for any reason, the plugin still loads -- settings and navbar are visible, and `octoprint.log` shows a clear `BitBang video stack unavailable: <reason>` line. You can see the missing piece in OctoPrint instead of grepping logs.
@@ -5,7 +5,7 @@ No account, no subscription, no port forwarding. One shareable link.
5
5
  """
6
6
 
7
7
  __plugin_name__ = "BitBang"
8
- __plugin_version__ = "0.2.1"
8
+ __plugin_version__ = "0.2.2"
9
9
  __plugin_description__ = "Remote OctoPrint access with live H.264 video via BitBang WebRTC. No account, no port forwarding, one shareable link."
10
10
  __plugin_url__ = "https://github.com/richlegrand/OctoPrint-BitBang"
11
11
  __plugin_author__ = "Rich LeGrand"
@@ -253,12 +253,28 @@
253
253
  // Connect video via local offer/answer endpoint. Works on LAN and
254
254
  // remotely (fetches TURN servers). Can be called with an existing
255
255
  // video element (fallback from remote mode) or creates its own.
256
- function connectLocalVideo(video) {
256
+ function connectLocalVideo(video, attempt) {
257
+ // On a fresh page load the OctoPrint session's CSRF token may not be
258
+ // established yet, so the first POST /plugin/bitbang/offer can come back
259
+ // 400/403. Retry a bounded number of times so the stream comes up on its
260
+ // own instead of requiring a manual page refresh.
261
+ attempt = attempt || 0;
262
+ var MAX_ATTEMPTS = 10;
263
+ var RETRY_MS = 1500;
264
+ var pc = null;
265
+ function retry(why) {
266
+ if (pc) { try { pc.close(); } catch (e) {} }
267
+ if (attempt + 1 < MAX_ATTEMPTS) {
268
+ setTimeout(function () { connectLocalVideo(video, attempt + 1); }, RETRY_MS);
269
+ } else {
270
+ console.log("[BitBang] Local video gave up after retries:", why);
271
+ }
272
+ }
257
273
  fetch("/plugin/bitbang/ice-servers").then(function (r) {
258
274
  return r.json();
259
275
  }).then(function (iceServers) {
260
276
  var config = (iceServers && iceServers.length > 0) ? { iceServers: iceServers } : {};
261
- var pc = new RTCPeerConnection(config);
277
+ pc = new RTCPeerConnection(config);
262
278
 
263
279
  pc.ontrack = function (event) {
264
280
  if (event.streams && event.streams[0]) {
@@ -283,16 +299,21 @@
283
299
  })
284
300
  });
285
301
  }).then(function (response) {
286
- return response.json();
287
- }).then(function (answer) {
288
- if (answer.error) {
289
- console.log("[BitBang] Local video not available:", answer.error);
302
+ if (!response.ok) {
303
+ // 400 (CSRF token not ready yet), 403 (not logged in yet), etc.
304
+ retry("offer HTTP " + response.status);
290
305
  return;
291
306
  }
292
- return pc.setRemoteDescription(answer);
307
+ return response.json().then(function (answer) {
308
+ if (answer.error) {
309
+ console.log("[BitBang] Local video not available:", answer.error);
310
+ return;
311
+ }
312
+ return pc.setRemoteDescription(answer);
313
+ });
293
314
  });
294
315
  }).catch(function (err) {
295
- console.log("[BitBang] Local video failed:", err);
316
+ retry(String(err));
296
317
  });
297
318
  }
298
319
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "OctoPrint-BitBang"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Remote OctoPrint access with live H.264 video via BitBang WebRTC"
9
9
  readme = "README.md"
10
10
  license = "MIT"