def __init__(self, tokens_filename, audio, log):
self._log = log
self._audio = audio
self._tokens_filename = tokens_filename
self._eventQueue = queue.Queue()
persist_path = "/tmp"
for directory in ("alerts", "alerts/all", "alerts/active"):
d = os.path.join(persist_path, directory)
if not os.path.exists(d):
os.mkdir(d)
# would prefer to use sqlite, but that complains about
# our threads accessing the same connection - and dbm seems to not
# store any changes.
self.allAlerts = Shove("file:///tmp/alerts/all")
self.activeAlerts = Shove("file:///tmp/alerts/active")
#print(list(self.allAlerts.values()))
self._last_user_activity = datetime.datetime.now()
t = threading.Thread(target=self.eventQueueThread, daemon=True)
t.start()
GObject.timeout_add(500, self.alertCheck)
评论列表
文章目录