bbbctl 0.0.4__tar.gz → 0.2.0__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,13 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bbbctl
3
- Version: 0.0.4
3
+ Version: 0.2.0
4
4
  Summary: BigBlueButton API command-line client
5
5
  Home-page: https://github.com/defnull/bbbctl
6
6
  Author: Marcel Hellkamp
7
7
  Author-email: marc@gsites.de
8
- License: UNKNOWN
9
8
  Project-URL: Bug Tracker, https://github.com/defnull/bbbctl/issues
10
- Platform: UNKNOWN
11
9
  Classifier: Programming Language :: Python :: 3
12
10
  Classifier: License :: OSI Approved :: MIT License
13
11
  Classifier: Operating System :: OS Independent
@@ -17,9 +15,9 @@ License-File: LICENSE
17
15
 
18
16
  # BigBlueButton REST API command-line client
19
17
 
20
- This is a small but useful command-line client for controlling meetings and recordings on a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight), [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and directly access the backing BBB servers for administative tasks, monitoring or testing.
18
+ This is a small but useful command-line client for controlling meetings and recordings on a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight), [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and directly access the backing BBB servers for administrative tasks, monitoring or testing.
21
19
 
22
- The module can also be imported as a python library, but please note that this project is not yet considered stable in any way. A stable and more usable API for python skripting might follow.
20
+ The module can also be imported as a python library, but please note that this project is not yet considered stable in any way. A stable and more usable API for python scripting might follow.
23
21
 
24
22
  ## Install
25
23
 
@@ -28,7 +26,7 @@ The module can also be imported as a python library, but please note that this p
28
26
  sudo pip install -U bbbctl
29
27
  # or manually:
30
28
  sudo curl -L https://raw.githubusercontent.com/defnull/bbbctl/master/src/bbbctl.py -o /usr/local/bin/bbbctl
31
- sudo chmos +x /usr/local/bin/bbbctl
29
+ sudo chmod +x /usr/local/bin/bbbctl
32
30
  ```
33
31
 
34
32
  ## Usage
@@ -60,15 +58,15 @@ You can get detailed help and a list of all parameters with `bbbctl -h` or `bbbc
60
58
  - `info <recordID>` Show info about a recording
61
59
  - `publish <recordID>` Publish an unpublished recording
62
60
  - `unpublish <recordID>` Unpublish (hide) recording)
63
- - `delete <recordID>` Delete a recording
61
+ - `delete <recordID>` Delete a recording (be careful)
64
62
 
65
63
  ## Output format
66
64
 
67
- The default output format is currently a human readable plain text format. You can switch to a more compact version with `--format=compact`. Other formats (e.g. `json`, `yaml` or `xml`) may be supported in the future.
65
+ The default output format is a human readable plain text format. You can switch to a more compact version with `--format=compact`. Other formats that are better suited for scripted usage are also supported: `json`, `jsonline` or `xml`
68
66
 
69
67
  # License
70
68
 
71
- Copyright (c) 2020-2021, Marcel Hellkamp.
69
+ Copyright (c) 2020-2022, Marcel Hellkamp.
72
70
 
73
71
  Permission is hereby granted, free of charge, to any person obtaining a copy
74
72
  of this software and associated documentation files (the "Software"), to deal
@@ -87,5 +85,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87
85
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88
86
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
89
87
  THE SOFTWARE.
90
-
91
-
@@ -1,8 +1,8 @@
1
1
  # BigBlueButton REST API command-line client
2
2
 
3
- This is a small but useful command-line client for controlling meetings and recordings on a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight), [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and directly access the backing BBB servers for administative tasks, monitoring or testing.
3
+ This is a small but useful command-line client for controlling meetings and recordings on a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight), [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and directly access the backing BBB servers for administrative tasks, monitoring or testing.
4
4
 
5
- The module can also be imported as a python library, but please note that this project is not yet considered stable in any way. A stable and more usable API for python skripting might follow.
5
+ The module can also be imported as a python library, but please note that this project is not yet considered stable in any way. A stable and more usable API for python scripting might follow.
6
6
 
7
7
  ## Install
8
8
 
@@ -11,7 +11,7 @@ The module can also be imported as a python library, but please note that this p
11
11
  sudo pip install -U bbbctl
12
12
  # or manually:
13
13
  sudo curl -L https://raw.githubusercontent.com/defnull/bbbctl/master/src/bbbctl.py -o /usr/local/bin/bbbctl
14
- sudo chmos +x /usr/local/bin/bbbctl
14
+ sudo chmod +x /usr/local/bin/bbbctl
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -43,15 +43,15 @@ You can get detailed help and a list of all parameters with `bbbctl -h` or `bbbc
43
43
  - `info <recordID>` Show info about a recording
44
44
  - `publish <recordID>` Publish an unpublished recording
45
45
  - `unpublish <recordID>` Unpublish (hide) recording)
46
- - `delete <recordID>` Delete a recording
46
+ - `delete <recordID>` Delete a recording (be careful)
47
47
 
48
48
  ## Output format
49
49
 
50
- The default output format is currently a human readable plain text format. You can switch to a more compact version with `--format=compact`. Other formats (e.g. `json`, `yaml` or `xml`) may be supported in the future.
50
+ The default output format is a human readable plain text format. You can switch to a more compact version with `--format=compact`. Other formats that are better suited for scripted usage are also supported: `json`, `jsonline` or `xml`
51
51
 
52
52
  # License
53
53
 
54
- Copyright (c) 2020-2021, Marcel Hellkamp.
54
+ Copyright (c) 2020-2022, Marcel Hellkamp.
55
55
 
56
56
  Permission is hereby granted, free of charge, to any person obtaining a copy
57
57
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = bbbctl
3
- version = 0.0.4
3
+ version = 0.2.0
4
4
  author = Marcel Hellkamp
5
5
  author_email = marc@gsites.de
6
6
  description = BigBlueButton API command-line client
@@ -1,13 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bbbctl
3
- Version: 0.0.4
3
+ Version: 0.2.0
4
4
  Summary: BigBlueButton API command-line client
5
5
  Home-page: https://github.com/defnull/bbbctl
6
6
  Author: Marcel Hellkamp
7
7
  Author-email: marc@gsites.de
8
- License: UNKNOWN
9
8
  Project-URL: Bug Tracker, https://github.com/defnull/bbbctl/issues
10
- Platform: UNKNOWN
11
9
  Classifier: Programming Language :: Python :: 3
12
10
  Classifier: License :: OSI Approved :: MIT License
13
11
  Classifier: Operating System :: OS Independent
@@ -17,9 +15,9 @@ License-File: LICENSE
17
15
 
18
16
  # BigBlueButton REST API command-line client
19
17
 
20
- This is a small but useful command-line client for controlling meetings and recordings on a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight), [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and directly access the backing BBB servers for administative tasks, monitoring or testing.
18
+ This is a small but useful command-line client for controlling meetings and recordings on a [BigBlueButton](https://docs.bigbluebutton.org/) server or cluster directly via the [REST API](https://docs.bigbluebutton.org/dev/api.html). It allows administrators to bypass front-end applications ([greenlight](https://github.com/bigbluebutton/greenlight), [moodle](https://moodle.com/certified-integrations/bigbluebutton/) or alternatives) and directly access the backing BBB servers for administrative tasks, monitoring or testing.
21
19
 
22
- The module can also be imported as a python library, but please note that this project is not yet considered stable in any way. A stable and more usable API for python skripting might follow.
20
+ The module can also be imported as a python library, but please note that this project is not yet considered stable in any way. A stable and more usable API for python scripting might follow.
23
21
 
24
22
  ## Install
25
23
 
@@ -28,7 +26,7 @@ The module can also be imported as a python library, but please note that this p
28
26
  sudo pip install -U bbbctl
29
27
  # or manually:
30
28
  sudo curl -L https://raw.githubusercontent.com/defnull/bbbctl/master/src/bbbctl.py -o /usr/local/bin/bbbctl
31
- sudo chmos +x /usr/local/bin/bbbctl
29
+ sudo chmod +x /usr/local/bin/bbbctl
32
30
  ```
33
31
 
34
32
  ## Usage
@@ -60,15 +58,15 @@ You can get detailed help and a list of all parameters with `bbbctl -h` or `bbbc
60
58
  - `info <recordID>` Show info about a recording
61
59
  - `publish <recordID>` Publish an unpublished recording
62
60
  - `unpublish <recordID>` Unpublish (hide) recording)
63
- - `delete <recordID>` Delete a recording
61
+ - `delete <recordID>` Delete a recording (be careful)
64
62
 
65
63
  ## Output format
66
64
 
67
- The default output format is currently a human readable plain text format. You can switch to a more compact version with `--format=compact`. Other formats (e.g. `json`, `yaml` or `xml`) may be supported in the future.
65
+ The default output format is a human readable plain text format. You can switch to a more compact version with `--format=compact`. Other formats that are better suited for scripted usage are also supported: `json`, `jsonline` or `xml`
68
66
 
69
67
  # License
70
68
 
71
- Copyright (c) 2020-2021, Marcel Hellkamp.
69
+ Copyright (c) 2020-2022, Marcel Hellkamp.
72
70
 
73
71
  Permission is hereby granted, free of charge, to any person obtaining a copy
74
72
  of this software and associated documentation files (the "Software"), to deal
@@ -87,5 +85,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87
85
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88
86
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
89
87
  THE SOFTWARE.
90
-
91
-
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  bbbctl = bbbctl:main
3
-
@@ -6,9 +6,9 @@ import urllib.parse
6
6
  import hashlib
7
7
  import sys, os
8
8
  import xml.etree.ElementTree as ET
9
- from xml.dom import minidom
10
9
  import json
11
10
  import datetime
11
+ import ssl
12
12
 
13
13
  __all__ = ["BBBApiClient", "ApiError"]
14
14
 
@@ -22,9 +22,10 @@ class ApiError(RuntimeError):
22
22
 
23
23
 
24
24
  class BBBApiClient:
25
- def __init__(self, api, secret):
25
+ def __init__(self, api, secret, ssl_context=None):
26
26
  self.api = api.rstrip("/")
27
27
  self.secret = secret
28
+ self.ssl = ssl_context or ssl.create_default_context()
28
29
 
29
30
  def makeurl(self, command, **query):
30
31
  query = urllib.parse.urlencode(query)
@@ -38,7 +39,7 @@ class BBBApiClient:
38
39
 
39
40
  def call(self, command, **query):
40
41
  url = self.makeurl(command, **query)
41
- with urllib.request.urlopen(url) as f:
42
+ with urllib.request.urlopen(url, context=self.ssl) as f:
42
43
  xml = f.read().decode("utf8")
43
44
  root = ET.fromstring(xml)
44
45
  if root.find("./returncode").text != "SUCCESS":
@@ -83,11 +84,15 @@ def build_parser():
83
84
  "--secret",
84
85
  help="API secretd (default: BBBCTL_SECRET or local config)",
85
86
  )
87
+ parser.add_argument(
88
+ "--insecure",
89
+ help="Skip TLS verification and accept self-signed or invalid SSL certificates as if they were valid",
90
+ )
86
91
 
87
92
  parser.add_argument(
88
93
  "--format",
89
94
  help="Change output format.",
90
- choices=["human", "compact", "xml"],
95
+ choices=["human", "compact", "xml", "json", "jsonline"],
91
96
  default="human",
92
97
  )
93
98
 
@@ -175,6 +180,7 @@ config_paths = [
175
180
  "/etc/bigbluebutton/bbb-web.properties",
176
181
  "/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties",
177
182
  "/var/lib/tomcat7/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties",
183
+ "./bbbctl.conf",
178
184
  ]
179
185
 
180
186
 
@@ -212,10 +218,17 @@ def main():
212
218
  )
213
219
 
214
220
  server = server.rstrip("/")
221
+ if "://" not in server:
222
+ server = "https://" + server
215
223
  if not server.endswith("/bigbluebutton/api"):
216
224
  server += "/bigbluebutton/api"
217
225
 
218
- client = BBBApiClient(server, secret)
226
+ ctx = ssl.create_default_context()
227
+ if args.insecure:
228
+ ctx.check_hostname = False
229
+ ctx.verify_mode = ssl.CERT_NONE
230
+
231
+ client = BBBApiClient(server, secret, ssl_context=ctx)
219
232
 
220
233
  try:
221
234
  args.cmd(client, args)
@@ -228,6 +241,10 @@ def format(element, args):
228
241
  return format_compact(element)
229
242
  if args.format == "xml":
230
243
  return format_xml(element)
244
+ if args.format == "json":
245
+ return format_json(element, indent=2)
246
+ if args.format == "jsonline":
247
+ return format_json(element)
231
248
  return format_human(element)
232
249
 
233
250
 
@@ -242,7 +259,7 @@ def format_human(e, indent=""):
242
259
  result = indent + e.tag + ":"
243
260
  if e.tag.lower() in ("starttime", "endtime"):
244
261
  value = "%s (%s)" % (
245
- datetime.datetime.utcfromtimestamp(float(value) / 1000),
262
+ datetime.datetime.fromtimestamp(float(value) / 1000, datetime.timezone.utc),
246
263
  value,
247
264
  )
248
265
  if value:
@@ -266,6 +283,40 @@ def format_xml(e):
266
283
  return ET.tostring(e, encoding="unicode")
267
284
 
268
285
 
286
+ def format_json(e, *a, **ka):
287
+ return json.dumps(_unpack_xml(e), *a, **ka)
288
+
289
+
290
+ _should_be_list = ["attendees"]
291
+ _should_be_number = [
292
+ "createTime",
293
+ "duration",
294
+ "startTime",
295
+ "endTime",
296
+ "participantCount",
297
+ "listenerCount",
298
+ "voiceParticipantCount",
299
+ "videoCount",
300
+ "maxUsers",
301
+ "moderatorCount",
302
+ ]
303
+
304
+
305
+ def _unpack_xml(e):
306
+ if e.tag in _should_be_list:
307
+ return [_unpack_xml(c) for c in e if e.tag]
308
+ if len(e):
309
+ return {c.tag: _unpack_xml(c) for c in e if c.tag}
310
+ value = e.text and e.text.strip()
311
+ if e.tag in _should_be_number:
312
+ return int(value)
313
+ if not value:
314
+ return None
315
+ if value in ("true", "false"):
316
+ return value == "true"
317
+ return value
318
+
319
+
269
320
  def cmd_rec_list(api, args):
270
321
  opts = {}
271
322
  if args.meeting:
@@ -322,23 +373,17 @@ def cmd_meet_create(api, args):
322
373
  link = api.getJoinLink(
323
374
  meetingID=args.id,
324
375
  fullName=name,
376
+ createTime=created.find("createTime").text,
325
377
  password=created.find("moderatorPW").text,
326
378
  )
327
379
  print(name + ":", link)
328
380
 
329
381
 
330
382
  def cmd_meet_join(api, args):
383
+ meeting = api.getMeetingInfo(meetingID=args.id)
331
384
  query = {"meetingID": args.id, "fullName": args.name}
332
-
333
- if args.mod:
334
- query["password"] = (
335
- api.getMeetingInfo(meetingID=args.id).find("moderatorPW").text
336
- )
337
- else:
338
- query["password"] = (
339
- api.getMeetingInfo(meetingID=args.id).find("attendeePW").text
340
- )
341
-
385
+ query["createTime"] = meeting.find("createTime").text
386
+ query["role"] = "MODERATOR" if args.mod else "VIEWER"
342
387
  link = api.getJoinLink(**query)
343
388
 
344
389
  if args.open:
File without changes
File without changes