Browse Source

Support for room and track URLs

Allow to associate a URL to a room, for example a link to a video
conference room. Tracks assigned to this room will automatically inherit
the link. The link for a given track can be overridden using the "url"
command.

This allows organizers to provide video links for each room, while still
enabling teams to link to whatever they end up really using.

Change-Id: I633eb83c579e4093ae769bcd053e4d2ec2fe4bc3
changes/49/725249/2
Thierry Carrez 5 months ago
parent
commit
5538127768
6 changed files with 51 additions and 10 deletions
  1. +15
    -1
      README.rst
  2. +1
    -0
      base.json
  3. +3
    -3
      html/ptg.html
  4. +21
    -5
      html/ptg.js
  5. +2
    -0
      ptgbot/bot.py
  6. +9
    -1
      ptgbot/db.py

+ 15
- 1
README.rst View File

@@ -154,6 +154,20 @@ pass ``auto`` as the etherpad URL::

#keystone etherpad auto

url
---

A URL can be associated to a track, for example pointing to where the video
meeting happens. By default the bot points to the URL associated to the room,
if any. You can override it using the ``url`` command::

#keystone url https://meet.jit.si/awesome-keystone-meeting

If you set a track-specific URL and would like to remove it, you can pass
``none`` as the URL::

#keystone url none

color
-----

@@ -244,7 +258,7 @@ Join that channel and load base JSON data from a public URL (see base.json
for an example). You can use the pastebin service as a quick way to publish
that data::

~fetchdb http://paste.openstack.org/raw/793036/
~fetchdb http://paste.openstack.org/raw/793040/

Then you can give other commands to the bot, like::



+ 1
- 0
base.json View File

@@ -170,6 +170,7 @@
"WedP2": ""
},
"Ballroom A": {
"url": "http://meet.jit.si/DEN-ptg-BallroomA",
"FriA1": "nova",
"FriA2": "nova",
"FriP1": "nova",


+ 3
- 3
html/ptg.html View File

@@ -53,7 +53,7 @@
{{#each tracks as |track| }}
{{#if (lookup @root.now track) }}
<tr>
<td class="col-sm-1">{{trackbadge track}}</span></td>
<td class="col-sm-1">{{trackbadge @root.urls @root.location @root.schedule track}}</span></td>
<td>{{#trackContentLine}}{{lookup @root.now track}}{{/trackContentLine}}</td>
<td>{{lookup @root.location track}}
{{#if (checkins track)}}
@@ -80,7 +80,7 @@
{{#each tracks as |track| }}
{{#if (lookup @root.next track) }}
<tr>
<td class="col-sm-1">{{trackbadge track}}</span></td>
<td class="col-sm-1">{{trackbadge @root.urls @root.location @root.schedule track}}</span></td>
<td>
{{#each (lookup @root.next track) as |item|}}
{{#trackContentLine}}{{item}}{{/trackContentLine}} <br/>
@@ -121,7 +121,7 @@
<span class="glyphicon glyphicon-{{sched.cap_icon}}"
title="{{sched.cap_desc}}"></span>{{/if}}</td>
{{#each (lookup @root.slots day) as |time|}}
<td>{{ roomcode @root.schedule room time.name 0 }}</td>
<td>{{ roomcode @root.urls @root.schedule room time.name 0 }}</td>
{{/each}}
</tr>
{{/if}}


+ 21
- 5
html/ptg.js View File

@@ -57,20 +57,31 @@ function checkins_tooltip(track) {
}
}

function track_badge(track) {
function track_badge(track, roomurl) {
var title = checkins_tooltip(track);
if (roomurl != undefined) {
return '<a target="_blank" href="' + roomurl +
'" class="label label-primary ' +
track +
'" title="' + title + '">' + track;
}
return '<span class="label label-primary ' +
track +
'" title="' + title + '">' + track;
}

Handlebars.registerHelper('trackbadge',
function(track) {
return new Handlebars.SafeString(track_badge(track));
function(urls, locations, schedule, track) {
if (urls[track] != undefined) {
roomurl = urls[track];
} else {
roomurl = schedule[locations[track]]['url'];
}
return new Handlebars.SafeString(track_badge(track, roomurl));
});

Handlebars.registerHelper('roomcode',
function(schedule, room, timecode, s) {
function(urls, schedule, room, timecode, s) {
var cell = '';
if (schedule[room][timecode] != undefined) {
if (schedule[room][timecode] == "") {
@@ -80,7 +91,12 @@ Handlebars.registerHelper('roomcode',
cell = '<small><i>' + room + "-" + timecode + '</i></small>';
}
} else {
cell = track_badge(schedule[room][timecode]);
if (urls[schedule[room][timecode]] != undefined) {
url = urls[schedule[room][timecode]];
} else {
url = schedule[room]['url']
}
cell = track_badge(schedule[room][timecode], url);
}
}
return new Handlebars.SafeString(cell);


+ 2
- 0
ptgbot/bot.py View File

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


+ 9
- 1
ptgbot/db.py View File

@@ -36,6 +36,7 @@ class PTGDataBase():
'eventid': '',
'motd': {'message': '', 'level': 'info'},
'links': OrderedDict(),
'urls': OrderedDict(),
# Keys for last_check_in are lower-cased nicks;
# values are in the same format as BASE_CHECK_IN
'last_check_in': OrderedDict(),
@@ -64,7 +65,7 @@ class PTGDataBase():
# Add tracks mentioned in configuration that are not in track list
for room, bookings in self.data['schedule'].items():
for time, track in bookings.items():
if time in ['cap_icon', 'cap_desc']:
if time in ['cap_icon', 'cap_desc', 'url']:
continue
if track and track not in self.data['tracks']:
self.add_tracks([track])
@@ -89,6 +90,13 @@ class PTGDataBase():
self.data['etherpads'][track] = etherpad
self.save()

def add_url(self, track, url):
if url == 'none':
del(self.data['urls'][track])
else:
self.data['urls'][track] = url
self.save()

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


Loading…
Cancel
Save