from kaa.config import Config, Group, Var # tvdev imports from device import DVBCard # get logging object log = logging.getLogger('tvdev') # config object config = Config(schema=[]) rpcgroup = Group(desc='Remote access to the server', schema=[ Var(name='address', default='127.0.0.1:7600', desc='IP address and port to use for inter-process communication'), Var(name='password', default='', desc='Password to secure the communication')]) config.add_variable(name='rpc', value=rpcgroup) config.add_variable(name='directory', value=Var(default=os.path.expanduser('~/Videos'), desc='Default recording directory')) # list of detected cards log.info('Detecting DVB cards.') info = [] for i in range(10): if os.path.isdir('/dev/dvb/adapter%s' % i): try: card = DVBCard(i) # add card info.append(card) # add to global config object config.add_variable(name=card.device, value=card.config) log.debug('DVB card detected as dvb%s' % i)
Var(name='bar', default=u'bar', desc='more text\ndescription has two lines'), # group defined inside the basic schema Group(name='inline', desc='this is a subgroup', schema=[ Var(name='x', desc='desc_x', default=7 ), Var(name='y', type=range(0,5), desc='desc_y', default=3 ) ]) ]) # create extra group and add it to the schema subgroup = Group(desc='this is a subgroup', schema=[ Var(name='x', desc=u'desc_x with non ascii ü', default=7 ), # the next variable allows numbers from 0-4 Var(name='y', type=range(0,5), desc='desc_y', default=3 ) ]) config.add_variable('subgroup', subgroup) # create a group again deeper in the tree subsubgroup = Group(desc='desrc of subsubgroup', schema=[ Var(name='a', desc='desc a', default=3 ) ]) subgroup.add_variable('z', subsubgroup) # create a list of a group l = List(desc='desrc of list subsubgroup', schema=Group([ Var(name='a', type=int, desc='desc a', default=3 ), # z is again a group Group(name='z', desc='this is a subgroup', schema=[ Var(name='x', desc='desc_x', default=7 ), Var(name='y', type=range(0,5), desc='desc_y', default=3 ) ]) ])) subgroup.add_variable('list', l)
# get logging object log = logging.getLogger('tvdev') # config object config = Config(schema=[]) rpcgroup = Group( desc='Remote access to the server', schema=[ Var(name='address', default='127.0.0.1:7600', desc='IP address and port to use for inter-process communication'), Var(name='password', default='', desc='Password to secure the communication') ]) config.add_variable(name='rpc', value=rpcgroup) config.add_variable(name='directory', value=Var(default=os.path.expanduser('~/Videos'), desc='Default recording directory')) # list of detected cards log.info('Detecting DVB cards.') info = [] for i in range(10): if os.path.isdir('/dev/dvb/adapter%s' % i): try: card = DVBCard(i) # add card info.append(card) # add to global config object config.add_variable(name=card.device, value=card.config)