feat: align keyboard LocalID to GlobalID and preserve server credentials

Two operator requirements for MBeg keyboards and server connections:

1. align_keyboard_local_ids(): on every keyboard interface under
   Clients/GeViIO/GeViIO_01, set each video input/output LocalID equal to
   its GlobalID so operators can address cameras/monitors by global id.
   Virtual decoders/servers under GeViIO_Virtual keep their sequential
   local ids. Runs after prune in /api/set/export and /api/batch/build.

2. preserve_server_credentials(): server User/Password are entered by hand
   and must survive re-importing the server list from Excel. Matched by
   alias, an existing non-empty credential overrides the imported value.
   Applied to G-Core and GeViScope servers in /api/batch/build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Docker Config Backup
2026-06-07 10:32:18 +02:00
parent 3b38a5c6d9
commit c54d3a6792
2 changed files with 62 additions and 0 deletions

View File

@@ -111,6 +111,7 @@ async def export_set(payload: dict):
geviset.ensure_vx3_video_inputs(tree, camera_ids, ptz_by_id)
geviset.prune_video_inputs(tree, camera_ids)
geviset.disable_keyboard_ptz(tree)
geviset.align_keyboard_local_ids(tree)
print(
f"EXPORT camera_ids={len(camera_ids)} contains_101027={101027 in camera_ids}",
flush=True,
@@ -303,6 +304,7 @@ async def build_from_excel(
geviset.ensure_vx3_video_inputs(tree, camera_ids, ptz_by_id)
geviset.prune_video_inputs(tree, camera_ids)
geviset.disable_keyboard_ptz(tree)
geviset.align_keyboard_local_ids(tree)
if servers and servers.filename:
if not servers.filename.lower().endswith(".xlsx"):
@@ -316,6 +318,8 @@ async def build_from_excel(
s["id"] = str(idx)
bundle_gcore = geviset.extract_gcore(tree)
bundle_gsc = geviset.extract_gsc(tree)
geviset.preserve_server_credentials(gcore_list, bundle_gcore["servers"])
geviset.preserve_server_credentials(gsc_list, bundle_gsc["servers"])
bundle_gcore["servers"] = gcore_list
bundle_gsc["servers"] = gsc_list
geviset.apply_gcore(tree, bundle_gcore)