choices=[("-s2", _("DVB-S2 connected to DVB-S/S2")), ("-c", _("DVB-C")), ("-t", _("DVB-T")), ("-S2", _("DVB-S/S2 connected to DVB-S2")), ("-s", _("DVB-S connected to DVB-S/S2")), ("-S", _("DVB-S connected to DVB-S"))]) else: mode.type = ConfigSelection( default="", choices=[("", _("unused")), ("-s2", _("DVB-S2 connected to DVB-S/S2")), ("-c", _("DVB-C")), ("-t", _("DVB-T")), ("-S2", _("DVB-S2 connected to DVB-S2")), ("-s", _("DVB-S connected to DVB-S/S2")), ("-S", _("DVB-S connected to DVB-S"))]) mode.discover = ConfigYesNo(default=True) mode.ip = ConfigText(default="0.0.0.0") mode.port = ConfigInteger(default=39305, limits=(0, 49152)) mode.group = ConfigInteger(default=1, limits=(1, 255)) config.plugins.vTuner.client.mode.append(mode) def configCB(result, session): if result is True: f = open('/etc/vtunerc.conf', 'w') f.write("# this file is auto generated and will be overwritten\n") f.write("# DO NOT EDIT\n") if config.plugins.vTuner.client.enabled.value: f.write('DAEMON="/usr/sbin/vtunerc.mipsel"\n') else: f.write('DAEMON="/bin/true"\n')
from Components.ActionMap import ActionMap config.plugins.vTuner = ConfigSubsection() config.plugins.vTuner.client = ConfigSubsection() config.plugins.vTuner.client.enabled = ConfigYesNo(default=True) config.plugins.vTuner.client.mode = ConfigSubList() for i in [0,1,2]: mode = ConfigSubsection() if i == 0: # first type must not be none mode.type = ConfigSelection(default="-s2", choices = [("-s2", _("DVB-S2 connected to DVB-S/S2")),("-c", _("DVB-C")),("-t", _("DVB-T")), ("-S2", _("DVB-S/S2 connected to DVB-S2")), ("-s", _("DVB-S connected to DVB-S/S2")), ("-S", _("DVB-S connected to DVB-S")) ]) else: mode.type = ConfigSelection(default="", choices = [("", _("unused")), ("-s2", _("DVB-S2 connected to DVB-S/S2")),("-c", _("DVB-C")),("-t", _("DVB-T")), ("-S2", _("DVB-S2 connected to DVB-S2")), ("-s", _("DVB-S connected to DVB-S/S2")), ("-S", _("DVB-S connected to DVB-S")) ]) mode.discover = ConfigYesNo(default=True) mode.ip = ConfigText( default="0.0.0.0" ) mode.port = ConfigInteger(default = 39305, limits=(0, 49152) ) mode.group = ConfigInteger(default = 1, limits=(1, 255) ) config.plugins.vTuner.client.mode.append(mode) def configCB(result, session): if result is True: f = open('/etc/vtunerc.conf','w') f.write("# this file is auto generated and will be overwritten\n") f.write("# DO NOT EDIT\n") if config.plugins.vTuner.client.enabled.value: f.write('DAEMON="/usr/sbin/vtunerc.mipsel"\n') else: f.write('DAEMON="/bin/true"\n') options=""