Skip to content

Commit 1773be0

Browse files
author
basti2342
committed
ledticker ported, now in use
1 parent 51d88d3 commit 1773be0

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

README

-6
This file was deleted.

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ Overview
66
* room status (for SpaceAPI etc.)
77
* extended information about our hackspace
88
* audio announcement system via long polling
9-
* LED ticker via long polling (still to come)
9+
* LED ticker via long polling
1010
* Mate-O-Meter (still to come)
1111
* MUC (xmpp) status
1212
* Wiki status (just redirects)
1313

14+
Dependencies
15+
============
16+
17+
* flask
18+
* [ledticker.py](https://github.com/hickerspace/ledticker/blob/master/ledticker.py)
19+
1420
Notes
1521
=====
1622
* Enable WSGIPassAuthorization to pass through authorisation headers:

longpolling.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from logger import log
33
import os
44
import time
5+
import ledticker
56
from conf import *
67

78
"""
@@ -37,11 +38,16 @@ def serveAnnouncement():
3738
possible, because of the inability to create port forwardings.
3839
"""
3940
def longPolling():
40-
# ledticker check belongs here
41-
while not os.path.exists(API_PATH+'/'+ESPEAK_FILE):
41+
ticker = ledticker.LedTicker(API_PATH + "/data/ledticker.txt")
42+
43+
while not os.path.exists(API_PATH+'/'+ESPEAK_FILE) and ticker.items_available() == 0:
4244
time.sleep(1)
4345

44-
if os.path.exists(API_PATH+'/'+ESPEAK_FILE):
46+
if ticker.items_available() != 0:
47+
# return new ticker messages if available
48+
return ticker.get_output()
49+
50+
elif os.path.exists(API_PATH+'/'+ESPEAK_FILE):
51+
# return new announcements (as mp3s) if available
4552
return serveAnnouncement()
4653

47-
# ..and here

0 commit comments

Comments
 (0)