Skip to content

Commit

Permalink
Hook in visual paging, fixes c-base/station-announcer#2
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed May 16, 2017
1 parent e446d23 commit b095277
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
53 changes: 53 additions & 0 deletions graphs/c-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
"time": {
"component": "c-flo/time"
},
"VisualPaging": {
"component": "c-flo/VisualPaging"
},
"weltenbaulab_panel": {
"component": "c-base/panel"
}
Expand Down Expand Up @@ -278,6 +281,16 @@
"port": "saytext"
}
},
{
"src": {
"process": "c_out_generator",
"port": "saytext"
},
"tgt": {
"process": "VisualPaging",
"port": "in"
}
},
{
"src": {
"process": "c_out_generator",
Expand Down Expand Up @@ -308,6 +321,16 @@
"port": "saytext_en"
}
},
{
"src": {
"process": "c_out_generator",
"port": "saytext_en"
},
"tgt": {
"process": "VisualPaging",
"port": "in"
}
},
{
"src": {
"process": "crew",
Expand Down Expand Up @@ -438,6 +461,36 @@
"port": "in"
}
},
{
"src": {
"process": "VisualPaging",
"port": "out"
},
"tgt": {
"process": "he1",
"port": "open"
}
},
{
"src": {
"process": "VisualPaging",
"port": "out"
},
"tgt": {
"process": "nerdctrl-display",
"port": "open"
}
},
{
"src": {
"process": "VisualPaging",
"port": "out"
},
"tgt": {
"process": "siri",
"port": "open"
}
},
{
"data": true,
"tgt": {
Expand Down
27 changes: 27 additions & 0 deletions participants/VisualPaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python2

import msgflo
import urllib

class VisualPaging(msgflo.Participant):
def __init__(self, role):
d = {
'component': 'c-flo/VisualPaging',
'label': 'Generate a visual paging URL for textual messages',
'icon': 'font',
'inports': [
{ 'id': 'in', 'type': 'string' },
],
'outports': [
{ 'id': 'out', 'type': 'string' },
],
}
msgflo.Participant.__init__(self, d, role)

def process(self, inport, msg):
url = 'https://c-base.github.io/station-announcer/?%s' % urllib.quote(msg.data)
self.send('out', url)
self.ack(msg)

if __name__ == '__main__':
msgflo.main(VisualPaging)

0 comments on commit b095277

Please sign in to comment.