-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·54 lines (37 loc) · 896 Bytes
/
main.py
File metadata and controls
executable file
·54 lines (37 loc) · 896 Bytes
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
#!/usr/bin/env python
import logging.config
import sys
import time
import schedule
import config
from presentation.max7219.max7219_scroller import Max7219Scroller
DEFAULT_ENCODING = "utf-8"
INFO_REFRESH_SECONDS = 5
logger = logging.getLogger()
current_provider = 0
providers = []
scroller = None
def _main():
try:
_configure_encoding()
_configure_logging()
_create_scroller()
_run_scheduler()
except KeyboardInterrupt:
pass
def _configure_encoding():
reload(sys)
sys.setdefaultencoding(DEFAULT_ENCODING)
def _configure_logging():
try:
logging.config.fileConfig(config.LOGGING_CONFIG)
except AttributeError:
pass
def _create_scroller():
scroller = Max7219Scroller()
def _run_scheduler():
while True:
schedule.run_pending()
time.sleep(1)
if __name__ == '__main__':
_main()