-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfoscreen-livingroom.py
executable file
·106 lines (84 loc) · 2.66 KB
/
infoscreen-livingroom.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python3
import os
import curses
import showstatus
import showtimestamp
import showtemp
import showbikes
import showmpd
import showtraffic
import showheartbeat
import showsky
from infoscreen import Infoscreen
class Livingroom(Infoscreen):
mpd_name = "wohnzimmer"
def _init_windows(self):
statusw = showstatus.statuswin(1, 2, 29, 1)
self.add_window(
statusw,
[
{
"subscribe": ("club/status", 2),
"callback": statusw.update,
"json": False,
"utf8": False,
}
],
)
timew = showtimestamp.timewin(1, 4, 13, 4)
self.add_window(timew, [])
# tempw = showtemp.tempwin(17, 4, 13, 4, "28-000008a0fd0b")
# self.add_window(tempw,[])
bikesw = showbikes.bikeswin(33, 1, 44, 9)
self.add_window(
bikesw, [{"subscribe": ("bikes/nextbike", 2), "callback": bikesw.update}]
)
mpdw = showmpd.mpdwin(1, 10, 76, 4)
self.add_window(
mpdw,
[
{
"subscribe": ("mpd/{}/state".format(self.mpd_name), 2),
"callback": mpdw.update_state,
"json": False,
},
{
"subscribe": ("mpd/{}/song".format(self.mpd_name), 2),
"callback": mpdw.update_song,
"json": False,
},
],
)
trafficw = showtraffic.trafficwin(1, 14, 76, 19)
self.add_window(
trafficw,
[{"subscribe": ("traffic/departures", 2), "callback": trafficw.update}],
)
skyw = showsky.skywin(79, 1, 28, 9)
self.add_window(
skyw,
[{"subscribe": ("skynet", 2), "listen": "skynet", "callback": skyw.update}],
)
hbw = showheartbeat.heartbeatwin(79, 10, 28, 23)
self.add_window(
hbw,
[
{
"subscribe": ("heartbeat/#", 2),
"callback": lambda message: hbw.update(
message.topic, message.payload
),
"custom": True,
}
],
)
def main(stdscr):
os.system("setterm --blank poke")
os.system("setterm --blank 0")
curses.curs_set(False)
curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
info_screen = Livingroom("infoscreen/livingroom", stdscr)
info_screen.run()
if __name__ == "__main__":
curses.wrapper(main)