vsview-remote 0.1.0__py3-none-any.whl
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.
- vsview_remote/__init__.py +13 -0
- vsview_remote/_metadata.py +6 -0
- vsview_remote/dialog.py +262 -0
- vsview_remote/py.typed +0 -0
- vsview_remote/settings.py +93 -0
- vsview_remote/workspace.py +167 -0
- vsview_remote-0.1.0.dist-info/METADATA +26 -0
- vsview_remote-0.1.0.dist-info/RECORD +11 -0
- vsview_remote-0.1.0.dist-info/WHEEL +4 -0
- vsview_remote-0.1.0.dist-info/entry_points.txt +2 -0
- vsview_remote-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -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
|
vsview_remote/dialog.py
ADDED
|
@@ -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
|
vsview_remote/py.typed
ADDED
|
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()
|
|
@@ -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,11 @@
|
|
|
1
|
+
vsview_remote/__init__.py,sha256=jLHRuh5MxIGwh449OBC7sHEcXqdw-CVur-mQOdnNMck,296
|
|
2
|
+
vsview_remote/_metadata.py,sha256=qgloWqtPCNP6IHEKnIDwuvoBPd7A8-Zy0q5yQuXcL4c,126
|
|
3
|
+
vsview_remote/dialog.py,sha256=QbvZ23i6meOXVtHDpgZlbi_UcIsviHvClX_Cl7hAuOg,10804
|
|
4
|
+
vsview_remote/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
vsview_remote/settings.py,sha256=tZA9SLVaP6vpdoIiJ1eBpvLCjKBGu28dqaQk3tBokX8,3004
|
|
6
|
+
vsview_remote/workspace.py,sha256=uttdFK-FtKme_JPGDzpI4kR7E7hL9zO9w2HjIfTM80E,6249
|
|
7
|
+
vsview_remote-0.1.0.dist-info/METADATA,sha256=Sa9YwelC38C8dw39DaxvkZFI7XOcfLeVL_ZHrFuI9Kg,1176
|
|
8
|
+
vsview_remote-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
9
|
+
vsview_remote-0.1.0.dist-info/entry_points.txt,sha256=ofc7apLVrv6thW-UjJ1O1sV3uFVQAyCvdKrsZSxOqwo,39
|
|
10
|
+
vsview_remote-0.1.0.dist-info/licenses/LICENSE,sha256=Am5mgDbqE74Pmbmv59-OsvKODDcWpkVPUdaXhhj5CdI,1083
|
|
11
|
+
vsview_remote-0.1.0.dist-info/RECORD,,
|
|
@@ -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.
|