1234567891011121314151617181920212223242526272829303132 |
- #! /usr/bin/env python
-
- import ConfigParser
- import sys
-
- class Config:
- general = {}
-
- def __init__(self, path=""):
- if path == "":
- path = "/etc/fake-tracker.conf"
- if sys.platform == "win32":
- path = "./fake-tracker.conf"
- configParser = ConfigParser.ConfigParser()
- configParser.read(path)
- self.general = self.configSectionMap(configParser, "General")
-
- def configSectionMap(self, configParser, section):
- dict1 = {}
- options = configParser.options(section)
- for option in options:
- try:
- dict1[option] = configParser.get(section, option)
- except:
- dict1[option] = None
- return dict1
-
- def getMaxRatio(self):
- return int(self.general['maxratio'])
-
- def getMaxRate(self):
- return int(self.general['maxrate'])
|