- pyTivo
[pyTivo.git] / Config.py
blob1e2868104fa6b45e0f44bf59ccbd0ca5b83cc3c0
1 import ConfigParser, os
2 from ConfigParser import NoOptionError
4 BLACKLIST_169 = ('540', '649')
6 config = ConfigParser.ConfigParser()
7 p = os.path.dirname(__file__)
8 config.read(os.path.join(p, 'pyTivo.conf'))
10 def get169Setting(tsn):
11 if not tsn:
12 return True
14 if config.has_section('_tivo_' + tsn):
15 if config.has_option('_tivo_' + tsn, 'aspect169'):
16 if config.get('_tivo_' + tsn, 'aspect169').lower() == 'true':
17 return True
18 else:
19 return False
21 if tsn[:3] in BLACKLIST_169:
22 return False
24 return True
26 def getShares():
27 return filter( lambda x: not(x.startswith('_tivo_') or x == 'Server'), config.sections())
29 def getDebug():
30 try:
31 debug = config.get('Server', 'debug')
32 if debug.lower() == 'true':
33 return True
34 else:
35 return False
36 except NoOptionError:
37 return False