webatem 2.4.0__tar.gz → 2.5.0__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.
- {webatem-2.4.0 → webatem-2.5.0}/PKG-INFO +2 -2
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/apps.py +14 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/consumer.py +68 -23
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/media_pool/watcher.py +72 -10
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_connect.js +25 -13
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_control.js +3 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/uploader.py +19 -2
- {webatem-2.4.0 → webatem-2.5.0}/pyproject.toml +4 -3
- {webatem-2.4.0 → webatem-2.5.0}/webatem.egg-info/PKG-INFO +2 -2
- {webatem-2.4.0 → webatem-2.5.0}/webatem.egg-info/requires.txt +1 -1
- {webatem-2.4.0 → webatem-2.5.0}/LICENSE +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/README.md +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/activity.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/activity.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/commands.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/device_api.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/logging.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/control/views.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/discovery.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/hooks.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/hyperdeck/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/hyperdeck/connection.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/hyperdeck/views.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/ip_upload_lock.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/media_pool/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/media_pool/broadcast.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/media_pool/still_cache.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/media_pool/views.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/migrations/0001_initial.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/migrations/0002_legacy_log.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/migrations/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/models.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/netutil.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/profile/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/profile/dialog.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/profile/export.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/profile/views.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/routing.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/sightings.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/apple-touch-icon.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/brand.css +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/favicon-32.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/favicon.ico +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-400-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-400-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-500-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-500-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-600-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-600-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-800-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/Archivo-800-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-600-latin-ext.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-600-latin.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/OFL-Archivo.txt +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/OFL-IBMPlexMono.txt +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/icon-192.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/icon-512.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/icon-maskable-512.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/manifest.webmanifest +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/mark.svg +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/tray/linux-24.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/tray/mac-22.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/tray/mac-44.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/tray/win-16.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/tray/win-32.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/css/atem_connect.css +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/css/atem_control.css +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/icon.png +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_control_page.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_discovery.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_hyperdeck.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_profile.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/atem_realtime_slider.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/custom-scrollbar.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/recent_label.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/js/wa-select.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/README.md +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/alpine.min.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/alpinejs-collapse-3.14.3.min.js +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/bootstrap-icons/bootstrap-icons.min.css +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/bootstrap-icons/fonts/bootstrap-icons.woff +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/bootstrap-icons/fonts/bootstrap-icons.woff2 +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/webatem.css +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/storage.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/tally.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/connect.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_atem_info.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_fade_to_black.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_fairlight.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_header.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_hyperdeck_panel.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_macros.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_media_pool.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_profile_modal.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_settings_dsk.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_settings_transition.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_settings_usk.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_slider.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_transition_controls.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_transition_style.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_usk_fly.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_usk_keyframe.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_usk_mask.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control/_usk_slider.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templates/control.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templatetags/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/templatetags/static_v.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/atem_control/urls.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/setup.cfg +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/__init__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/__main__.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/applog.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/asgi.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/context.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/launcher.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/server.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/settings.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/templates/base.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/templates/brand/_mark.svg +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/templates/launcher.html +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/uninstall.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/updates.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/urls.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/views.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem/websocket.py +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem.egg-info/SOURCES.txt +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem.egg-info/dependency_links.txt +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem.egg-info/entry_points.txt +0 -0
- {webatem-2.4.0 → webatem-2.5.0}/webatem.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: webatem
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Browser-based control for Blackmagic ATEM switchers: run it, open the browser, your switchers are there
|
|
5
5
|
Author: Lucas Romanenko
|
|
6
6
|
License: MIT
|
|
@@ -16,7 +16,7 @@ Requires-Dist: pillow<14,>=10
|
|
|
16
16
|
Requires-Dist: whitenoise<7,>=6
|
|
17
17
|
Requires-Dist: zeroconf<1,>=0.140
|
|
18
18
|
Requires-Dist: ifaddr<1,>=0.2
|
|
19
|
-
Requires-Dist: bmdwire<2,>=1.
|
|
19
|
+
Requires-Dist: bmdwire<2,>=1.12
|
|
20
20
|
Provides-Extra: desktop
|
|
21
21
|
Requires-Dist: pystray<1,>=0.19; extra == "desktop"
|
|
22
22
|
Requires-Dist: pywebview<7,>=6; extra == "desktop"
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
1
3
|
from django.apps import AppConfig
|
|
2
4
|
|
|
5
|
+
# Threads in this process take turns with the GIL at least this often (the
|
|
6
|
+
# interpreter's default is 5 ms). Every switcher session's UDP thread has to
|
|
7
|
+
# read and acknowledge its packets within milliseconds while other threads
|
|
8
|
+
# work (a still being decoded, a page being rendered): a switcher resends
|
|
9
|
+
# what it hasn't had acknowledged after ~80 ms, and a 4K still comes at line
|
|
10
|
+
# rate. With 5 ms turns an offline replay of a 4K Plus download beside one
|
|
11
|
+
# busy pure-Python thread never finished; with 1 ms it took 11 s
|
|
12
|
+
# (2026-11-04).
|
|
13
|
+
GIL_SWITCH_INTERVAL = 0.001
|
|
14
|
+
|
|
3
15
|
|
|
4
16
|
class AtemControlConfig(AppConfig):
|
|
5
17
|
default_auto_field = 'django.db.models.BigAutoField'
|
|
@@ -12,6 +24,8 @@ class AtemControlConfig(AppConfig):
|
|
|
12
24
|
label = 'webatem_atem'
|
|
13
25
|
|
|
14
26
|
def ready(self):
|
|
27
|
+
if sys.getswitchinterval() > GIL_SWITCH_INTERVAL:
|
|
28
|
+
sys.setswitchinterval(GIL_SWITCH_INTERVAL)
|
|
15
29
|
# Register the Channels bridge with the media_pool sub-package's
|
|
16
30
|
# on_watcher_created hook. Must happen before any watcher.acquire()
|
|
17
31
|
# call — importing the module runs its top-level on_watcher_created()
|
|
@@ -20,6 +20,7 @@ from atemwire.messages.audio_legacy import enable_audio_levels
|
|
|
20
20
|
from atemwire.messages.fairlight import enable_fairlight_levels
|
|
21
21
|
from atemwire.messages.system_info import device_name
|
|
22
22
|
from atemwire.pool import ATEMInstanceManager
|
|
23
|
+
from atemwire.transport import NoFreeConnection
|
|
23
24
|
from atem_control.control.commands import dispatch as dispatch_command
|
|
24
25
|
from atem_control.control.logging import ATEMConnectionLoggingMixin
|
|
25
26
|
from atem_control import hooks
|
|
@@ -53,6 +54,16 @@ def active_control_sessions() -> dict:
|
|
|
53
54
|
return {ip: list(users) for ip, users in _control_sessions.items() if users}
|
|
54
55
|
|
|
55
56
|
|
|
57
|
+
# A connect gives up after 5 s with nothing from the switcher (bmdwire's
|
|
58
|
+
# no-progress connect, CONNECT_STALL_TIMEOUT) and fails at once when the
|
|
59
|
+
# switcher has no free connection. Two tries keep a silent switcher under the
|
|
60
|
+
# connect page's 15 s, which itself restarts on every progress message.
|
|
61
|
+
CONNECT_ATTEMPTS = 2
|
|
62
|
+
CONNECT_PROGRESS_EVERY = 0.5 # s between "Connecting…" updates to the page
|
|
63
|
+
NO_FREE_CONNECTION_MESSAGE = ('No free connection on this switcher (ATEM Software Control, '
|
|
64
|
+
'panels or other clients are using all its slots)')
|
|
65
|
+
|
|
66
|
+
|
|
56
67
|
class ATEMConsumer(ATEMConnectionLoggingMixin, ATEMStateMixin, AsyncWebsocketConsumer):
|
|
57
68
|
"""
|
|
58
69
|
WebSocket consumer for ATEM switcher control.
|
|
@@ -509,29 +520,39 @@ class ATEMConsumer(ATEMConnectionLoggingMixin, ATEMStateMixin, AsyncWebsocketCon
|
|
|
509
520
|
await sync_to_async(self._acquire_pool_ref, thread_sensitive=False)(ip_address)
|
|
510
521
|
|
|
511
522
|
success = False
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
523
|
+
refused = False
|
|
524
|
+
progress = asyncio.ensure_future(self._send_connect_progress())
|
|
525
|
+
try:
|
|
526
|
+
for attempt in range(CONNECT_ATTEMPTS):
|
|
527
|
+
logger.info(f"Consumer: Connection attempt {attempt + 1}/{CONNECT_ATTEMPTS} to {ip_address}")
|
|
528
|
+
try:
|
|
529
|
+
# thread_sensitive=False: connect() blocks while the
|
|
530
|
+
# switcher answers (and up to 5 s when it doesn't).
|
|
531
|
+
# Channels consumers share ONE process-wide
|
|
532
|
+
# thread-sensitive executor, so on the default a slow/dead-IP
|
|
533
|
+
# connect stalls every operator's commands and state polls on
|
|
534
|
+
# every ATEM for the duration. connect() is thread-safe (own
|
|
535
|
+
# _lifecycle_lock, no ORM/thread-local state).
|
|
536
|
+
success = await sync_to_async(
|
|
537
|
+
self.connection.connect, thread_sensitive=False
|
|
538
|
+
)(ip_address)
|
|
539
|
+
except NoFreeConnection:
|
|
540
|
+
success, refused = False, True
|
|
541
|
+
except Exception as e:
|
|
542
|
+
logger.error(f"Consumer: Attempt {attempt + 1} exception: {e}", exc_info=True)
|
|
543
|
+
success = False
|
|
544
|
+
|
|
545
|
+
if success:
|
|
546
|
+
break
|
|
547
|
+
if refused or getattr(self.connection, 'connect_refused', False):
|
|
548
|
+
# asking again at once gets the same answer
|
|
549
|
+
refused = True
|
|
550
|
+
break
|
|
551
|
+
if attempt < CONNECT_ATTEMPTS - 1:
|
|
552
|
+
logger.info(f"Consumer: Attempt {attempt + 1} failed, trying once more")
|
|
553
|
+
await asyncio.sleep(0.5)
|
|
554
|
+
finally:
|
|
555
|
+
progress.cancel()
|
|
535
556
|
|
|
536
557
|
if success:
|
|
537
558
|
# The host's name for the switcher first (one lookup per
|
|
@@ -579,6 +600,13 @@ class ATEMConsumer(ATEMConnectionLoggingMixin, ATEMStateMixin, AsyncWebsocketCon
|
|
|
579
600
|
await asyncio.sleep(1.0)
|
|
580
601
|
await self.start_monitoring()
|
|
581
602
|
|
|
603
|
+
elif refused:
|
|
604
|
+
await self.send_json({
|
|
605
|
+
'type': 'connection_status',
|
|
606
|
+
'connected': False,
|
|
607
|
+
'no_free_connection': True,
|
|
608
|
+
'message': NO_FREE_CONNECTION_MESSAGE,
|
|
609
|
+
})
|
|
582
610
|
else:
|
|
583
611
|
await self.send_json({
|
|
584
612
|
'type': 'connection_status',
|
|
@@ -586,6 +614,23 @@ class ATEMConsumer(ATEMConnectionLoggingMixin, ATEMStateMixin, AsyncWebsocketCon
|
|
|
586
614
|
'message': f'Failed to connect to ATEM at {ip_address}'
|
|
587
615
|
})
|
|
588
616
|
|
|
617
|
+
async def _send_connect_progress(self):
|
|
618
|
+
"""While a connect runs: tell the page how far it has got, so it
|
|
619
|
+
can say so and keep waiting while the switcher's state arrives."""
|
|
620
|
+
words = {'hello': 'Connecting… waiting for the switcher to answer',
|
|
621
|
+
'state': 'Connecting… receiving switcher state'}
|
|
622
|
+
try:
|
|
623
|
+
while True:
|
|
624
|
+
await asyncio.sleep(CONNECT_PROGRESS_EVERY)
|
|
625
|
+
conn = self.connection
|
|
626
|
+
p = conn.connect_progress() if hasattr(conn, 'connect_progress') else None
|
|
627
|
+
if not p or p['stage'] not in words:
|
|
628
|
+
continue
|
|
629
|
+
await self._safe_send_json({'type': 'connection_progress', 'stage': p['stage'],
|
|
630
|
+
'packets': p['packets'], 'message': words[p['stage']]})
|
|
631
|
+
except asyncio.CancelledError:
|
|
632
|
+
pass
|
|
633
|
+
|
|
589
634
|
async def handle_disconnect(self):
|
|
590
635
|
"""Handle user-initiated disconnection."""
|
|
591
636
|
await self._perform_disconnect(reason='user_requested')
|
|
@@ -71,6 +71,7 @@ Upload-lockout pattern (2026-07-02 semantics):
|
|
|
71
71
|
import base64
|
|
72
72
|
import io
|
|
73
73
|
import logging
|
|
74
|
+
import inspect
|
|
74
75
|
import queue
|
|
75
76
|
import threading
|
|
76
77
|
import time
|
|
@@ -112,11 +113,18 @@ _TASK_DECODE = 'decode'
|
|
|
112
113
|
_TASK_DOWNLOAD = 'download'
|
|
113
114
|
_TASK_STOP = 'stop'
|
|
114
115
|
|
|
115
|
-
# Per-slot download
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
#
|
|
119
|
-
|
|
116
|
+
# Per-slot download limits (native interleaved transfer). A download gives
|
|
117
|
+
# up after DOWNLOAD_STALL_TIMEOUT with no data arriving (waiting for the
|
|
118
|
+
# lock counts as no data) and after DOWNLOAD_MAX_SECONDS in all. A 1080p
|
|
119
|
+
# still is ~2 s on a LAN, but a 4K one is 12 MB or more on the wire and an
|
|
120
|
+
# 8K one four times that: the old fixed 15 s cut a 4K Plus's first still
|
|
121
|
+
# off mid-stream every time, and the release of the store lock that came
|
|
122
|
+
# with it left the switcher's transfer engine refusing every request after
|
|
123
|
+
# (a 4K Plus, 2026-11-04). bmdwire before 1.11 has no stall timeout; the
|
|
124
|
+
# download then gets DOWNLOAD_TIMEOUT, as it always did.
|
|
125
|
+
DOWNLOAD_STALL_TIMEOUT = 15.0
|
|
126
|
+
DOWNLOAD_MAX_SECONDS = 240.0
|
|
127
|
+
DOWNLOAD_TIMEOUT = DOWNLOAD_STALL_TIMEOUT
|
|
120
128
|
|
|
121
129
|
# A failed download is NEVER dropped (changed 2026-07-03): while the watcher
|
|
122
130
|
# is alive and the slot still needs its thumb, the task re-queues itself
|
|
@@ -136,6 +144,11 @@ DOWNLOAD_TIMEOUT = 15.0
|
|
|
136
144
|
# the store is free, and the thumb arrives as soon as it is.
|
|
137
145
|
DOWNLOAD_RETRY_BACKOFF = 2.0
|
|
138
146
|
DOWNLOAD_RETRY_BACKOFF_MAX = 30.0
|
|
147
|
+
# A retry's pause never holds up the other slots: with other tasks queued it
|
|
148
|
+
# goes to the back of the queue, and alone it waits at most this long at a
|
|
149
|
+
# time before looking again, so a still that arrives meanwhile isn't stuck
|
|
150
|
+
# behind a slot that keeps failing.
|
|
151
|
+
DOWNLOAD_RETRY_IDLE_STEP = 2.0
|
|
139
152
|
# What the operator is told. Previews that have waited this long for
|
|
140
153
|
# another client's turn show the media pool's waiting notice (ATEM Software
|
|
141
154
|
# Control loading its thumbnails takes ~40 s for 20 stills, so a normal turn
|
|
@@ -234,6 +247,14 @@ def _thumb_from_png(png: bytes) -> Optional[str]:
|
|
|
234
247
|
return 'data:image/jpeg;base64,' + base64.b64encode(thumb_bytes).decode('ascii')
|
|
235
248
|
|
|
236
249
|
|
|
250
|
+
def _takes_stall_timeout(download_still) -> bool:
|
|
251
|
+
"""Whether this bmdwire's download_still has ``stall_timeout`` (1.11)."""
|
|
252
|
+
try:
|
|
253
|
+
return 'stall_timeout' in inspect.signature(download_still).parameters
|
|
254
|
+
except (TypeError, ValueError):
|
|
255
|
+
return False
|
|
256
|
+
|
|
257
|
+
|
|
237
258
|
def _empty_slot(idx: int) -> dict:
|
|
238
259
|
return {'index': idx, 'isUsed': False, 'hash': '', 'fileName': '', 'thumb': None,
|
|
239
260
|
'previewFailed': False}
|
|
@@ -285,6 +306,8 @@ class MediaPoolWatcher:
|
|
|
285
306
|
self._waiting_since: Optional[float] = None
|
|
286
307
|
self._preview_waiting = False
|
|
287
308
|
self._failing_since: Dict[int, float] = {}
|
|
309
|
+
# slot -> when its next download may start, after a failure's pause.
|
|
310
|
+
self._retry_due: Dict[int, float] = {}
|
|
288
311
|
|
|
289
312
|
# The SHARED pooled connection this watcher rides (binder-owned).
|
|
290
313
|
# _pool_instance is the pool entry dict, kept for the identity-
|
|
@@ -363,6 +386,7 @@ class MediaPoolWatcher:
|
|
|
363
386
|
# ones here would suppress every fresh enqueue.
|
|
364
387
|
self._work_queue = queue.Queue()
|
|
365
388
|
self._pending_downloads.clear()
|
|
389
|
+
self._retry_due.clear()
|
|
366
390
|
self._worker_thread = threading.Thread(
|
|
367
391
|
target=self._run_worker,
|
|
368
392
|
daemon=True,
|
|
@@ -1187,9 +1211,24 @@ class MediaPoolWatcher:
|
|
|
1187
1211
|
# anyway, and the recheck above retires the task the moment it
|
|
1188
1212
|
# stops being needed.) One that only waited its turn goes at once.
|
|
1189
1213
|
if attempt > 1 and not waited:
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1214
|
+
now = time.monotonic()
|
|
1215
|
+
with self._state_lock:
|
|
1216
|
+
due = self._retry_due.pop(slot_idx, None)
|
|
1217
|
+
if due is None:
|
|
1218
|
+
due = now + min(DOWNLOAD_RETRY_BACKOFF * (attempt - 1),
|
|
1219
|
+
DOWNLOAD_RETRY_BACKOFF_MAX)
|
|
1220
|
+
remaining = due - now
|
|
1221
|
+
if remaining > 0:
|
|
1222
|
+
if not self._work_queue.empty():
|
|
1223
|
+
# Others are waiting: they go first, this one after.
|
|
1224
|
+
return self._retry_later(slot_idx, expected_hash, attempt,
|
|
1225
|
+
waited, due)
|
|
1226
|
+
step = min(remaining, DOWNLOAD_RETRY_IDLE_STEP)
|
|
1227
|
+
if self._stop_event.wait(step):
|
|
1228
|
+
return False
|
|
1229
|
+
if step < remaining:
|
|
1230
|
+
return self._retry_later(slot_idx, expected_hash, attempt,
|
|
1231
|
+
waited, due)
|
|
1193
1232
|
|
|
1194
1233
|
# Failures re-queue the whole task FOREVER (capped backoff) while
|
|
1195
1234
|
# the slot still needs its thumb — settled content gets no further
|
|
@@ -1206,8 +1245,13 @@ class MediaPoolWatcher:
|
|
|
1206
1245
|
failure = 'pooled connection not ready'
|
|
1207
1246
|
else:
|
|
1208
1247
|
try:
|
|
1209
|
-
|
|
1210
|
-
|
|
1248
|
+
if _takes_stall_timeout(conn.download_still):
|
|
1249
|
+
raw_ycbcr = conn.download_still(
|
|
1250
|
+
slot_idx, timeout=DOWNLOAD_MAX_SECONDS,
|
|
1251
|
+
stall_timeout=DOWNLOAD_STALL_TIMEOUT)
|
|
1252
|
+
else:
|
|
1253
|
+
raw_ycbcr = conn.download_still(
|
|
1254
|
+
slot_idx, timeout=DOWNLOAD_TIMEOUT)
|
|
1211
1255
|
except Exception as e:
|
|
1212
1256
|
failure = str(e)
|
|
1213
1257
|
if raw_ycbcr is None:
|
|
@@ -1238,6 +1282,11 @@ class MediaPoolWatcher:
|
|
|
1238
1282
|
f"{slot_idx} failed (attempt {attempt}): {failure} "
|
|
1239
1283
|
f"— will keep retrying while the slot needs it"
|
|
1240
1284
|
)
|
|
1285
|
+
if not turn:
|
|
1286
|
+
with self._state_lock:
|
|
1287
|
+
self._retry_due[slot_idx] = time.monotonic() + min(
|
|
1288
|
+
DOWNLOAD_RETRY_BACKOFF * attempt,
|
|
1289
|
+
DOWNLOAD_RETRY_BACKOFF_MAX)
|
|
1241
1290
|
try:
|
|
1242
1291
|
self._work_queue.put_nowait(
|
|
1243
1292
|
(_TASK_DOWNLOAD, slot_idx, expected_hash, attempt + 1,
|
|
@@ -1262,6 +1311,19 @@ class MediaPoolWatcher:
|
|
|
1262
1311
|
self._do_decode(slot_idx, raw_ycbcr, expected_hash, w, h)
|
|
1263
1312
|
return False
|
|
1264
1313
|
|
|
1314
|
+
def _retry_later(self, slot_idx: int, expected_hash: str, attempt: int,
|
|
1315
|
+
waited: bool, due: float) -> bool:
|
|
1316
|
+
"""Put a retry whose pause isn't over at the back of the queue, its
|
|
1317
|
+
claim kept. True iff it was queued."""
|
|
1318
|
+
with self._state_lock:
|
|
1319
|
+
self._retry_due[slot_idx] = due
|
|
1320
|
+
try:
|
|
1321
|
+
self._work_queue.put_nowait(
|
|
1322
|
+
(_TASK_DOWNLOAD, slot_idx, expected_hash, attempt, waited))
|
|
1323
|
+
except Exception:
|
|
1324
|
+
return False
|
|
1325
|
+
return True
|
|
1326
|
+
|
|
1265
1327
|
def _do_decode(self, slot_idx: int, raw: bytes, expected_hash: str, w: int, h: int):
|
|
1266
1328
|
if not raw:
|
|
1267
1329
|
return
|
|
@@ -202,18 +202,25 @@
|
|
|
202
202
|
setLoading(true);
|
|
203
203
|
hideStatus();
|
|
204
204
|
|
|
205
|
-
//
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
205
|
+
// Give up after 15 s with no word from the server. Every progress
|
|
206
|
+
// message ("receiving switcher state") starts the 15 s again, so a
|
|
207
|
+
// big switcher on a slow network is waited for while it answers.
|
|
208
|
+
var connectionTimeout = null;
|
|
209
|
+
function armTimeout() {
|
|
210
|
+
clearTimeout(connectionTimeout);
|
|
211
|
+
connectionTimeout = setTimeout(function () {
|
|
212
|
+
if (connectionAttempting) {
|
|
213
|
+
showStatus('Connection timeout - please check IP address and try again', 'error');
|
|
214
|
+
setLoading(false);
|
|
215
|
+
connectionAttempting = false;
|
|
216
|
+
if (ws) {
|
|
217
|
+
ws.close();
|
|
218
|
+
ws = null;
|
|
219
|
+
}
|
|
214
220
|
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
221
|
+
}, 15000);
|
|
222
|
+
}
|
|
223
|
+
armTimeout();
|
|
217
224
|
|
|
218
225
|
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
219
226
|
var wsUrl = protocol + '//' + window.location.host + '/ws/atem/';
|
|
@@ -233,7 +240,10 @@
|
|
|
233
240
|
try {
|
|
234
241
|
var data = JSON.parse(event.data);
|
|
235
242
|
|
|
236
|
-
if (data.type === '
|
|
243
|
+
if (data.type === 'connection_progress') {
|
|
244
|
+
armTimeout();
|
|
245
|
+
if (!waitingForState) setLoadingText(data.message || 'Connecting...');
|
|
246
|
+
} else if (data.type === 'connection_status') {
|
|
237
247
|
if (data.connected) {
|
|
238
248
|
// ATEM connected, now request initial state
|
|
239
249
|
waitingForState = true;
|
|
@@ -249,7 +259,9 @@
|
|
|
249
259
|
setLoading(false);
|
|
250
260
|
|
|
251
261
|
var errorMsg = data.message || 'Failed to connect to ATEM';
|
|
252
|
-
if (
|
|
262
|
+
if (data.no_free_connection) {
|
|
263
|
+
// said as the server says it: the switcher is there, and full
|
|
264
|
+
} else if (errorMsg.includes('timeout')) {
|
|
253
265
|
errorMsg = 'ATEM connection timeout - check IP address';
|
|
254
266
|
} else if (errorMsg.includes('refused') || errorMsg.includes('failed')) {
|
|
255
267
|
errorMsg = 'Cannot reach ATEM - check IP address and network';
|
|
@@ -1440,6 +1440,9 @@
|
|
|
1440
1440
|
handleMessage(data) {
|
|
1441
1441
|
const alpineInstance = Alpine.store("atem");
|
|
1442
1442
|
switch (data.type) {
|
|
1443
|
+
case "connection_progress":
|
|
1444
|
+
if (!alpineInstance.connected) alpineInstance.statusText = data.message;
|
|
1445
|
+
break;
|
|
1443
1446
|
case "connection_status":
|
|
1444
1447
|
if (!data.connected && data.reconnecting && alpineInstance.stateReady) {
|
|
1445
1448
|
alpineInstance.switcherAway = true;
|
|
@@ -48,6 +48,7 @@ from typing import Callable, List, Optional
|
|
|
48
48
|
from PIL import Image, UnidentifiedImageError
|
|
49
49
|
from PIL.Image import DecompressionBombError
|
|
50
50
|
from atemwire.protocol import AtemProtocol
|
|
51
|
+
from atemwire.transport import NoFreeConnection
|
|
51
52
|
from atemwire.imaging import atem_to_rgb, rgb_to_atem
|
|
52
53
|
from atemwire.ready import wait_ready
|
|
53
54
|
|
|
@@ -59,6 +60,14 @@ logger = logging.getLogger(__name__)
|
|
|
59
60
|
# ---------------------------------------------------------------------------
|
|
60
61
|
|
|
61
62
|
CONNECTION_TIMEOUT = 15.0
|
|
63
|
+
# A connect attempt waits while the switcher keeps sending its state and
|
|
64
|
+
# gives up after this long with nothing from it (bmdwire's no-progress
|
|
65
|
+
# connect), within CONNECT_MAX. A switcher with no free connection answers
|
|
66
|
+
# "no room" at once and the job fails with that reason, without retrying.
|
|
67
|
+
CONNECT_STALL_TIMEOUT = 5.0
|
|
68
|
+
CONNECT_MAX = 60.0
|
|
69
|
+
NO_FREE_CONNECTION_ERROR = ('No free connection on this switcher (ATEM Software Control, '
|
|
70
|
+
'panels or other clients are using all its slots)')
|
|
62
71
|
# Connect attempts per batch (parity with the control page's 3-attempt
|
|
63
72
|
# pool connect; this path used to give up after one timeout, failing
|
|
64
73
|
# jobs a moment's switcher busyness would otherwise have survived).
|
|
@@ -718,6 +727,7 @@ def _run_for_single_ip(ip_address: str,
|
|
|
718
727
|
# Each attempt uses a fresh protocol/socket; a half-open attempt is
|
|
719
728
|
# closed (close_session no-ops below ESTABLISHED).
|
|
720
729
|
protocol = None
|
|
730
|
+
refused = False
|
|
721
731
|
t_connect = time.time()
|
|
722
732
|
for attempt in range(1, CONNECT_ATTEMPTS + 1):
|
|
723
733
|
# aggressive_drain=True: whole-queue drain per queue_trigger on a
|
|
@@ -727,9 +737,15 @@ def _run_for_single_ip(ip_address: str,
|
|
|
727
737
|
candidate.connect()
|
|
728
738
|
try:
|
|
729
739
|
# Preserves the original 0.005s pump interval from this site.
|
|
730
|
-
wait_ready(candidate, timeout=
|
|
740
|
+
wait_ready(candidate, timeout=CONNECT_MAX, stall_timeout=CONNECT_STALL_TIMEOUT,
|
|
741
|
+
pump_interval=0.005)
|
|
731
742
|
protocol = candidate
|
|
732
743
|
break
|
|
744
|
+
except NoFreeConnection:
|
|
745
|
+
_close_protocol(candidate)
|
|
746
|
+
log_append(f"{ip_address}: {NO_FREE_CONNECTION_ERROR}")
|
|
747
|
+
refused = True
|
|
748
|
+
break
|
|
733
749
|
except TimeoutError:
|
|
734
750
|
_close_protocol(candidate)
|
|
735
751
|
if attempt < CONNECT_ATTEMPTS:
|
|
@@ -741,7 +757,8 @@ def _run_for_single_ip(ip_address: str,
|
|
|
741
757
|
out.append(ItemResult(
|
|
742
758
|
slot=slot, image_path=image_path,
|
|
743
759
|
success=False,
|
|
744
|
-
error=
|
|
760
|
+
error=(NO_FREE_CONNECTION_ERROR if refused
|
|
761
|
+
else f"connection timeout ({CONNECT_ATTEMPTS} attempts)"),
|
|
745
762
|
))
|
|
746
763
|
return out
|
|
747
764
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "webatem"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.5.0"
|
|
8
8
|
description = "Browser-based control for Blackmagic ATEM switchers: run it, open the browser, your switchers are there"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -31,8 +31,9 @@ dependencies = [
|
|
|
31
31
|
# there should reach a WebATEM install without waiting for a WebATEM
|
|
32
32
|
# release, and this app only imports the packages' public surfaces,
|
|
33
33
|
# which 1.x will not break. An exact pin belongs in whatever DEPLOYS
|
|
34
|
-
# this (a lock file, or a host's own requirements), not here.
|
|
35
|
-
"
|
|
34
|
+
# this (a lock file, or a host's own requirements), not here. 1.12 is the
|
|
35
|
+
# floor: the connect's "no free connection" and no-progress timeout.
|
|
36
|
+
"bmdwire>=1.12,<2",
|
|
36
37
|
]
|
|
37
38
|
|
|
38
39
|
[project.optional-dependencies]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: webatem
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Browser-based control for Blackmagic ATEM switchers: run it, open the browser, your switchers are there
|
|
5
5
|
Author: Lucas Romanenko
|
|
6
6
|
License: MIT
|
|
@@ -16,7 +16,7 @@ Requires-Dist: pillow<14,>=10
|
|
|
16
16
|
Requires-Dist: whitenoise<7,>=6
|
|
17
17
|
Requires-Dist: zeroconf<1,>=0.140
|
|
18
18
|
Requires-Dist: ifaddr<1,>=0.2
|
|
19
|
-
Requires-Dist: bmdwire<2,>=1.
|
|
19
|
+
Requires-Dist: bmdwire<2,>=1.12
|
|
20
20
|
Provides-Extra: desktop
|
|
21
21
|
Requires-Dist: pystray<1,>=0.19; extra == "desktop"
|
|
22
22
|
Requires-Dist: pywebview<7,>=6; extra == "desktop"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-400-latin-ext.woff2
RENAMED
|
File without changes
|
|
File without changes
|
{webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-500-latin-ext.woff2
RENAMED
|
File without changes
|
|
File without changes
|
{webatem-2.4.0 → webatem-2.5.0}/atem_control/static/brand/fonts/IBMPlexMono-600-latin-ext.woff2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{webatem-2.4.0 → webatem-2.5.0}/atem_control/static/vendor/bootstrap-icons/bootstrap-icons.min.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|