|
@@ -13,7 +13,12 @@ class Config:
|
13
|
13
|
path = "./fake-tracker.conf"
|
14
|
14
|
configParser = ConfigParser.ConfigParser()
|
15
|
15
|
configParser.read(path)
|
16
|
|
- self.general = self.configSectionMap(configParser, "General")
|
|
16
|
+ try:
|
|
17
|
+ self.general = self.configSectionMap(configParser, "General")
|
|
18
|
+ except:
|
|
19
|
+ self.general = {'maxratio' : 1,
|
|
20
|
+ "maxrate" : 120,
|
|
21
|
+ "torrentspath" : "."}
|
17
|
22
|
|
18
|
23
|
def configSectionMap(self, configParser, section):
|
19
|
24
|
dict1 = {}
|
|
@@ -25,8 +30,17 @@ class Config:
|
25
|
30
|
dict1[option] = None
|
26
|
31
|
return dict1
|
27
|
32
|
|
|
33
|
+ def getOption(self, option):
|
|
34
|
+ try:
|
|
35
|
+ return self.general[option]
|
|
36
|
+ except:
|
|
37
|
+ return None
|
|
38
|
+
|
28
|
39
|
def getMaxRatio(self):
|
29
|
|
- return int(self.general['maxratio'])
|
|
40
|
+ return int(self.getOption('maxratio'))
|
30
|
41
|
|
31
|
42
|
def getMaxRate(self):
|
32
|
|
- return int(self.general['maxrate'])
|
|
43
|
+ return int(self.getOption('maxrate'))
|
|
44
|
+
|
|
45
|
+ def getTorrentsPath(self):
|
|
46
|
+ return str(self.getOption('torrentspath'))
|