Spacing.
[pyTivo/wgw.git] / plugins / admin / buildhelp.py
blob9d62884659e27582148e435327a3832544ce6c48
1 import os
3 SCRIPTDIR = os.path.dirname(__file__)
5 ## Build initial help list
6 help_list = {}
7 title = ''
8 settings_known = {}
9 multiline = ''
10 f = open(os.path.join(SCRIPTDIR, 'help.txt'))
11 try:
12 for line in f:
13 line = line.strip()
14 if multiline != '':
15 if (line.rfind('+\\') + 2) == len(line):
16 multiline += line[0:(len(line) - 2)]
17 continue
18 else:
19 multiline += line
20 help_list[title].append(multiline)
21 multiline = ''
22 continue
23 if line == '' or line.find('#') >= 0:
24 # skip blank or commented lines
25 continue
26 if line.find(':') <= 0:
27 title = line
28 help_list[title] = []
29 else:
30 value = line.split(':', 1)[0].strip()
31 data = line.split(':', 1)[1].strip()
32 if value.lower() == 'available in':
33 # special setting to create section_known array
34 data = data.split(',')
35 for section in data:
36 section = section.lower().strip()
37 if section not in settings_known:
38 settings_known[section] = []
39 settings_known[section].append(title)
40 else:
41 if (line.rfind('+\\') + 2) == len(line):
42 multiline += line[0:(len(line) - 2)]
43 else:
44 help_list[title].append(line)
45 finally:
46 f.close()
47 ## Done building help list
49 def gethelp():
50 return help_list
52 def getknown(section):
53 return settings_known[section]