changeset 589:c5aac4f4f04c

macro for getting information about created BigBlueButton meetings
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 31 May 2012 09:42:23 +0200
parents 50f81f786081
children b17f6afb108f
files data/plugin/macro/bbb.py
diffstat 1 files changed, 49 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/plugin/macro/bbb.py	Thu May 31 09:42:23 2012 +0200
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+"""
+    MoinMoin - checks activity of BigBlueButton meetings
+
+    @copyright: 2012 MoinMoin:ReimarBauer
+    @license: GNU GPL, see COPYING for details.
+"""
+import urllib
+from MoinMoin import wikiutil
+from MoinMoin.Page import Page
+# pip install bigbluebutton
+from bigbluebutton import Meeting
+import bbb_settings
+
+
+def macro_bbb(macro):
+    """
+    Shows a list of all meetings with amount of participant and moderator
+    On same directory as wikiconfig.py you need
+    a "bbb_settings.py" module with the SALT and the BBB_API_URL.
+    
+    Example:
+    <<bbb>>
+    """
+    request = macro.request
+    _ = request.getText
+    meeting = Meeting(bbb_settings.BBB_API_URL, bbb_settings.SALT)
+    all_sessions = meeting.get_meetings()
+    txt = ['= No active Meetings =']
+    txt.append('(!) Create or Recreate a meeting')
+    if all_sessions:
+        txt = ['= Currently active Meetings =']
+    if all_sessions:
+        txt.append('|| meeting id || participation count || moderator count ||')
+    for session in all_sessions:
+        meeting_id = session["info"]['invite_url'].strip('join=')
+        participation_count = session["info"]['participant_count']
+        moderator_count = session["info"]['moderator_count']
+
+        txt.append('|| %(meeting_id)s || %(participation_count)s|| %(moderator_count)s ||' % {"meeting_id": meeting_id,
+                                                                                              "participation_count": participation_count,
+                                                                                              "moderator_count": moderator_count
+                                                                                              })
+
+
+    raw = '\n'.join(txt)
+    Parser = wikiutil.searchAndImportPlugin(request.cfg, "parser", request.page.pi['format'])
+    return wikiutil.renderText(request, Parser, raw)
+