eva-shell 0.2.36__tar.gz → 0.2.37__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.36
3
+ Version: 0.2.37
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
@@ -1,3 +1,3 @@
1
- __version__ = '0.2.36'
1
+ __version__ = '0.2.37'
2
2
 
3
3
  DEFAULT_REPOSITORY_URL = 'https://pub.bma.ai/eva4'
@@ -17,7 +17,7 @@ from .compl import ComplOIDtp, ComplSvcRpcMethod, ComplSvcRpcParams, ComplEdit
17
17
  from .client import call_rpc, DEFAULT_DB_SERVICE, DEFAULT_REPL_SERVICE
18
18
  from .client import DEFAULT_ACL_SERVICE, DEFAULT_AUTH_SERVICE
19
19
  from .client import DEFAULT_KIOSK_SERVICE, DEFAULT_GENERATOR_SERVICE
20
- from .client import DEFAULT_ACCOUNTING_SERVICE, DEFAULT_ALARM_SERVICE
20
+ from .client import DEFAULT_ACCOUNTING_SERVICE, DEFAULT_ALARM_SERVICE, DEFAULT_VIDEO_SERVICE
21
21
 
22
22
  ALARM_OP_CODES = [
23
23
  'TT', 'TL', 'LL', 'SS', 'SD', 'OS', 'CC', 'AA', 'US', 'RD', 'IS'
@@ -1183,6 +1183,94 @@ def append_cloud_cli(root_sp):
1183
1183
  help='update without any confirmations',
1184
1184
  action='store_true')
1185
1185
 
1186
+ def append_video_cli(root_sp):
1187
+ ap_generator = root_sp.add_parser('video', help='video commands')
1188
+ sp_generator = ap_generator.add_subparsers(dest='_subc', help='sub command')
1189
+
1190
+ ap = sp_generator.add_parser('rec', help='video recordings')
1191
+ sp = ap.add_subparsers(dest='_subc2', help='sub command')
1192
+
1193
+ p = sp.add_parser('create', help='create a video recording')
1194
+ p.add_argument('i', metavar='source')
1195
+ p.add_argument('--keep',
1196
+ type=float,
1197
+ help='Keep (seconds)')
1198
+ p.add_argument('--enabled',
1199
+ help='Enable recording',
1200
+ action='store_true')
1201
+ p.add_argument(
1202
+ '-a',
1203
+ '--video-svc',
1204
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1205
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1206
+
1207
+ p = sp.add_parser('list', help='list video recordings')
1208
+ p.add_argument(
1209
+ '-a',
1210
+ '--video-svc',
1211
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1212
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1213
+
1214
+ p = sp.add_parser('edit', help='edit a video recording config')
1215
+ p.add_argument('i', metavar='source')
1216
+ p.add_argument(
1217
+ '-a',
1218
+ '--video-svc',
1219
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1220
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1221
+
1222
+ p = sp.add_parser('enable', help='enable (start) a video recording')
1223
+ p.add_argument('i', metavar='source')
1224
+ p.add_argument(
1225
+ '-a',
1226
+ '--video-svc',
1227
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1228
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1229
+
1230
+ p = sp.add_parser('disable', help='disable (stop) a video recording')
1231
+ p.add_argument('i', metavar='source')
1232
+ p.add_argument(
1233
+ '-a',
1234
+ '--video-svc',
1235
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1236
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1237
+
1238
+ p = sp.add_parser('destroy', help='destroy a video recording')
1239
+ p.add_argument('i', metavar='source')
1240
+ p.add_argument(
1241
+ '-a',
1242
+ '--video-svc',
1243
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1244
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1245
+
1246
+ p = sp.add_parser('export', help='export video recording config(s) to a deployment file')
1247
+ p.add_argument('i', metavar='MASK')
1248
+ p.add_argument(
1249
+ '-a',
1250
+ '--video-svc',
1251
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1252
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('videosrv')
1253
+ p.add_argument('-o', '--output', metavar='FILE',
1254
+ help='output file').completer = ComplDeployFile()
1255
+
1256
+ p = sp.add_parser('deploy', help='deploy video recording(s) from a deployment file')
1257
+ p.add_argument(
1258
+ '-a',
1259
+ '--video-svc',
1260
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1261
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('generator')
1262
+ p.add_argument('-f', '--file', metavar='FILE',
1263
+ help='deployment file').completer = ComplDeployFile()
1264
+
1265
+ p = sp.add_parser('undeploy',
1266
+ help='undeploy video recordings(s) using a deployment file')
1267
+ p.add_argument(
1268
+ '-a',
1269
+ '--video-svc',
1270
+ help=f'video service (default: {DEFAULT_VIDEO_SERVICE})',
1271
+ default=DEFAULT_VIDEO_SERVICE).completer = ComplSvc('generator')
1272
+ p.add_argument('-f', '--file', metavar='FILE',
1273
+ help='deployment file').completer = ComplDeployFile()
1186
1274
 
1187
1275
  def append_generator_cli(root_sp):
1188
1276
  source_types = [
@@ -1589,6 +1677,7 @@ def init_ap():
1589
1677
  'lvar': [],
1590
1678
  'mirror': [],
1591
1679
  'node': [],
1680
+ 'video': [],
1592
1681
  'server': [],
1593
1682
  'spoint': [],
1594
1683
  'system': [],
@@ -1627,6 +1716,7 @@ def init_ap():
1627
1716
  if is_local_shell():
1628
1717
  append_mirror_cli(sp)
1629
1718
  append_node_cli(sp)
1719
+ append_video_cli(sp)
1630
1720
  if is_local_shell():
1631
1721
  append_server_cli(sp)
1632
1722
  append_spoint_cli(sp)
@@ -1707,6 +1707,99 @@ class CLI:
1707
1707
  call_rpc('kiosk.dev_close', dict(i=i), target=kiosk_svc)
1708
1708
  ok()
1709
1709
 
1710
+ def video_rec_list(self, video_svc):
1711
+ data = call_rpc('rec.list', target=video_svc)
1712
+ print_result(data, cols=['oid', 'keep', 'enabled'])
1713
+
1714
+ def video_rec_create(self, i, keep, enabled, video_svc):
1715
+ payload = {
1716
+ 'oid': i,
1717
+ }
1718
+ if keep:
1719
+ payload['keep'] = keep
1720
+ if enabled:
1721
+ payload['enabled'] = enabled
1722
+ call_rpc('rec.deploy',
1723
+ dict(video_recordings=[payload]),
1724
+ target=video_svc)
1725
+ ok()
1726
+
1727
+ def video_rec_destroy(self, i, video_svc):
1728
+ payload = {
1729
+ 'oid': i,
1730
+ }
1731
+ call_rpc('rec.undeploy',
1732
+ dict(video_recordings=[payload]),
1733
+ target=video_svc)
1734
+ ok()
1735
+
1736
+ def video_rec_enable(self, i, video_svc):
1737
+ call_rpc('rec.enable', dict(i=i), target=video_svc)
1738
+ ok()
1739
+
1740
+ def video_rec_disable(self, i, video_svc):
1741
+ call_rpc('rec.disable', dict(i=i), target=video_svc)
1742
+ ok()
1743
+
1744
+ def video_rec_edit(self, i, video_svc):
1745
+
1746
+ def deploy(cfg, i):
1747
+ call_rpc('rec.deploy',
1748
+ dict(video_recordings=[cfg]),
1749
+ target=video_svc)
1750
+ print(f'video recording config re-deployed: {i}')
1751
+ print()
1752
+
1753
+ config = call_rpc('rec.get_config', dict(i=i), target=video_svc)
1754
+ edit_config(config,
1755
+ f'video.rec|{i}|config',
1756
+ deploy_fn=partial(deploy, i=i))
1757
+
1758
+ def video_rec_export(self, i, video_svc, output=None):
1759
+ c = 0
1760
+ configs = []
1761
+ for source in call_rpc('rec.list', target=video_svc):
1762
+ oid = source['oid']
1763
+ if (i.startswith('*') and oid.endswith(i[1:])) or \
1764
+ (i.endswith('*') and oid.startswith(i[:-1])) or \
1765
+ (i.startswith('*') and i.endswith('*') and i[1:-1] in oid) or \
1766
+ i == oid:
1767
+ c += 1
1768
+ config = call_rpc('rec.get_config',
1769
+ dict(i=oid),
1770
+ target=video_svc)
1771
+ configs.append(config)
1772
+ result = dict(video_recordings=configs)
1773
+ if current_command.json:
1774
+ print_result(result)
1775
+ else:
1776
+ import yaml
1777
+ dump = yaml.dump(result, default_flow_style=False)
1778
+ if output is None:
1779
+ print(dump)
1780
+ else:
1781
+ write_file(output, dump)
1782
+ print(f'{c} video recording configuration(s) exported')
1783
+ print()
1784
+
1785
+ def video_rec_deploy(self, video_svc, file=None):
1786
+ import yaml
1787
+ sources = yaml.safe_load(
1788
+ read_file(file).decode()).pop('video_recordings')
1789
+ call_rpc('rec.deploy', dict(video_recordings=sources), target=video_svc)
1790
+ print(f'{len(sources)} video recording configuration(s) deployed')
1791
+ print()
1792
+
1793
+ def video_rec_undeploy(self, video_svc, file=None):
1794
+ import yaml
1795
+ sources = yaml.safe_load(
1796
+ read_file(file).decode()).pop('video_recordings')
1797
+ call_rpc('rec.undeploy',
1798
+ dict(video_recordings=sources),
1799
+ target=video_svc)
1800
+ print(f'{len(sources)} video recording configuration(s) undeployed')
1801
+ print()
1802
+
1710
1803
  def generator_source_list(self, generator_svc):
1711
1804
  data = call_rpc('source.list', target=generator_svc)
1712
1805
  print_result(data, cols=['name', 'kind', 'active'])
@@ -16,6 +16,7 @@ DEFAULT_ACL_SERVICE = 'eva.aaa.acl'
16
16
  DEFAULT_AUTH_SERVICE = 'eva.aaa.localauth'
17
17
  DEFAULT_KIOSK_SERVICE = 'eva.kioskman.default'
18
18
  DEFAULT_GENERATOR_SERVICE = 'eva.generator.default'
19
+ DEFAULT_VIDEO_SERVICE = 'eva.videosrv.default'
19
20
  DEFAULT_ACCOUNTING_SERVICE = 'eva.aaa.accounting'
20
21
  DEFAULT_ALARM_SERVICE = 'eva.alarm.default'
21
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.36
3
+ Version: 0.2.37
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
@@ -1,4 +1,4 @@
1
- __version__ = '0.2.36'
1
+ __version__ = '0.2.37'
2
2
 
3
3
  import setuptools
4
4
 
File without changes
File without changes
File without changes
File without changes