vsview-remote 0.1.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.
@@ -0,0 +1,227 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ /build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ wheelhouse/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # Redis
136
+ *.rdb
137
+ *.aof
138
+ *.pid
139
+
140
+ # RabbitMQ
141
+ mnesia/
142
+ rabbitmq/
143
+ rabbitmq-data/
144
+
145
+ # ActiveMQ
146
+ activemq-data/
147
+
148
+ # SageMath parsed files
149
+ *.sage.py
150
+
151
+ # Environments
152
+ .env
153
+ .envrc
154
+ .venv
155
+ env/
156
+ venv/
157
+ ENV/
158
+ env.bak/
159
+ venv.bak/
160
+
161
+ # Spyder project settings
162
+ .spyderproject
163
+ .spyproject
164
+
165
+ # Rope project settings
166
+ .ropeproject
167
+
168
+ # mkdocs documentation
169
+ /site
170
+
171
+ # mypy
172
+ .mypy_cache/
173
+ .dmypy.json
174
+ dmypy.json
175
+
176
+ # Pyre type checker
177
+ .pyre/
178
+
179
+ # pytype static type analyzer
180
+ .pytype/
181
+
182
+ # Cython debug symbols
183
+ cython_debug/
184
+
185
+ # PyCharm
186
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
187
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
188
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
189
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
190
+ # .idea/
191
+
192
+ # Abstra
193
+ # Abstra is an AI-powered process automation framework.
194
+ # Ignore directories containing user credentials, local state, and settings.
195
+ # Learn more at https://abstra.io/docs
196
+ .abstra/
197
+
198
+ # Visual Studio Code
199
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
200
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
201
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
202
+ # you could uncomment the following to ignore the entire vscode folder
203
+ # .vscode/
204
+
205
+ # Ruff stuff:
206
+ .ruff_cache/
207
+
208
+ # PyPI configuration file
209
+ .pypirc
210
+
211
+ # Marimo
212
+ marimo/_static/
213
+ marimo/_lsp/
214
+ __marimo__/
215
+
216
+ # Streamlit
217
+ .streamlit/secrets.toml
218
+
219
+ # vsjet
220
+ .vsjet/
221
+
222
+ # VapourSynth inventory files
223
+ vs_objects.inv
224
+ vs_fixed.inv
225
+
226
+ # Doc workraws
227
+ docs/assets/raws
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jaded Encoding Thaumaturgy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.5
2
+ Name: vsview-remote
3
+ Version: 0.1.0
4
+ Summary: A VSView plugin that provides remote execution for VapourSynth, leveraging the vsremote library.
5
+ Author-email: Vardë <ichunjo.le.terrible@gmail.com>
6
+ Maintainer-email: Vardë <ichunjo.le.terrible@gmail.com>, Jaded Encoding Thaumaturgy <jaded.encoding.thaumaturgy@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.12
16
+ Requires-Dist: vsremote>=0.3.0
17
+ Requires-Dist: vsview[secrets]>=0.11.0
18
+ Description-Content-Type: text/markdown
19
+
20
+ # VSView Remote
21
+
22
+ A [VSView](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view) plugin that provides remote execution for VapourSynth, leveraging the [vsremote](https://github.com/Ichunjo/vs-remote) library.
23
+
24
+ ## Documentation
25
+
26
+ Usage and configuration details are available in the [documentation](https://jaded-encoding-thaumaturgy.github.io/vs-view/usage/workspaces/remote/).
@@ -0,0 +1,7 @@
1
+ # VSView Remote
2
+
3
+ A [VSView](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view) plugin that provides remote execution for VapourSynth, leveraging the [vsremote](https://github.com/Ichunjo/vs-remote) library.
4
+
5
+ ## Documentation
6
+
7
+ Usage and configuration details are available in the [documentation](https://jaded-encoding-thaumaturgy.github.io/vs-view/usage/workspaces/remote/).
@@ -0,0 +1,47 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.32.0", "versioningit"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vsview-remote"
7
+ description = "A VSView plugin that provides remote execution for VapourSynth, leveraging the vsremote library."
8
+ readme = "README.md"
9
+ license = "MIT"
10
+ license-files = ["LICENSE"]
11
+ requires-python = ">=3.12"
12
+ authors = [{ name = "Vardë", email = "ichunjo.le.terrible@gmail.com" }]
13
+ maintainers = [
14
+ { name = "Vardë", email = "ichunjo.le.terrible@gmail.com" },
15
+ { name = "Jaded Encoding Thaumaturgy", email = "jaded.encoding.thaumaturgy@gmail.com" },
16
+ ]
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Operating System :: OS Independent",
23
+ "Typing :: Typed",
24
+ ]
25
+ dependencies = ["vsview[secrets]>=0.11.0", "vsremote>=0.3.0"]
26
+ dynamic = ["version"]
27
+
28
+ [project.entry-points.vsview]
29
+ vsview_remote = "vsview_remote"
30
+
31
+ [tool.hatch.version]
32
+ source = "versioningit"
33
+
34
+ [tool.versioningit.vcs]
35
+ match = ["remote/v*"]
36
+ default-tag = "remote/v0.0.0"
37
+
38
+ [tool.versioningit.tag2version]
39
+ rmprefix = "remote/v"
40
+
41
+ [tool.versioningit.format]
42
+ distance = "{next_version}.dev{distance}+{vcs}{rev}"
43
+ dirty = "{next_version}+dirty"
44
+ distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.dirty"
45
+
46
+ [tool.uv.sources]
47
+ vsview = { workspace = true }
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from vsview.api import hookimpl
6
+ from vsview.api.workspace import PluginBaseWorkspace
7
+
8
+ from .workspace import RemoteWorkspace
9
+
10
+
11
+ @hookimpl
12
+ def vsview_register_workspace() -> type[PluginBaseWorkspace[Any, Any]]:
13
+ return RemoteWorkspace
@@ -0,0 +1,6 @@
1
+ WORKSPACE_ID = "jet_vsview_remote"
2
+
3
+ AUTH_CONTEXT = "auth"
4
+ AUTH_KEY = "token"
5
+ CURVE_CONTEXT = "curve"
6
+ CURVE_KEY = "secret_key"
@@ -0,0 +1,262 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ from typing import Any, Literal, NamedTuple, cast, override
5
+
6
+ from PySide6.QtCore import Qt, Slot
7
+ from PySide6.QtWidgets import (
8
+ QCheckBox,
9
+ QComboBox,
10
+ QDialog,
11
+ QDialogButtonBox,
12
+ QFormLayout,
13
+ QFrame,
14
+ QHBoxLayout,
15
+ QLabel,
16
+ QLineEdit,
17
+ QPushButton,
18
+ QSpinBox,
19
+ QVBoxLayout,
20
+ QWidget,
21
+ )
22
+ from vsengine import UnifiedFuture
23
+ from vsremote import RemoteAuthenticationError, RemoteClient, RemoteTimeoutError, TransportError, VSRemoteError
24
+
25
+ from vsview.api import CustomSpinBox, PluginSecrets, PluginSettings, run_in_background, run_in_loop
26
+
27
+ from ._metadata import AUTH_CONTEXT, AUTH_KEY, CURVE_CONTEXT, CURVE_KEY
28
+ from .settings import GlobalSettings
29
+
30
+ logger = logging.getLogger(__name__)
31
+
32
+
33
+ class RemoteConnectionDialog(QDialog):
34
+ def __init__(self, parent: QWidget, settings: PluginSettings[GlobalSettings], secrets: PluginSecrets) -> None:
35
+ super().__init__(parent)
36
+
37
+ self.setWindowTitle("VSRemote Connection")
38
+ self.setMinimumWidth(500)
39
+ self.setModal(True)
40
+
41
+ self.settings = settings
42
+ self.secrets = secrets
43
+ self._ping_worker: UnifiedFuture[None] | None = None
44
+
45
+ main_layout = QVBoxLayout(self)
46
+ main_layout.setSpacing(8)
47
+ main_layout.setContentsMargins(12, 12, 12, 12)
48
+
49
+ main_layout.addWidget(QLabel("Configure connection details", self, wordWrap=True))
50
+
51
+ # Connection parameters form
52
+ form_frame = QFrame(self, frameShape=QFrame.Shape.StyledPanel)
53
+ form_layout = QFormLayout(form_frame)
54
+ form_layout.setContentsMargins(10, 10, 10, 10)
55
+ form_layout.setSpacing(8)
56
+ form_layout.setLabelAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter)
57
+
58
+ self.address_edit = QLineEdit(form_frame, text=self.settings.global_.address)
59
+ self.token_edit = QLineEdit(
60
+ form_frame,
61
+ echoMode=QLineEdit.EchoMode.PasswordEchoOnEdit,
62
+ placeholderText="Optional authentication token",
63
+ )
64
+ self.token_edit.setText(self.auth_token or "")
65
+
66
+ self.compression_combo = QComboBox(form_frame)
67
+ self.compression_combo.addItems(["zstd", "none"])
68
+ self.compression_combo.setCurrentText(self.settings.global_.compression)
69
+
70
+ self.prefetch_spin = QSpinBox(form_frame, minimum=0, maximum=64, value=self.settings.global_.prefetch)
71
+ self.prefetch_spin.setToolTip("Number of frames to prefetch ahead of time (0 to disable)")
72
+
73
+ self.backlog_spin = CustomSpinBox(form_frame, min_text="Default")
74
+ self.backlog_spin.setRange(0, 128)
75
+ self.backlog_spin.setValue(self.settings.global_.backlog or 0)
76
+ self.backlog_spin.setToolTip("Maximum buffer of in-flight and prefetched frames")
77
+
78
+ self.forward_logs_cb = QCheckBox(form_frame)
79
+ self.forward_logs_cb.setChecked(self.settings.global_.forward_logs)
80
+ self.subscribe_streams_cb = QCheckBox(form_frame)
81
+ self.subscribe_streams_cb.setChecked(self.settings.global_.subscribe_streams)
82
+
83
+ form_layout.addRow("Host", self.address_edit)
84
+ form_layout.addRow("Auth Token", self.token_edit)
85
+ form_layout.addRow("Compression", self.compression_combo)
86
+ form_layout.addRow("Prefetch Frames", self.prefetch_spin)
87
+ form_layout.addRow("Backlog Buffer", self.backlog_spin)
88
+ form_layout.addRow("Forward remote server log records", self.forward_logs_cb)
89
+ form_layout.addRow("Subscribe remote stdout / stderr streams", self.subscribe_streams_cb)
90
+ main_layout.addWidget(form_frame)
91
+
92
+ # CurveZMQ Encryption Section
93
+ form_frame2 = QFrame(self, frameShape=QFrame.Shape.StyledPanel)
94
+ form_layout2 = QFormLayout(form_frame2)
95
+ form_layout2.setContentsMargins(10, 10, 10, 10)
96
+ form_layout2.setSpacing(8)
97
+ form_layout2.setLabelAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter)
98
+
99
+ self.use_curve_cb = QCheckBox(form_frame2)
100
+ self.use_curve_cb.setChecked(
101
+ bool(
102
+ self.settings.global_.curve_server_key
103
+ or self.settings.global_.curve_public_key
104
+ or self.curve_secret_key
105
+ )
106
+ )
107
+ self.use_curve_cb.toggled.connect(self._on_curve_toggled)
108
+
109
+ self.curve_server_key_edit = QLineEdit(form_frame2, text=self.settings.global_.curve_server_key)
110
+ self.curve_server_key_edit.setPlaceholderText("Server public key (Z85 encoded)")
111
+
112
+ self.curve_public_key_edit = QLineEdit(form_frame2, text=self.settings.global_.curve_public_key)
113
+ self.curve_public_key_edit.setPlaceholderText("Client public key (optional)")
114
+
115
+ self.curve_secret_key_edit = QLineEdit(form_frame2, echoMode=QLineEdit.EchoMode.PasswordEchoOnEdit)
116
+ self.curve_secret_key_edit.setPlaceholderText("Client secret key (optional)")
117
+ self.curve_secret_key_edit.setText(self.curve_secret_key)
118
+ self._on_curve_toggled(self.use_curve_cb.isChecked())
119
+
120
+ form_layout2.addRow("Enable CurveZMQ end-to-end encryption", self.use_curve_cb)
121
+ form_layout2.addRow("Server key", self.curve_server_key_edit)
122
+ form_layout2.addRow("Client public key", self.curve_public_key_edit)
123
+ form_layout2.addRow("Client secret key", self.curve_secret_key_edit)
124
+ main_layout.addWidget(form_frame2)
125
+
126
+ # Test Connection Section
127
+ test_container = QWidget(self)
128
+ test_layout = QHBoxLayout(test_container)
129
+ test_layout.setContentsMargins(0, 4, 0, 4)
130
+ test_layout.setSpacing(8)
131
+
132
+ self.test_btn = QPushButton("Test Connection", test_container)
133
+ self.test_btn.clicked.connect(self._on_test_connection_clicked)
134
+ test_layout.addWidget(self.test_btn)
135
+
136
+ self.status_label = QLabel("", test_container)
137
+ self.status_label.setWordWrap(True)
138
+ test_layout.addWidget(self.status_label, stretch=1)
139
+ main_layout.addWidget(test_container)
140
+
141
+ # Dialog Buttons
142
+ self.button_box = QDialogButtonBox(
143
+ QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel, self
144
+ )
145
+ self.button_box.button(QDialogButtonBox.StandardButton.Ok).setText("Connect")
146
+ self.button_box.accepted.connect(self.accept)
147
+ self.button_box.rejected.connect(self.reject)
148
+ main_layout.addWidget(self.button_box)
149
+
150
+ @property
151
+ @run_in_loop(return_future=False)
152
+ def config(self) -> ConnectionConfig:
153
+ return ConnectionConfig(
154
+ address=self.address_edit.text().strip(),
155
+ auth_token=self.token_edit.text().strip() or None,
156
+ compression=cast(Literal["zstd", "none"], self.compression_combo.currentText()),
157
+ prefetch=self.prefetch_spin.value(),
158
+ backlog=self.backlog_spin.value() or None,
159
+ forward_logs=self.forward_logs_cb.isChecked(),
160
+ subscribe_streams=self.subscribe_streams_cb.isChecked(),
161
+ use_curve=(use_curve := self.use_curve_cb.isChecked()),
162
+ curve_server_key=self.curve_server_key_edit.text().strip() or None if use_curve else None,
163
+ curve_public_key=self.curve_public_key_edit.text().strip() or None if use_curve else None,
164
+ curve_secret_key=self.curve_secret_key_edit.text().strip() or None if use_curve else None,
165
+ )
166
+
167
+ @property
168
+ def auth_token(self) -> str | None:
169
+ return self.secrets.get(AUTH_CONTEXT, AUTH_KEY)
170
+
171
+ @property
172
+ def curve_secret_key(self) -> str | None:
173
+ return self.secrets.get(CURVE_CONTEXT, CURVE_KEY)
174
+
175
+ @override
176
+ def exec(self) -> int:
177
+ self.set_status()
178
+ res = super().exec()
179
+ if self._ping_worker:
180
+ logger.debug("Cancelling ping task")
181
+ self._ping_worker.cancel()
182
+ self._ping_worker = None
183
+ return res
184
+
185
+ def set_status(self, text: str = "", color: str = "", *, bold: bool = False) -> None:
186
+ style = f"color: {color};" if color else "color: palette(text);"
187
+ if bold:
188
+ style += " font-weight: bold;"
189
+ self.status_label.setStyleSheet(style)
190
+ self.status_label.setText(text)
191
+
192
+ @Slot(bool)
193
+ def _on_curve_toggled(self, checked: bool) -> None:
194
+ self.curve_server_key_edit.setEnabled(checked)
195
+ self.curve_public_key_edit.setEnabled(checked)
196
+ self.curve_secret_key_edit.setEnabled(checked)
197
+
198
+ @Slot()
199
+ def _on_test_connection_clicked(self) -> None:
200
+ self.set_status("Connecting...")
201
+ self.test_btn.setDisabled(True)
202
+ self.button_box.button(QDialogButtonBox.StandardButton.Ok).setDisabled(True)
203
+
204
+ def on_success(result: bool) -> None:
205
+ if result:
206
+ self.set_status("Connected successfully!", "#2ecc71", bold=True)
207
+ else:
208
+ self.set_status("Server did not respond to ping.", "#e74c3c")
209
+
210
+ def on_error(e: BaseException) -> None:
211
+ match e:
212
+ case RemoteAuthenticationError():
213
+ self.set_status("Authentication failed: invalid or missing auth token.", "#e74c3c")
214
+ case RemoteTimeoutError() | TimeoutError():
215
+ self.set_status("Connection timed out.", "#e74c3c")
216
+ case TransportError():
217
+ self.set_status(f"Transport error: {e}", "#e74c3c")
218
+ case VSRemoteError():
219
+ self.set_status(f"Remote error: {e}", "#e74c3c")
220
+ case _:
221
+ self.set_status(f"Connection failed: {e}", "#e74c3c")
222
+
223
+ def restore_state(*_: Any) -> None:
224
+ self.test_btn.setEnabled(True)
225
+ self.button_box.button(QDialogButtonBox.StandardButton.Ok).setEnabled(True)
226
+ self._ping_worker = None
227
+
228
+ self._ping_worker = (
229
+ self.ping()
230
+ .then(on_success, on_error, cancel_cb=restore_state, on_loop=True)
231
+ .add_loop_callback(restore_state)
232
+ )
233
+
234
+ @run_in_background(name="PingServer")
235
+ def ping(self) -> bool:
236
+ cfg = self.config
237
+
238
+ with RemoteClient(
239
+ cfg.address,
240
+ compression=cfg.compression,
241
+ auth_token=cfg.auth_token,
242
+ curve_server_key=cfg.curve_server_key,
243
+ curve_public_key=cfg.curve_public_key,
244
+ curve_secret_key=cfg.curve_secret_key,
245
+ subscribe_streams=False,
246
+ forward_logs=False,
247
+ ) as client:
248
+ return client.ping().result(timeout=5.0)
249
+
250
+
251
+ class ConnectionConfig(NamedTuple):
252
+ address: str
253
+ auth_token: str | None
254
+ compression: Literal["zstd", "none"]
255
+ prefetch: int
256
+ backlog: int | None
257
+ forward_logs: bool
258
+ subscribe_streams: bool
259
+ use_curve: bool
260
+ curve_server_key: str | None
261
+ curve_public_key: str | None
262
+ curve_secret_key: str | None
File without changes
@@ -0,0 +1,93 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Annotated, Literal
4
+
5
+ from pydantic import BaseModel
6
+
7
+ from vsview.api import Checkbox, Dropdown, LineEdit, SecretLineEdit, Spin
8
+
9
+ from ._metadata import AUTH_CONTEXT, AUTH_KEY, CURVE_CONTEXT, CURVE_KEY, WORKSPACE_ID
10
+
11
+
12
+ class GlobalSettings(BaseModel):
13
+ address: Annotated[str, LineEdit(label="Address", tooltip="Remote server address")] = "tcp://127.0.0.1:5555"
14
+ auth_token: Annotated[
15
+ str | None,
16
+ SecretLineEdit(
17
+ label="Auth Token",
18
+ namespace=WORKSPACE_ID,
19
+ context=AUTH_CONTEXT,
20
+ key=AUTH_KEY,
21
+ placeholder_text="Optional authentication token",
22
+ tooltip="Optional authentication token for the remote server",
23
+ ),
24
+ ] = None
25
+ compression: Annotated[
26
+ Literal["zstd", "none"],
27
+ Dropdown(
28
+ label="Compression",
29
+ items=[("zstd", "zstd"), ("none", "none")],
30
+ tooltip="Plane compression algorithm used for network frame transport",
31
+ ),
32
+ ] = "zstd"
33
+ prefetch: Annotated[
34
+ int,
35
+ Spin(
36
+ label="Prefetch Frames",
37
+ min=0,
38
+ max=64,
39
+ tooltip="Number of frames to prefetch asynchronously ahead of time (0 to disable)",
40
+ ),
41
+ ] = 4
42
+ backlog: Annotated[
43
+ int | None,
44
+ Spin(
45
+ label="Backlog",
46
+ min=1,
47
+ max=128,
48
+ tooltip="Maximum number of in-flight and prefetched frame requests buffered",
49
+ ),
50
+ ] = None
51
+ forward_logs: Annotated[
52
+ bool,
53
+ Checkbox(
54
+ label="Forward Logs",
55
+ text="Forward remote server logs",
56
+ tooltip="Dispatch remote LogRecords to the client logging system",
57
+ ),
58
+ ] = True
59
+ subscribe_streams: Annotated[
60
+ bool,
61
+ Checkbox(
62
+ label="Subscribe Streams",
63
+ text="Subscribe to stdout/stderr",
64
+ tooltip="Stream stdout and stderr output from the remote server",
65
+ ),
66
+ ] = True
67
+ use_curve: Annotated[
68
+ bool,
69
+ Checkbox(
70
+ label="CurveZMQ Encryption",
71
+ text="Enable CurveZMQ encryption",
72
+ tooltip="Enable CurveZMQ end-to-end encryption for the connection",
73
+ ),
74
+ ] = False
75
+ curve_server_key: Annotated[
76
+ str | None,
77
+ LineEdit(label="Curve Server Public Key", tooltip="Server public key for CurveZMQ encryption"),
78
+ ] = None
79
+ curve_public_key: Annotated[
80
+ str | None,
81
+ LineEdit(label="Curve Client Public Key", tooltip="Client public key for CurveZMQ authentication"),
82
+ ] = None
83
+ curve_secret_key: Annotated[
84
+ str | None,
85
+ SecretLineEdit(
86
+ label="Curve Client Secret Key",
87
+ namespace=WORKSPACE_ID,
88
+ context=CURVE_CONTEXT,
89
+ key=CURVE_KEY,
90
+ placeholder_text="Client secret key (optional)",
91
+ tooltip="Client secret key for CurveZMQ encryption",
92
+ ),
93
+ ] = None
@@ -0,0 +1,167 @@
1
+ from __future__ import annotations
2
+
3
+ from logging import getLogger
4
+ from typing import ClassVar, override
5
+
6
+ from PySide6.QtCore import Slot
7
+ from PySide6.QtWidgets import QDialog, QWidget
8
+ from vsremote import RemoteClient, RemoteExecutionError, UnsupportedFormatError
9
+
10
+ from vsview.api import ActionDefinition, IconName
11
+ from vsview.api.workspace import PluginWorkspace
12
+ from vsview.app.error import show_error
13
+ from vsview.app.outputs import VideoMetadata
14
+ from vsview.app.workspace import PythonScriptWorkspace
15
+
16
+ from ._metadata import AUTH_CONTEXT, AUTH_KEY, CURVE_CONTEXT, CURVE_KEY, WORKSPACE_ID
17
+ from .dialog import ConnectionConfig, RemoteConnectionDialog
18
+ from .settings import GlobalSettings
19
+
20
+ logger = getLogger(__name__)
21
+
22
+
23
+ class RemoteWorkspace(PythonScriptWorkspace, PluginWorkspace[GlobalSettings, None]):
24
+ title = "Remote"
25
+ icon = IconName.MONITOR_UP
26
+ caption = "Open VapourSynth Script (Remote)"
27
+
28
+ content_type = "script"
29
+
30
+ identifier = WORKSPACE_ID
31
+ display_name = "Remote"
32
+
33
+ CONFIGURE_CONNECTION: ClassVar[ActionDefinition] = ActionDefinition(
34
+ "jet_vsview_remote.configure_connection",
35
+ "Configure Remote Connection...",
36
+ default_key="Ctrl+Alt+R",
37
+ )
38
+
39
+ shortcuts = (CONFIGURE_CONNECTION,)
40
+
41
+ def __init__(self, parent: QWidget | None = None) -> None:
42
+ super().__init__(parent)
43
+ self._client: RemoteClient | None = None
44
+ self._config: ConnectionConfig | None = None
45
+ self._output_metadata = dict[int, VideoMetadata]()
46
+
47
+ self.dialog = RemoteConnectionDialog(self, self.settings, self.secrets)
48
+
49
+ self.api.register_shortcut(self.CONFIGURE_CONNECTION, self._on_configure_connection, self)
50
+
51
+ @override
52
+ def deleteLater(self) -> None:
53
+ if self._client:
54
+ self._client.close()
55
+ self._client = None
56
+ super().deleteLater()
57
+
58
+ @property
59
+ def auth_token(self) -> str | None:
60
+ return self.secrets.get(AUTH_CONTEXT, AUTH_KEY)
61
+
62
+ @auth_token.setter
63
+ def auth_token(self, value: str | None) -> None:
64
+ if value:
65
+ self.secrets.set(AUTH_CONTEXT, AUTH_KEY, value)
66
+ else:
67
+ self.secrets.delete(AUTH_CONTEXT, AUTH_KEY)
68
+
69
+ @property
70
+ def curve_secret_key(self) -> str | None:
71
+ return self.secrets.get(CURVE_CONTEXT, CURVE_KEY)
72
+
73
+ @curve_secret_key.setter
74
+ def curve_secret_key(self, value: str | None) -> None:
75
+ if value:
76
+ self.secrets.set(CURVE_CONTEXT, CURVE_KEY, value)
77
+ else:
78
+ self.secrets.delete(CURVE_CONTEXT, CURVE_KEY)
79
+
80
+ @property
81
+ def client(self) -> RemoteClient:
82
+ if self._config is None:
83
+ raise RuntimeError("This shouldn't happen")
84
+
85
+ if self._client:
86
+ return self._client
87
+
88
+ logger.info("Connecting to vsremote server at %s...", self._config.address)
89
+ self._client = RemoteClient(
90
+ self._config.address,
91
+ compression=self._config.compression,
92
+ auth_token=self._config.auth_token,
93
+ curve_server_key=self._config.curve_server_key,
94
+ curve_public_key=self._config.curve_public_key,
95
+ curve_secret_key=self._config.curve_secret_key,
96
+ forward_logs=self._config.forward_logs,
97
+ subscribe_streams=self._config.subscribe_streams,
98
+ replay_history=False,
99
+ )
100
+ return self._client.start()
101
+
102
+ @override
103
+ def get_output_metadata(self) -> dict[int, VideoMetadata]:
104
+ return self._output_metadata
105
+
106
+ @override
107
+ def loader(self) -> None:
108
+ if not self.content.exists():
109
+ logger.error("File not found: %s", self.content)
110
+ raise FileNotFoundError(f"File not found: {self.content}")
111
+
112
+ if self._config is None:
113
+ raise RuntimeError("Remote connection not configured")
114
+
115
+ code = self.content.read_text(encoding="utf-8")
116
+ try:
117
+ output_items = self.client.load_code(code, filename=str(self.content)).result(timeout=30.0)
118
+ logger.info("Remote script execution completed successfully (%d outputs)", len(output_items))
119
+
120
+ for idx, clip in self.client.get_outputs(self._config.prefetch, self._config.backlog).items():
121
+ clip.set_output(idx)
122
+
123
+ self._output_metadata = {item.index: VideoMetadata(item.name) for item in output_items if item.name}
124
+ except (RemoteExecutionError, UnsupportedFormatError) as err:
125
+ self.statusLoadingErrored.emit("Script error")
126
+ show_error(err, self, user_script_path=str(self.content), header_suffix=" on the remote server")
127
+ err.__traceback__ = None
128
+ raise RuntimeError(err) from None
129
+ except Exception as err:
130
+ logger.exception("Remote Error:")
131
+ err.__traceback__ = None
132
+ raise err from None
133
+
134
+ def prompt_connection_dialog(self) -> ConnectionConfig | None:
135
+ if self.dialog.exec() != QDialog.DialogCode.Accepted:
136
+ return None
137
+
138
+ res = self.dialog.config
139
+ # Persist non-sensitive configuration to global plugin settings
140
+ self.settings.global_.address = res.address
141
+ self.settings.global_.compression = res.compression
142
+ self.settings.global_.prefetch = res.prefetch
143
+ self.settings.global_.backlog = res.backlog if res.backlog is not None else max(res.prefetch * 3, 12)
144
+ self.settings.global_.forward_logs = res.forward_logs
145
+ self.settings.global_.subscribe_streams = res.subscribe_streams
146
+ self.settings.global_.use_curve = res.use_curve
147
+ self.settings.global_.curve_server_key = res.curve_server_key
148
+ self.settings.global_.curve_public_key = res.curve_public_key
149
+ # Persist sensitive secrets
150
+ self.auth_token = res.auth_token
151
+ self.curve_secret_key = res.curve_secret_key
152
+
153
+ return res
154
+
155
+ @Slot()
156
+ @override
157
+ def _on_open_file_button_clicked(self) -> None:
158
+ self._config = self.prompt_connection_dialog()
159
+ if self._config is None:
160
+ return
161
+
162
+ super()._on_open_file_button_clicked()
163
+
164
+ @Slot()
165
+ def _on_configure_connection(self) -> None:
166
+ if self.prompt_connection_dialog() and hasattr(self, "content") and self.content:
167
+ self.reload_content()