-
Notifications
You must be signed in to change notification settings - Fork 0
/
cryptopaymon.py
63 lines (50 loc) · 1.67 KB
/
cryptopaymon.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import multiprocessing
import populatetxs
import addressmonitor
import statscollector
import commandhandler
import txparser
import tweetin
import tweetout
import utils
class cryptopaymon(object):
def __init__(self):
super(cryptopaymon, self).__init__()
# load config from conf file into dict
self.config = {
"dbfile": "cryptopaymon.sqlite",
"schemafile": "schema.sql",
}
self.conn = None
def start(self):
if not self.conn:
self.conn = utils.create_db(self.config["dbfile"], self.config["schemafile"])
try:
pt = multiprocessing.Process(target=populatetxs.populatetxs().run)
txp = multiprocessing.Process(target=txparser.txparser().run)
two = multiprocessing.Process(target=tweetout.tweetout().run)
ch = multiprocessing.Process(target=commandhandler.commandhandler().run)
twi = multiprocessing.Process(target=tweetin.tweetin().run)
sc = multiprocessing.Process(target=statscollector.statscollector().run)
am = multiprocessing.Process(target=addressmonitor.addressmonitor().run)
# these modules are independent of others
# update all txs in case we miss any
pt.start()
# provide features like tweet replies and statscollection
sc.start() ; two.start()
# these modules monitor and process txs
txp.start() ; am.start()
# these modules provide cnc feature
ch.start() ; twi.start()
pt.join()
sc.join() ; two.join()
txp.join() ; am.join()
ch.join() ; twi.join()
except:
import traceback
traceback.print_exc()
if __name__ == "__main__":
cpm = cryptopaymon()
cpm.start()