Browse Source

Generate etherpad links automatically

With this change, the ptgbot will generate links for each track
etherpad, display them on a specific page (etherpads.html) and
allow track moderators to override the autogenerated link using
the #track etherpad command.

It requires the database to contain an 'eventid' key which serves
as a unique etherpads prefix.

Change-Id: Iaa524530e9f2506369f180588a2b6f98f4cad3d1
changes/22/674622/2
Thierry Carrez 8 months ago
parent
commit
c360e15043
5 changed files with 73 additions and 1 deletions
  1. +14
    -1
      README.rst
  2. +47
    -0
      html/etherpads.html
  3. +1
    -0
      html/index.html
  4. +2
    -0
      ptgbot/bot.py
  5. +9
    -0
      ptgbot/db.py

+ 14
- 1
README.rst View File

@@ -141,6 +141,19 @@ issuing the ``clean`` command (with no argument). Example usage::

#ironic clean

etherpad
--------

By default the bot generates etherpad links for all tracks. If you already
have an etherpad, you can set its URL using the ``etherpad`` command::

#keystone etherpad https://etherpad.openstack.org/p/awesome-keystone-pad

If you set a URL and would like to revert to the autogenerated name, you can
pass ``auto`` as the etherpad URL::

#keystone etherpad auto

color
-----

@@ -229,7 +242,7 @@ In one terminal, run the bot::

Join that channel and give commands to the bot::

~fetchdb http://paste.openstack.org/raw/755516/
~fetchdb http://paste.openstack.org/raw/755522/
#swift now discussing ring placement

(note, the bot currently only takes commands from Freenode identified users)


+ 47
- 0
html/etherpads.html View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="180">
<title>List of PTG Etherpads</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="bootstrap-3.3.7.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h2>List of PTG Etherpads</h2>
<p>We use etherpads to track the agenda of topics that should be covered in
each track.<p>
<div id="PTGsessions">
</div>
</div>

<script id="PTGtemplate" type="text/x-handlebars-template">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Etherpad links</h3></div>
<div class="panel-body">
{{#if eventid}}
<ul class="list-unstyled">
{{#each tracks as |track| }}
<li>{{track}}:
{{#if (lookup @root.etherpads track) }}
<a href="{{lookup @root.etherpads track}}">{{lookup @root.etherpads track}}</a>
{{else}}
<a href="https://etherpad.openstack.org/p/{{@root.eventid}}-{{track}}">https://etherpad.openstack.org/p/{{@root.eventid}}-{{track}}</a>
{{/if}}
</li>
{{/each}}
</ul>
{{else}}
Missing eventid: can't generate unique etherpad links for this event.
{{/if}}
</div>
</div>
</script>

<script src="jquery-1.9.1.min.js"></script>
<script src="handlebars-4.0.6.js"></script>
<script src="bootstrap-3.3.7.min.js"></script>
<script src="ptg.js"></script>
</body>
</html>

+ 1
- 0
html/index.html View File

@@ -19,6 +19,7 @@
<ul>
<li><a href="https://www.openstack.org/ptg/">event details, overall schedule, travel info, FAQs</a></li>
<li><a href="ptg.html">current/next topics and room schedule</a></li>
<li><a href="etherpads.html">reference list of track etherpads</a></li>
<li><a href="https://opendev.org/openstack/ptgbot/src/branch/master/README.rst">instructions for interacting with the IRC bot</a></li>
<div id="ExtraLinks"></div>
</ul>


+ 2
- 0
ptgbot/bot.py View File

@@ -311,6 +311,8 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
self.notify(track, adverb, params)
elif adverb == 'clean':
self.data.clean_tracks([track])
elif adverb == 'etherpad':
self.data.add_etherpad(track, params)
elif adverb == 'color':
self.data.add_color(track, params)
elif adverb == 'location':


+ 9
- 0
ptgbot/db.py View File

@@ -28,10 +28,12 @@ class PTGDataBase():
'slots': OrderedDict(),
'now': OrderedDict(),
'next': OrderedDict(),
'etherpads': OrderedDict(),
'colors': OrderedDict(),
'location': OrderedDict(),
'schedule': OrderedDict(),
'voice': 0,
'eventid': '',
'motd': {'message': '', 'level': 'info'},
'links': OrderedDict(),
# Keys for last_check_in are lower-cased nicks;
@@ -80,6 +82,13 @@ class PTGDataBase():
del self.data['next'][track]
self.save()

def add_etherpad(self, track, etherpad):
if etherpad == 'auto':
del(self.data['etherpads'][track])
else:
self.data['etherpads'][track] = etherpad
self.save()

def add_color(self, track, color):
self.data['colors'][track] = color
self.save()


Loading…
Cancel
Save