-
Notifications
You must be signed in to change notification settings - Fork 6
/
core.py
executable file
·44 lines (40 loc) · 1.35 KB
/
core.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
#!/bin/python
# -*- coding: utf-8 -*-
# vim:set ts=8 sts=8 sw=8 tw=80 noet cc=80:
import configparser
import logging
from module import Module
from storage import Storage
from msgdatabase import MessageDatabase
from search import Search
from pingpong import PingPong
from flooding import Flooding
from cli import CLI
class Core(Module):
def __init__(self, questions, search_engines, storage, maxlength,
paste):
super(Core, self).__init__(name="core")
self.storage = Storage(storage, parent=self)
self.messages = MessageDatabase(questions, parent=self)
self.search = Search(search_engines, parent=self)
self.pingpong = PingPong(parent=self)
self.flooding = Flooding(maxlength, paste, parent=self)
self.cli = CLI(parent=self)
self.log.info("load complete")
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO,
format='%(levelname)-8s %(message)s')
filename = "orakel.cfg"
config = configparser.SafeConfigParser()
config.read(filename)
questions = config.get("db", "questions")
search_engines = config.get("db", "searchengines")
storage = config.get("db", "storage")
maxlength = config.getint("modules", "flooding")
paste = config.get("modules", "paste")
core = Core(questions, search_engines, storage, maxlength, paste)
try:
core.start()
except KeyboardInterrupt:
core.log.info("unloading")
core.stop()