view data/plugin/macro/ @ 606:7909cd319ce8

bbb: bug fix for parser lookup by extensions. We check now if bigbluebutton lib is installed.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 22 Jun 2012 19:21:46 +0200
parents c5aac4f4f04c
children 8cc90eda0688
line wrap: on
line source
# -*- 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
except ImportError:
    Meeting = None
    import bbb_settings
except ImportError:
    bbb_settings = None

def macro_bbb(macro):
    Shows a list of all meetings with amount of participant and moderator
    On same directory as you need
    a "" module with the SALT and the BBB_API_URL.
    if Meeting is None or bbb_settings is None:
        return u""
    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",['format'])
    return wikiutil.renderText(request, Parser, raw)