OSDN Git Service

tunerec: include <unistd.h> for usleep
[rec10/rec10-git.git] / rec10 / configreader.py
1 #!/usr/bin/python
2 # coding: UTF-8
3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2011 Yukikaze
5 import ConfigParser
6 import os
7 import os.path
8 mypath = str(os.path.dirname(os.path.abspath(__file__)))
9 confp = ConfigParser.SafeConfigParser()
10 Conf = 'rec10.conf'
11 confpath=""
12 if os.path.exists(os.path.join(mypath,Conf)):
13     confpath=os.path.join(mypath,Conf)
14 elif os.path.exists(os.path.join("/etc","rec10.conf")):
15     confpath=os.path.join("/etc","rec10.conf")
16 elif os.path.exists(os.path.join("/etc/rec10","rec10.conf")):
17     confpath=os.path.join("/etc/rec10","rec10.conf")
18 confp.read(confpath)
19 def getConfPath(string):
20     global confp
21     return confp.get('path', string)
22 def getConfDB(string):
23     global confp
24     return confp.get('db', string)
25 def getConfEnv(string):
26     global confp
27     return confp.get('env', string)
28 def getConfLog(string):
29     global confp
30     return confp.get('log', string)
31 def getConfDVB(string):
32     global confp
33     return confp.get('dvb',string)