Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.18 (2025-09-19)

- Add option to specify scene extension to mujin_webstackclientpy_downloaddata.py

## 0.9.18 (2025-09-11)

- Re-generate graph api.
Expand Down
13 changes: 10 additions & 3 deletions bin/mujin_webstackclientpy_downloaddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def _ParseArguments():
parser.add_argument('--username', type=str, default='mujin', help='Username to login with (default: %(default)s)')
parser.add_argument('--password', type=str, default='mujin', help='Password to login with (default: %(default)s)')
parser.add_argument('--timeout', type=float, default=600, help='Timeout in seconds (default: %(default)s)')
parser.add_argument('--sceneExtension', default=None, help='scene extension such as msgpack, json, yaml')
return parser.parse_args()


Expand All @@ -40,8 +41,7 @@ def _CreateWebstackClient(url, username, password):
controllerpassword=password,
)


def _GetScenes(webClient):
def _GetScenes(webClient, userRequestedSceneExtension=None):
from mujinwebstackclient import uriutils

# get the conf file
Expand All @@ -53,6 +53,13 @@ def _GetScenes(webClient):
sceneUri = config.get('sceneuri', '')
if sceneUri != '':
sceneExtension = os.path.splitext(sceneUri)[-1]

if userRequestedSceneExtension is not None:
if not userRequestedSceneExtension.startswith('.'):
userRequestedSceneExtension = '.' + userRequestedSceneExtension
sceneExtension = userRequestedSceneExtension
sceneUri = os.path.splitext(sceneUri)[0] + sceneExtension

sceneList.append(uriutils.GetPrimaryKeyFromURI(sceneUri))

# get target names from config
Expand Down Expand Up @@ -91,7 +98,7 @@ def _Main():
_ConfigureLogging(options.loglevel)

webClient = _CreateWebstackClient(options.url, options.username, options.password)
sceneList = _GetScenes(webClient)
sceneList = _GetScenes(webClient, options.sceneExtension)
downloadDirectory = _DownloadBackup(webClient, sceneList, timeout=options.timeout)
print(downloadDirectory) # other scripts can read stdout and learn the directory path

Expand Down