-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathobjects.py
56 lines (48 loc) · 1.83 KB
/
objects.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
import os, os.path, gevent, pools, exchanges, coins, difficulty_sites, sys
import gevent
class Objects(object):
def __init__(self):
self.pools = set()
self.exchanges = set()
self.difficulty_sites = set()
self.coins = set()
self._setup()
def _setup(self):
"""
Sets up all of our objects correctly
"""
#Ugly hack to figure out where we are
try:
# determine if application is a script file or frozen exe
if hasattr(sys, 'frozen'):
FD_DIR = os.path.dirname(sys.executable)
else:
FD_DIR = os.path.dirname(os.path.abspath(__file__))
except:
FD_DIR = os.curdir
for file_name in os.listdir(os.path.join(FD_DIR,'difficulty_sites')):
self.difficulty_sites.add(difficulty_sites.Site(
reduce(os.path.join, [FD_DIR, 'difficulty_sites', file_name]),
self,
))
gevent.sleep(0)
#Parse config files and create objects
for file_name in os.listdir(os.path.join(FD_DIR,'coins')):
self.coins.add(coins.Coin(
reduce(os.path.join, [FD_DIR, 'coins', file_name, ]),
self,
))
for file_name in os.listdir(os.path.join(FD_DIR,'exchanges')):
self.exchanges.add(exchanges.Exchange(
reduce(os.path.join, [FD_DIR, 'exchanges', file_name]),
self ,
))
for file_name in os.listdir(os.path.join(FD_DIR,'pools')):
self.pools.add(pools.Pool(
reduce(os.path.join, [FD_DIR, 'pools', file_name]),
self
))
gevent.sleep(0.1)
if __name__ == "__main__":
Objects()
gevent.sleep(1)