remotivelabs-cli 0.0.12__tar.gz → 0.0.13__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.
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/PKG-INFO +1 -1
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/lib/broker.py +23 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/recordings.py +19 -1
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/pyproject.toml +1 -1
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/LICENSE +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/README.md +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/__about__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/__init__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/brokers.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/export.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/files.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/lib/__about__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/playback.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/record.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/scripting.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/broker/signals.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/__init__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/auth.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/auth_tokens.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/brokers.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/cloud_cli.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/configs.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/projects.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/rest_helper.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/sample_recordings.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/service_account_tokens.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/cloud/service_accounts.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/connect/__init__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/connect/connect.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/connect/protopie/protopie.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/errors.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/remotive.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/requirements.txt +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/settings.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/tools/__init__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/tools/can/__init__.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/tools/can/can.py +0 -0
- {remotivelabs_cli-0.0.12 → remotivelabs_cli-0.0.13}/cli/tools/tools.py +0 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import binascii
|
4
|
+
import datetime
|
4
5
|
import ntpath
|
5
6
|
import os
|
6
7
|
import posixpath
|
@@ -8,6 +9,7 @@ import queue
|
|
8
9
|
import signal as os_signal
|
9
10
|
import tempfile
|
10
11
|
import time
|
12
|
+
import typing
|
11
13
|
import zipfile
|
12
14
|
from dataclasses import dataclass
|
13
15
|
from threading import Thread
|
@@ -181,6 +183,27 @@ class Broker:
|
|
181
183
|
self.__check_playbackmode_result(status)
|
182
184
|
return status
|
183
185
|
|
186
|
+
def listen_on_playback(self, callback: Callable[[str], None]):
|
187
|
+
def get_mode(mode: int):
|
188
|
+
if mode == 0:
|
189
|
+
return "playing"
|
190
|
+
if mode == 1:
|
191
|
+
return "paused"
|
192
|
+
if mode == 2:
|
193
|
+
return "stopped"
|
194
|
+
|
195
|
+
sub = self.traffic_stub.PlayTrafficStatus(br.common_pb2.Empty())
|
196
|
+
for playback_state in sub:
|
197
|
+
p = typing.cast(br.traffic_api_pb2.PlaybackInfos, playback_state)
|
198
|
+
offset_time = int(p.playbackInfo[0].playbackMode.offsetTime / 1000000)
|
199
|
+
start_time = p.playbackInfo[0].playbackMode.startTime
|
200
|
+
end_time = p.playbackInfo[0].playbackMode.endTime
|
201
|
+
mode = p.playbackInfo[0].playbackMode.mode
|
202
|
+
|
203
|
+
length = int((end_time - start_time) / 1000000)
|
204
|
+
|
205
|
+
callback(f"{(datetime.timedelta(seconds=offset_time))} / {(datetime.timedelta(seconds=length))} ({get_mode(mode)})")
|
206
|
+
|
184
207
|
def pause(self, namespace: str, path: str, silent: bool = False):
|
185
208
|
playback_list = [
|
186
209
|
{
|
@@ -11,7 +11,7 @@ from pathlib import Path
|
|
11
11
|
import grpc
|
12
12
|
import requests
|
13
13
|
import typer
|
14
|
-
from rich.progress import track
|
14
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn, track
|
15
15
|
|
16
16
|
from cli.errors import ErrorPrinter
|
17
17
|
|
@@ -383,6 +383,18 @@ def pause(
|
|
383
383
|
_do_change_playback_mode("pause", recording_session, broker, project)
|
384
384
|
|
385
385
|
|
386
|
+
@app.command(name="playback-status")
|
387
|
+
def playback_status(
|
388
|
+
recording_session: str = typer.Argument(..., help="Recording session id", envvar="REMOTIVE_CLOUD_RECORDING_SESSION"),
|
389
|
+
broker: str = typer.Option(None, help="Broker to use"),
|
390
|
+
project: str = typer.Option(..., help="Project ID", envvar="REMOTIVE_CLOUD_PROJECT"),
|
391
|
+
):
|
392
|
+
"""
|
393
|
+
Display status and progress of the recording beeing played
|
394
|
+
"""
|
395
|
+
_do_change_playback_mode("status", recording_session, broker, project)
|
396
|
+
|
397
|
+
|
386
398
|
@app.command()
|
387
399
|
def seek(
|
388
400
|
recording_session: str = typer.Argument(..., help="Recording session id", envvar="REMOTIVE_CLOUD_RECORDING_SESSION"),
|
@@ -453,6 +465,12 @@ def _do_change_playback_mode(mode: str, recording_session: str, broker: str, pro
|
|
453
465
|
broker.seek(files, int(seconds * 1000000), True)
|
454
466
|
elif mode == "stop":
|
455
467
|
broker.seek(files, 0, True)
|
468
|
+
elif mode == "status":
|
469
|
+
p = Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), transient=True)
|
470
|
+
t = p.add_task("label", total=1)
|
471
|
+
|
472
|
+
with p:
|
473
|
+
broker.listen_on_playback(lambda c: p.update(t, description=str(c)))
|
456
474
|
else:
|
457
475
|
raise Exception(f"Illegal command {mode}")
|
458
476
|
|
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
|