Ejemplo n.º 1
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="FastScan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	def __init__(self, session):
		Screen.__init__(self, session)

		self.setTitle(_("FastScan"))

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keySave,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)

		def providerChanged(configEntry):
			if configEntry.value:
				nimList = [(str(x), nimmanager.nim_slots[x].friendly_full_description) for x in nimmanager.getNimListForSat(transponders[[x[1][0] for x in providers if x[0] == configEntry.value][0]][3])]
				self.scan_nims = ConfigSelection(default=lastConfiguration[0] if lastConfiguration and lastConfiguration[0] in [x[0] for x in nimList] else nimList[0][0], choices=nimList)
				self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)

		providerList = getProviderList()
		if lastConfiguration and lastConfiguration[1] in providerList:
			self.scan_provider = ConfigSelection(default=lastConfiguration[1], choices=[(None, _("None"))] + providerList)
			self.scan_provider.addNotifier(providerChanged)
			self.scan_hd = ConfigYesNo(default=lastConfiguration[2])
			self.scan_keepnumbering = ConfigYesNo(default=lastConfiguration[3])
			self.scan_keepsettings = ConfigYesNo(default=lastConfiguration[4])
			self.scan_create_radio_bouquet = ConfigYesNo(default=len(lastConfiguration) > 5 and lastConfiguration[5])
		else:
			self.scan_provider = ConfigSelection(default=None, choices=[(None, _("None"))] + providerList)
			self.scan_provider.addNotifier(providerChanged)
			self.scan_hd = ConfigYesNo(default=True)
			self.scan_keepnumbering = ConfigYesNo(default=True)
			self.scan_keepsettings = ConfigYesNo(default=False)
			self.scan_create_radio_bouquet = ConfigYesNo(default=False)
		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.config_autoproviders = {}
		auto_providers = config.misc.fastscan.autoproviders.value.split(",")
		for provider in providers:
			self.config_autoproviders[provider[0]] = ConfigYesNo(default=provider[0] in auto_providers)
		self.list = []
		ConfigListScreen.__init__(self, self.list)
		self.createSetup()
		self.finished_cb = None
		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))
		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("Save"))

	def createSetup(self):
		self.list = []
		self.list.append(self.scanProvider)
		if self.scan_provider.value:
			self.list.append(self.tunerEntry)
			for index in providers:
				if index[0] == self.scan_provider.value and index[1][2]:
					self.list.append(self.scanHD)
					break
			self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))
			self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))
			self.list.append(getConfigListEntry(_("Create separate radio userbouquet"), self.scan_create_radio_bouquet))
			self.list.append(getConfigListEntry(_("Drop unconfigured satellites"), config.misc.fastscan.drop))
			self.list.append(getConfigListEntry(_("Enable auto fastscan"), config.misc.fastscan.auto))
			if config.misc.fastscan.auto.value == "multi":
				for provider in providers:
					if nimmanager.getNimListForSat(transponders[provider[1][0]][3]):
						self.list.append(getConfigListEntry(_("Enable auto fastscan for %s") % provider[0], self.config_autoproviders[provider[0]]))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.createSetup()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.createSetup()

	def saveConfiguration(self):
		if self.scan_provider.value:
			config.misc.fastscan.last_configuration.value = (self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value, self.scan_create_radio_bouquet.value)
			auto_providers = []
			for provider in providers:
				if self.config_autoproviders[provider[0]].value:
					auto_providers.append(provider[0])
			config.misc.fastscan.autoproviders.value = ",".join(auto_providers)
		else:
			config.misc.fastscan.last_configuration.value = "()"
		config.misc.fastscan.save()

	def keySave(self):
		self.saveConfiguration()
		self.close()

	def keyGo(self):
		if self.scan_provider.value:
			self.saveConfiguration()
			self.startScan()

	def getTransponderParameters(self, number):
		transponderParameters = eDVBFrontendParametersSatellite()
		transponderParameters.frequency = transponders[number][0]
		transponderParameters.symbol_rate = transponders[number][1]
		transponderParameters.fec = transponders[number][2]
		transponderParameters.orbital_position = transponders[number][3]
		transponderParameters.polarisation = transponders[number][4]
		transponderParameters.inversion = transponders[number][5]
		transponderParameters.system = transponders[number][6]
		transponderParameters.modulation = transponders[number][7]
		transponderParameters.rolloff = transponders[number][8]
		transponderParameters.pilot = transponders[number][9]
		transponderParameters.is_id = eDVBFrontendParametersSatellite.No_Stream_Id_Filter
		transponderParameters.pls_mode = eDVBFrontendParametersSatellite.PLS_Gold
		transponderParameters.pls_code = eDVBFrontendParametersSatellite.PLS_Default_Gold_Code
		return transponderParameters

	def startScan(self):
		parameters = tuple(x[1] for x in providers if x[0] == self.scan_provider.value)[0]
		pid = parameters[1]
		if self.scan_hd.value and parameters[2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner=int(self.scan_nims.value),
				transponderParameters=self.getTransponderParameters(parameters[0]),
				scanPid=pid, keepNumbers=self.scan_keepnumbering.value, keepSettings=self.scan_keepsettings.value, createRadioBouquet=self.scan_create_radio_bouquet.value,
				providerName=self.scan_provider.getText())

	def keyCancel(self):
		self.close()
Ejemplo n.º 2
0
class FastScanScreen(ConfigListScreen, Screen):
    skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

    providers = [('Canal Digitaal', (1, 900, True)),
                 ('TV Vlaanderen', (1, 910, True)),
                 ('TéléSAT', (0, 920, True)), ('HD Austria', (0, 950, False)),
                 ('Diveo', (0, 960, False)),
                 ('Skylink Czech Republic', (1, 30, False)),
                 ('Skylink Slovak Republic', (1, 31, False)),
                 ('KabelKiosk', (0, 970, False)),
                 ('TéléSAT Astra3', (1, 920, True)),
                 ('HD Austria Astra3', (1, 950, False)),
                 ('Diveo Astra3', (1, 960, False)),
                 ('Canal Digitaal Astra 1', (0, 900, True)),
                 ('TV Vlaanderen  Astra 1', (0, 910, True))]

    transponders = ((12515000, 22000000,
                     eDVBFrontendParametersSatellite.FEC_5_6, 192,
                     eDVBFrontendParametersSatellite.Polarisation_Horizontal,
                     eDVBFrontendParametersSatellite.Inversion_Unknown,
                     eDVBFrontendParametersSatellite.System_DVB_S,
                     eDVBFrontendParametersSatellite.Modulation_QPSK,
                     eDVBFrontendParametersSatellite.RollOff_alpha_0_35,
                     eDVBFrontendParametersSatellite.Pilot_Off),
                    (12070000, 27500000,
                     eDVBFrontendParametersSatellite.FEC_3_4, 235,
                     eDVBFrontendParametersSatellite.Polarisation_Horizontal,
                     eDVBFrontendParametersSatellite.Inversion_Unknown,
                     eDVBFrontendParametersSatellite.System_DVB_S,
                     eDVBFrontendParametersSatellite.Modulation_QPSK,
                     eDVBFrontendParametersSatellite.RollOff_alpha_0_35,
                     eDVBFrontendParametersSatellite.Pilot_Off))

    def __init__(self, session, nimList):
        Screen.__init__(self, session)

        self.setTitle(_("Fast Scan"))

        self["actions"] = ActionMap(
            ["SetupActions", "MenuActions"], {
                "ok": self.keyGo,
                "save": self.keySave,
                "cancel": self.keyCancel,
                "menu": self.closeRecursive,
            }, -2)

        providerList = list(x[0] for x in self.providers)
        lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
        if not lastConfiguration or not lastConfiguration[1] in [
                x[0] for x in self.providers
        ]:
            self.scan_provider = ConfigSelection(default=None,
                                                 choices=[(None, _("None"))] +
                                                 providerList)
            self.scan_nims = ConfigSelection(default=nimList[0][0],
                                             choices=nimList)
            self.scan_hd = ConfigYesNo(default=True)
            self.scan_keepnumbering = ConfigYesNo(default=True)
            self.scan_keepsettings = ConfigYesNo(default=False)
            self.scan_create_radio_bouquet = ConfigYesNo(default=False)
        else:
            self.scan_provider = ConfigSelection(default=lastConfiguration[1],
                                                 choices=[(None, _("None"))] +
                                                 providerList)
            self.scan_nims = ConfigSelection(
                default=lastConfiguration[0] if lastConfiguration[0]
                in [x[0] for x in nimList] else nimList[0][0],
                choices=nimList)
            self.scan_hd = ConfigYesNo(default=lastConfiguration[2])
            self.scan_keepnumbering = ConfigYesNo(default=lastConfiguration[3])
            self.scan_keepsettings = ConfigYesNo(default=lastConfiguration[4])
            self.scan_create_radio_bouquet = ConfigYesNo(
                default=len(lastConfiguration) > 5 and lastConfiguration[5])
        self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
        self.scanProvider = getConfigListEntry(_("Provider"),
                                               self.scan_provider)
        self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
        self.config_autoproviders = {}
        auto_providers = config.misc.fastscan.autoproviders.value.split(",")
        for provider in self.providers:
            self.config_autoproviders[provider[0]] = ConfigYesNo(
                default=provider[0] in auto_providers)
        self.list = []
        ConfigListScreen.__init__(self, self.list)
        self.createSetup()
        self.finished_cb = None
        self["introduction"] = Label(
            _("Select your provider, and press OK to start the scan"))
        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("Save"))

    def createSetup(self):
        self.list = []
        self.list.append(self.scanProvider)
        if self.scan_provider.value:
            self.list.append(self.tunerEntry)
            self.list.append(self.scanHD)
            self.list.append(
                getConfigListEntry(_("Use fastscan channel numbering"),
                                   self.scan_keepnumbering))
            self.list.append(
                getConfigListEntry(_("Use fastscan channel names"),
                                   self.scan_keepsettings))
            self.list.append(
                getConfigListEntry(_("Create separate radio userbouquet"),
                                   self.scan_create_radio_bouquet))
            self.list.append(
                getConfigListEntry(_("Drop unconfigured satellites"),
                                   config.misc.fastscan.drop))
            self.list.append(
                getConfigListEntry(_("Enable auto fast scan"),
                                   config.misc.fastscan.auto))
            if config.misc.fastscan.auto.value == "multi":
                for provider in self.providers:
                    self.list.append(
                        getConfigListEntry(
                            _("Enable auto fast scan for %s") % provider[0],
                            self.config_autoproviders[provider[0]]))
        self["config"].list = self.list
        self["config"].l.setList(self.list)

    def keyLeft(self):
        ConfigListScreen.keyLeft(self)
        self.createSetup()

    def keyRight(self):
        ConfigListScreen.keyRight(self)
        self.createSetup()

    def saveConfiguration(self):
        if self.scan_provider.value:
            config.misc.fastscan.last_configuration.value = ` (
                self.scan_nims.value, self.scan_provider.value,
                self.scan_hd.value, self.scan_keepnumbering.value,
                self.scan_keepsettings.value,
                self.scan_create_radio_bouquet.value) `
            auto_providers = []
            for provider in self.providers:
                if self.config_autoproviders[provider[0]].value:
                    auto_providers.append(provider[0])
            config.misc.fastscan.autoproviders.value = ",".join(auto_providers)
        else:
            config.misc.fastscan.last_configuration.value = "()"
        config.misc.fastscan.save()

    def keySave(self):
        self.saveConfiguration()
        self.close()

    def keyGo(self):
        if self.scan_provider.value:
            self.saveConfiguration()
            self.startScan()

    def getTransponderParameters(self, number):
        transponderParameters = eDVBFrontendParametersSatellite()
        transponderParameters.frequency = self.transponders[number][0]
        transponderParameters.symbol_rate = self.transponders[number][1]
        transponderParameters.fec = self.transponders[number][2]
        transponderParameters.orbital_position = self.transponders[number][3]
        transponderParameters.polarisation = self.transponders[number][4]
        transponderParameters.inversion = self.transponders[number][5]
        transponderParameters.system = self.transponders[number][6]
        transponderParameters.modulation = self.transponders[number][7]
        transponderParameters.rolloff = self.transponders[number][8]
        transponderParameters.pilot = self.transponders[number][9]
        transponderParameters.is_id = eDVBFrontendParametersSatellite.No_Stream_Id_Filter
        transponderParameters.pls_mode = eDVBFrontendParametersSatellite.PLS_Gold
        transponderParameters.pls_code = 0
        return transponderParameters

    def startScan(self):
        parameters = tuple(x[1] for x in self.providers
                           if x[0] == self.scan_provider.value)[0]
        pid = parameters[1]
        if self.scan_hd.value and parameters[2]:
            pid += 1
        if self.scan_nims.value:
            self.session.open(
                FastScanStatus,
                scanTuner=int(self.scan_nims.value),
                transponderParameters=self.getTransponderParameters(
                    parameters[0]),
                scanPid=pid,
                keepNumbers=self.scan_keepnumbering.value,
                keepSettings=self.scan_keepsettings.value,
                createRadioBouquet=self.scan_create_radio_bouquet.value,
                providerName=self.scan_provider.getText())

    def keyCancel(self):
        self.close()
Ejemplo n.º 3
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	providers = [
		('Canal Digitaal', (1, 900, True)),
		('TV Vlaanderen', (1, 910, True)),
		('TéléSAT', (0, 920, True)),
		('HD Austria', (0, 950, False)),
		('Diveo', (0, 960, False)),
		('Skylink Czech Republic', (1, 30, False)),
		('Skylink Slovak Republic', (1, 31, False)),
		('KabelKiosk', (0, 970, False)),
		('TéléSAT Astra3', (1, 920, True)),
		('HD Austria Astra3', (1, 950, False)),
		('Diveo Astra3', (1, 960, False)),
		('Canal Digitaal Astra 1', (0, 900, True)),
		('TV Vlaanderen  Astra 1', (0, 910, True))]

	transponders = ((12515000, 22000000, eDVBFrontendParametersSatellite.FEC_5_6, 192,
		eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
		(12070000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 235,
		eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off))

	def __init__(self, session, nimList):
		Screen.__init__(self, session)

		self.setTitle(_("Fast Scan"))

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)
		providerList = list(x[0] for x in self.providers)
		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration or not lastConfiguration[1] in [x[0] for x in self.providers]:
			self.scan_provider = ConfigSelection(default=None, choices=[(None, _("None"))] + providerList)
			self.scan_nims = ConfigSelection(default=nimList[0][0], choices=nimList)
			self.scan_hd = ConfigYesNo(default=True)
			self.scan_keepnumbering = ConfigYesNo(default=True)
			self.scan_keepsettings = ConfigYesNo(default=False)
			self.scan_create_radio_bouquet = ConfigYesNo(default=False)
		else:
			self.scan_provider = ConfigSelection(default=lastConfiguration[1], choices=[(None, _("None"))] + providerList)
			self.scan_nims = ConfigSelection(default=lastConfiguration[0] if lastConfiguration[0] in [x[0] for x in nimList] else nimList[0][0], choices=nimList)
			self.scan_hd = ConfigYesNo(default=lastConfiguration[2])
			self.scan_keepnumbering = ConfigYesNo(default=lastConfiguration[3])
			self.scan_keepsettings = ConfigYesNo(default=lastConfiguration[4])
			self.scan_create_radio_bouquet = ConfigYesNo(default=len(lastConfiguration) > 5 and lastConfiguration[5])
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.config_autoproviders = {}
		auto_providers = config.misc.fastscan.autoproviders.value.split(",")
		for provider in self.providers:
			self.config_autoproviders[provider[0]] = ConfigYesNo(default=provider[0] in auto_providers )
		self.list = []
		ConfigListScreen.__init__(self, self.list)
		self.createSetup()
		self.finished_cb = None
		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))
		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("Save"))

	def createSetup(self):
		self.list = []
		self.list.append(self.scanProvider)
		if self.scan_provider.value:
			self.list.append(self.tunerEntry)
			self.list.append(self.scanHD)
			self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))
			self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))
			self.list.append(getConfigListEntry(_("Create separate radio userbouquet"), self.scan_create_radio_bouquet))
			self.list.append(getConfigListEntry(_("Drop unconfigured satellites"), config.misc.fastscan.drop))
			self.list.append(getConfigListEntry(_("Enable auto fast scan"), config.misc.fastscan.auto))
			if config.misc.fastscan.auto.value == "multi":
				for provider in self.providers:
					self.list.append(getConfigListEntry(_("Enable auto fast scan for %s") % provider[0], self.config_autoproviders[provider[0]]))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.createSetup()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.createSetup()

	def saveConfiguration(self):
		if self.scan_provider.value:
			config.misc.fastscan.last_configuration.value = `(self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value, self.scan_create_radio_bouquet.value)`
			auto_providers = []
			for provider in self.providers:
				if self.config_autoproviders[provider[0]].value:
					auto_providers.append(provider[0])
			config.misc.fastscan.autoproviders.value = ",".join(auto_providers)
		else:
			config.misc.fastscan.last_configuration.value = "()"
		config.misc.fastscan.save()

	def keySave(self):
		self.saveConfiguration()
		self.close()

	def keyGo(self):
		if self.scan_provider.value:
			self.saveConfiguration()
			self.startScan()

	def getTransponderParameters(self, number):
		transponderParameters = eDVBFrontendParametersSatellite()
		transponderParameters.frequency = self.transponders[number][0]
		transponderParameters.symbol_rate = self.transponders[number][1]
		transponderParameters.fec = self.transponders[number][2]
		transponderParameters.orbital_position = self.transponders[number][3]
		transponderParameters.polarisation = self.transponders[number][4]
		transponderParameters.inversion = self.transponders[number][5]
		transponderParameters.system = self.transponders[number][6]
		transponderParameters.modulation = self.transponders[number][7]
		transponderParameters.rolloff = self.transponders[number][8]
		transponderParameters.pilot = self.transponders[number][9]
		transponderParameters.is_id = eDVBFrontendParametersSatellite.No_Stream_Id_Filter
		transponderParameters.pls_mode = eDVBFrontendParametersSatellite.PLS_Gold
		transponderParameters.pls_code = eDVBFrontendParametersSatellite.PLS_Default_Gold_Code
		transponderParameters.t2mi_plp_id = eDVBFrontendParametersSatellite.No_T2MI_PLP_Id
		return transponderParameters

	def startScan(self):
		parameters = tuple(x[1] for x in self.providers if x[0] == self.scan_provider.value)[0]
		pid = parameters[1]
		if self.scan_hd.value and parameters[2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.value),
				transponderParameters = self.getTransponderParameters(parameters[0]),
				scanPid = pid, keepNumbers = self.scan_keepnumbering.value, keepSettings = self.scan_keepsettings.value, createRadioBouquet = self.scan_create_radio_bouquet.value,
				providerName = self.scan_provider.getText())

	def keyCancel(self):
		self.close()
Ejemplo n.º 4
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	providers = [
		('Canal Digitaal', (1, 900, True)),
		('TV Vlaanderen', (1, 910, True)),
		('TéléSAT', (0, 920, True)),
		('HD Austria', (0, 950, False)),
		('Skylink Czech Republic', (1, 30, False)),
		('Skylink Slovak Republic', (1, 31, False)),
		('AustriaSat Magyarország Eutelsat 9E', (2, 951, False)),
		('AustriaSat Magyarország Astra 3', (1, 951, False)),
		('TéléSAT Astra3', (1, 920, True)),
		('HD Austria Astra3', (1, 950, False)),
		('Canal Digitaal Astra 1', (0, 900, True)),
		('TV Vlaanderen  Astra 1', (0, 910, True))]

	transponders = ((12515000, 22000000, eDVBFrontendParametersSatellite.FEC_5_6, 192,
		eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
		(12070000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 235,
		eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
		(12074000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 90,
		eDVBFrontendParametersSatellite.Polarisation_Vertical, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S2, eDVBFrontendParametersSatellite.Modulation_8PSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_On))

	def __init__(self, session, nimList):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keySave,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		providerList = list(x[0] for x in self.providers)

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration or not tuple(x for x in self.providers if x[0] == lastConfiguration[1]):
			lastConfiguration = (nimList[0][0], providerList[0], True, True, False)

		self.scan_nims = ConfigSelection(default = lastConfiguration[0], choices = nimList)
		self.scan_provider = ConfigSelection(default = lastConfiguration[1], choices = providerList)
		self.scan_hd = ConfigYesNo(default = lastConfiguration[2])
		self.scan_keepnumbering = ConfigYesNo(default = lastConfiguration[3])
		self.scan_keepsettings = ConfigYesNo(default = lastConfiguration[4])

		self.list = []
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.list.append(self.scanProvider)

		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.list.append(self.scanHD)

		self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))
		self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))
		self.list.append(getConfigListEntry(_("Enable auto fast scan"), config.misc.fastscan.auto))

		ConfigListScreen.__init__(self, self.list)
		self["config"].list = self.list
		self["config"].l.setList(self.list)

		self.finished_cb = None

		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))

	def saveConfiguration(self):
		config.misc.fastscan.last_configuration.value = `(self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value)`
		config.misc.fastscan.save()

	def keySave(self):
		self.saveConfiguration()
		self.close()

	def keyGo(self):
		self.saveConfiguration()
		self.startScan()

	def getTransponderParameters(self, number):
		transponderParameters = eDVBFrontendParametersSatellite()
		transponderParameters.frequency = self.transponders[number][0]
		transponderParameters.symbol_rate = self.transponders[number][1]
		transponderParameters.fec = self.transponders[number][2]
		transponderParameters.orbital_position = self.transponders[number][3]
		transponderParameters.polarisation = self.transponders[number][4]
		transponderParameters.inversion = self.transponders[number][5]
		transponderParameters.system = self.transponders[number][6]
		transponderParameters.modulation = self.transponders[number][7]
		transponderParameters.rolloff = self.transponders[number][8]
		transponderParameters.pilot = self.transponders[number][9]
		return transponderParameters

	def startScan(self):
		parameters = tuple(x[1] for x in self.providers if x[0] == self.scan_provider.value)[0]
		pid = parameters[1]
		if self.scan_hd.value and parameters[2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.value),
				transponderParameters = self.getTransponderParameters(parameters[0]),
				scanPid = pid, keepNumbers = self.scan_keepnumbering.value, keepSettings = self.scan_keepsettings.value,
				providerName = self.scan_provider.getText())

	def keyCancel(self):
		self.close()
Ejemplo n.º 5
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	providers = [
		('Canal Digitaal', (1, 900, True)),
		('TV Vlaanderen', (1, 910, True)),
		('TéléSAT', (0, 920, True)),
		('HD Austria', (0, 950, False)),
		('Skylink Czech Republic', (1, 30, False)),
		('Skylink Slovak Republic', (1, 31, False)),
		('AustriaSat Magyarország Eutelsat 9E', (2, 951, False)),
		('AustriaSat Magyarország Astra 3', (1, 951, False)),
		('TéléSAT Astra3', (1, 920, True)),
		('HD Austria Astra3', (1, 950, False)),
		('Canal Digitaal Astra 1', (0, 900, True)),
		('TV Vlaanderen  Astra 1', (0, 910, True))]

	transponders = ((12515000, 22000000, eDVBFrontendParametersSatellite.FEC_5_6, 192,
		eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
		(12070000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 235,
		eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
		(12074000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 90,
		eDVBFrontendParametersSatellite.Polarisation_Vertical, eDVBFrontendParametersSatellite.Inversion_Unknown,
		eDVBFrontendParametersSatellite.System_DVB_S2, eDVBFrontendParametersSatellite.Modulation_8PSK,
		eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_On))

	def __init__(self, session, nimList):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keySave,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		providerList = list(x[0] for x in self.providers)

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration or not tuple(x for x in self.providers if x[0] == lastConfiguration[1]):
			lastConfiguration = (nimList[0][0], providerList[0], True, True, False)

		self.scan_nims = ConfigSelection(default = lastConfiguration[0], choices = nimList)
		self.scan_provider = ConfigSelection(default = lastConfiguration[1], choices = providerList)
		self.scan_hd = ConfigYesNo(default = lastConfiguration[2])
		self.scan_keepnumbering = ConfigYesNo(default = lastConfiguration[3])
		self.scan_keepsettings = ConfigYesNo(default = lastConfiguration[4])

		self.list = []
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.list.append(self.scanProvider)

		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.list.append(self.scanHD)

		self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))
		self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))
		self.list.append(getConfigListEntry(_("Enable auto fast scan"), config.misc.fastscan.auto))

		ConfigListScreen.__init__(self, self.list)
		self["config"].list = self.list
		self["config"].l.setList(self.list)

		self.finished_cb = None

		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))

	def saveConfiguration(self):
		config.misc.fastscan.last_configuration.value = `(self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value)`
		config.misc.fastscan.save()

	def keySave(self):
		self.saveConfiguration()
		self.close()

	def keyGo(self):
		self.saveConfiguration()
		self.startScan()

	def getTransponderParameters(self, number):
		transponderParameters = eDVBFrontendParametersSatellite()
		transponderParameters.frequency = self.transponders[number][0]
		transponderParameters.symbol_rate = self.transponders[number][1]
		transponderParameters.fec = self.transponders[number][2]
		transponderParameters.orbital_position = self.transponders[number][3]
		transponderParameters.polarisation = self.transponders[number][4]
		transponderParameters.inversion = self.transponders[number][5]
		transponderParameters.system = self.transponders[number][6]
		transponderParameters.modulation = self.transponders[number][7]
		transponderParameters.rolloff = self.transponders[number][8]
		transponderParameters.pilot = self.transponders[number][9]
		return transponderParameters

	def startScan(self):
		parameters = tuple(x[1] for x in self.providers if x[0] == self.scan_provider.value)[0]
		pid = parameters[1]
		if self.scan_hd.value and parameters[2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.value),
				transponderParameters = self.getTransponderParameters(parameters[0]),
				scanPid = pid, keepNumbers = self.scan_keepnumbering.value, keepSettings = self.scan_keepsettings.value,
				providerName = self.scan_provider.getText())

	def keyCancel(self):
		self.close()
Ejemplo n.º 6
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		nim_list = []
		# collect all nims which are *not* set to "nothing"
		for n in nimmanager.nim_slots:
			if not n.isCompatible("DVB-S"):
				continue
			if n.config_mode == "nothing":
				continue
			if n.config_mode in ("loopthrough", "satposdepends"):
				root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value))
				if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa
					continue
			nim_list.append((str(n.slot), n.friendly_full_description))

		self.scan_nims = ConfigSelection(choices = nim_list)
		provider_list = []
		provider_list.append((str(900), 'Canal Digitaal'))
		provider_list.append((str(910), 'TV Vlaanderen'))
		provider_list.append((str(920), 'TéléSAT'))
		provider_list.append((str(930), 'Mobistar NL'))
		provider_list.append((str(940), 'Mobistar FR'))
		provider_list.append((str(950), 'AustriaSat'))
		provider_list.append((str(30),  'Czech Republic'))
		provider_list.append((str(31),  'Slovak Republic'))

		self.scan_provider = ConfigSelection(choices = provider_list)
		self.scan_hd = ConfigYesNo(default = False)
		self.scan_keepnumbering = ConfigYesNo(default = False)
		self.scan_keepsettings = ConfigYesNo(default = False)

		self.list = []
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.list.append(self.scanProvider)

		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.list.append(self.scanHD)

		self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))

		self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))

		ConfigListScreen.__init__(self, self.list)
		self["config"].list = self.list
		self["config"].l.setList(self.list)

		self.finished_cb = None

		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))

	def keyGo(self):
		self.startScan()

	def startScan(self):
		pid = int(self.scan_provider.value)
		if self.scan_hd.value and pid >=900 and pid < 930:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.value), scanPid = pid, keepNumbers = self.scan_keepnumbering.value, keepSettings = self.scan_keepsettings.value, providerName = self.scan_provider.getText())

	def keyCancel(self):
		self.close()
Ejemplo n.º 7
0
class FastScanScreen(ConfigListScreen, Screen):
    skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

    def __init__(self, session, nimList):
        Screen.__init__(self, session)
        self.prevservice = self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.setTitle(_("Fast Scan"))

        self.providers = {}

        #hacky way
        self.providers['Astra_19_AustriaSat'] = (0, 900, True)
        self.providers['DigiTV'] = (0, 900, True)
        self.providers['FocusSat'] = (0, 900, True)
        self.providers['Freesat_Czech_Republic'] = (0, 900, True)
        self.providers['Freesat_Hungary'] = (0, 900, True)
        self.providers['Freesat_Moldavia'] = (0, 900, True)
        self.providers['Freesat_Romania'] = (0, 900, True)
        self.providers['Freesat_Slovenske'] = (0, 900, True)
        self.providers['HDPlus'] = (0, 900, True)
        self.providers['Own_Scan'] = (0, 900, True)
        self.providers['Sky_de_Full'] = (0, 900, True)
        self.providers['Sky_de_Bundesliga'] = (0, 900, True)
        self.providers['Sky_de_Cinema'] = (0, 900, True)
        self.providers['Sky_de_Entertainment'] = (0, 900, True)
        self.providers['Sky_de_Sport'] = (0, 900, True)
        self.providers['Sky_de_Starter'] = (0, 900, True)
        self.providers['UPC'] = (0, 900, True)

        #orgin
        self.providers['CanalDigitaal'] = (1, 900, True)
        self.providers['Canal Digitaal Astra 1'] = (0, 900, True)
        self.providers['TV Vlaanderen'] = (1, 910, True)
        self.providers['TV Vlaanderen  Astra 1'] = (0, 910, True)
        self.providers['TéléSAT'] = (0, 920, True)
        self.providers['TéléSAT Astra3'] = (1, 920, True)
        self.providers['HD Austria'] = (0, 950, False)
        self.providers['Fast Scan Deutschland'] = (0, 960, False)
        self.providers['Fast Scan Deutschland Astra3'] = (1, 960, False)
        self.providers['Skylink Czech Republic'] = (1, 30, False)
        self.providers['Skylink Slovak Republic'] = (1, 31, False)
        self.providers['AustriaSat Magyarország Eutelsat 9E'] = (2, 951,
                                                                        False)
        self.providers['AustriaSat Magyarország Astra 3'] = (1, 951,
                                                                    False)

        self.transponders = (
            (12515000, 22000000, eDVBFrontendParametersSatellite.FEC_5_6, 192,
             eDVBFrontendParametersSatellite.Polarisation_Horizontal,
             eDVBFrontendParametersSatellite.Inversion_Unknown,
             eDVBFrontendParametersSatellite.System_DVB_S,
             eDVBFrontendParametersSatellite.Modulation_QPSK,
             eDVBFrontendParametersSatellite.RollOff_alpha_0_35,
             eDVBFrontendParametersSatellite.Pilot_Off),
            (12070000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 235,
             eDVBFrontendParametersSatellite.Polarisation_Horizontal,
             eDVBFrontendParametersSatellite.Inversion_Unknown,
             eDVBFrontendParametersSatellite.System_DVB_S,
             eDVBFrontendParametersSatellite.Modulation_QPSK,
             eDVBFrontendParametersSatellite.RollOff_alpha_0_35,
             eDVBFrontendParametersSatellite.Pilot_Off))

        self.session.postScanService = session.nav.getCurrentlyPlayingServiceOrGroup(
        )

        self["actions"] = ActionMap(
            ["SetupActions", "MenuActions"], {
                "ok": self.keyGo,
                "save": self.keyGo,
                "cancel": self.keyCancel,
                "menu": self.closeRecursive,
            }, -2)

        providerList = list(x[0] for x in sorted(self.providers.iteritems(),
                                                 key=operator.itemgetter(0)))

        lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
        if not lastConfiguration:
            lastConfiguration = (nimList[0][0], providerList[0], True, True,
                                 False,
                                 config.usage.alternative_number_mode.value)
        self.scan_nims = ConfigSelection(default=lastConfiguration[0],
                                         choices=nimList)
        self.scan_provider = ConfigSelection(default=lastConfiguration[1],
                                             choices=providerList)
        self.scan_hd = ConfigYesNo(default=lastConfiguration[2])
        self.scan_keepnumbering = ConfigYesNo(default=lastConfiguration[3])
        self.scan_keepsettings = ConfigYesNo(default=lastConfiguration[4])
        self.scan_alternative_number_mode = ConfigYesNo(
            default=lastConfiguration[5])

        self.list = []
        self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
        self.list.append(self.tunerEntry)

        self.scanProvider = getConfigListEntry(_("Provider"),
                                               self.scan_provider)
        self.list.append(self.scanProvider)

        self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
        self.list.append(self.scanHD)

        self.list.append(
            getConfigListEntry(_("Use fastscan channel numbering"),
                               self.scan_keepnumbering))
        self.list.append(
            getConfigListEntry(_("Use fastscan channel names"),
                               self.scan_keepsettings))
        self.list.append(
            getConfigListEntry(_("Use alternate bouquets numbering"),
                               self.scan_alternative_number_mode))

        ConfigListScreen.__init__(self, self.list)
        self["config"].list = self.list
        self["config"].l.setList(self.list)

        self.finished_cb = None

        self["introduction"] = Label(
            _("Select your provider, and press OK to start the scan"))

    def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation,
                          fec, inversion, orbital_position, system, modulation,
                          rolloff, pilot):
        parm = eDVBFrontendParametersSatellite()
        parm.modulation = modulation
        parm.system = system
        parm.frequency = frequency * 1000
        parm.symbol_rate = symbol_rate * 1000
        parm.polarisation = polarisation
        parm.fec = fec
        parm.inversion = inversion
        parm.orbital_position = orbital_position
        parm.rolloff = rolloff
        parm.pilot = pilot
        tlist.append(parm)

    def restoreService(self):
        if self.prevservice:
            self.session.nav.playService(self.prevservice)

    def readXML(self, xml):
        global ret
        self.session.nav.stopService()
        tlist = []
        self.path = "/etc/enigma2"
        lastsc1 = self.path + "/userbouquet.LastScanned.tv"
        favlist1 = self.path + "/bouquets.tv"
        newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
        if os.path.isfile(favlist1):
            f = open(favlist1, "a+")
            ret = f.read().split("\n")
            if newbouq11 in ret:
                yy = ret.index(newbouq11)
                ret.pop(yy)
            f.close()
            os.remove(favlist1)
        yx = [newbouq11]
        yx.extend(ret)
        yz = open(favlist1, "w")
        yz.write("\n".join(map(lambda x: str(x), yx)))
        yz.close()
        h = open('/etc/enigma2/userbouquet.LastScanned.tv', "w")
        h.write("#NAME Last Scanned\n")
        h.close()
        eDVBDB.getInstance().reloadBouquets()
        import xml.dom.minidom as minidom
        try:
            xmldoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + xml + ".xml"
            xmldoc = minidom.parse(xmldoc)
            tr_list = xmldoc.getElementsByTagName('transporder')
            for lista in tr_list:
                frequency = lista.getAttribute("frequency")
                symbolrate = lista.getAttribute("symbolrate")
                fec = lista.getAttribute("fec")
                orbpos = lista.getAttribute("orbpos")
                pol = lista.getAttribute("pol")
                system = lista.getAttribute("system")
                modulation = lista.getAttribute("modulation")

                self.frequency = frequency
                self.symbolrate = symbolrate
                if pol == "H":
                    pol = 0
                elif pol == "V":
                    pol = 1
                elif pol == "L":
                    pol = 2
                elif pol == "R":
                    pol = 3
                self.polarization = pol  # 0 - H, 1 - V, 2- CL, 3 - CR

                if fec == "Auto":
                    fec = 0
                elif fec == "1/2":
                    fec = 1
                elif fec == "2/3":
                    fec = 2
                elif fec == "3/4":
                    fec = 3
                elif fec == "3/5":
                    fec = 4
                elif fec == "4/5":
                    fec = 5
                elif fec == "5/6":
                    fec = 6
                elif fec == "7/8":
                    fec = 7
                elif fec == "8/9":
                    fec = 8
                elif fec == "9/10":
                    fec = 9

                self.fec = fec  # 0 - Auto, 1 - 1/2, 2 - 2/3, 3 - 3/4, 4 - 3/5, 5 - 4/5, 6 - 5/6, 7 - 7/8, 8 - 8/9 , 9 - 9/10,

                self.inversion = 2  # 0 - off, 1 -on, 2 - AUTO

                self.orbpos = orbpos

                if system == "DVBS":
                    system = 0
                elif system == "DVBS2":
                    system = 1

                self.system = system  # DVB-S = 0, DVB-S2 = 1

                if modulation == "QPSK":
                    modulation = 1
                elif modulation == "8PSK":
                    modulation = 2

                self.modulation = modulation  # 0- QPSK, 1 -8PSK

                self.rolloff = 0  #

                self.pilot = 2  # 0 - off, 1 - on 2 - AUTO

                self.addSatTransponder(tlist, int(self.frequency),
                                       int(self.symbolrate),
                                       int(self.polarization), int(fec),
                                       int(self.inversion), int(orbpos),
                                       int(self.system), int(self.modulation),
                                       int(self.rolloff), int(self.pilot))

            self.session.openWithCallback(
                self.bouqmake, ServiceScan, [{
                    "transponders": tlist,
                    "feid": int(self.scan_nims.value),
                    "flags": 0,
                    "networkid": 0
                }])
        except:
            #self.session.open(MessageBox, _("xml File missing, please check it."), MessageBox.TYPE_ERROR)
            print "xml File missing, please check it."

    def bouqmake(self, session):
        prov = self.scan_provider.value.lower()
        global sname
        global ret
        ret1 = ret
        if prov == "sky_de_full":
            provlist = [
                'Sky_de_Bundesliga', 'Sky_de_Cinema', 'Sky_de_Entertainment',
                'Sky_de_Sport', 'Sky_de_Starter'
            ]
            for xprov in provlist:
                newprov = xprov
                self.path = "/etc/enigma2"
                lastsc = self.path + "/userbouquet.LastScanned.tv"
                newbouq = self.path + "/userbouquet." + newprov + ".tv"
                newbouq_unsort = self.path + "/userbouquet." + newprov + ".tv_unsort"
                favlist = self.path + "/bouquets.tv"
                newbouq_unsortlist = self.path + newbouq_unsort
                newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + newprov + '.tv" ORDER BY bouquet\r'
                newbouq2 = '#NAME ' + newprov + ' '
                newbouq3 = '"userbouquet.' + newprov + '.tv"'
                newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
                path = self.path
                try:
                    txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + newprov.lower(
                    ) + ".txt"
                    hh = []
                    gg = open(txtdoc, "r")
                    reta = gg.read().split("\n")
                    gg.close()
                    ff = open(lastsc, "r")
                    retb = ff.read().split("\n")
                    ff.close()
                    i = 1
                    wx = [newbouq2]
                    wx1 = [newbouq2]
                    if retb[1].startswith("#SERVICE"):
                        while i + 1 < len(retb):
                            self.updateServiceName(int(i))
                            if sname in reta:
                                wx.append(sname + " " + retb[i])

                            i += 1
                        wz = open(newbouq_unsort, "w")
                        wz.write("\n".join(map(lambda x: str(x), wx)))
                        wz.close()
                        for wwww in reta:
                            for s in wx:
                                www1 = s.rsplit("#", 1)
                                wwww1 = www1[0].rstrip()
                                if wwww1 == wwww:
                                    s1 = "#" + www1[1]
                                    wx1.append(s1)
                                    break
                        wz1 = open(newbouq, "w")
                        wz1.write("\n".join(map(lambda x: str(x), wx1)))
                        wz1.close()
                        rety = []
                        if os.path.isfile(favlist):
                            os.remove(favlist)
                        if os.path.isfile(newbouq_unsortlist):
                            os.remove(newbouq_unsortlist)
                        for zz in ret1:
                            if newbouq3 in zz:
                                print "no Service add"
                            else:
                                rety.append(zz)
                        rety[1:1] = [newbouq1]
                        ret1 = rety
                        wv = open(favlist, "w")
                        wv.write("\n".join(map(lambda x: str(x), rety)))
                        wv.close()
#eDVBDB.getInstance().reloadBouquets()
                    else:
                        wv = open(favlist, "w")
                        wv.write("\n".join(map(lambda x: str(x), ret1)))
                        wv.close()
                        #eDVBDB.getInstance().reloadBouquets()
                        self.keyCancel()
                except:
                    print 'My error, value:no xml found'
            eDVBDB.getInstance().reloadBouquets()
#####new
        elif prov in ('freesat_czech_republic', 'freesat_hungary',
                      'freesat_moldavia', 'freesat_slovenske'):
            self.path = "/etc/enigma2"
            lastsc = self.path + "/userbouquet.LastScanned.tv"
            newbouq = self.path + "/userbouquet." + self.scan_provider.value + ".tv"
            newbouq_unsort = self.path + "/userbouquet." + self.scan_provider.value + ".tv_unsort"
            favlist = self.path + "/bouquets.tv"
            newbouq_unsortlist = self.path + newbouq_unsort
            newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + self.scan_provider.value + '.tv" ORDER BY bouquet\r'
            newbouq2 = '#NAME ' + self.scan_provider.value + ' '
            newbouq3 = '"userbouquet.' + self.scan_provider.value + '.tv"'
            newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
            path = self.path
            prefix = self.scan_provider.value
            try:
                txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + self.scan_provider.value.lower(
                ) + ".txt"
                hh = []
                gg = open(txtdoc, "r")
                reta = gg.read().split("\n")
                gg.close()
                ff = open(lastsc, "r")
                retb = ff.read().split("\n")
                ff.close()
                i = 1
                wx = [newbouq2]
                wx1 = [newbouq2]
                if retb[1].startswith("#SERVICE"):
                    while i + 1 < len(retb):
                        self.updateServiceName(int(i))
                        if sname in reta:
                            wx.append(sname + " " + retb[i])

                        i += 1
                    wz = open(newbouq_unsort, "w")
                    wz.write("\n".join(map(lambda x: str(x), wx)))
                    wz.close()
                    for wwww in reta:
                        for s in wx:
                            www1 = s.rsplit("#", 1)
                            wwww1 = www1[0].rstrip()
                            if wwww1 == wwww:
                                s1 = "#" + www1[1]
                                wx1.append(s1)
                                break
                    wz1 = open(newbouq, "w")
                    wz1.write("\n".join(map(lambda x: str(x), wx1)))
                    wz1.close()

                    rety = []
                    if os.path.isfile(favlist):
                        os.remove(favlist)
                    if os.path.isfile(newbouq_unsortlist):
                        os.remove(newbouq_unsortlist)
                    for zz in ret:
                        if newbouq3 in zz:
                            print "no Service add"
                        else:
                            rety.append(zz)
                    rety[1:1] = [newbouq1]
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), rety)))
                    wv.close()
                    os.system(
                        'cp /usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/bouq/'
                        + newbouq3 + ' /etc/enigma2/')
                    eDVBDB.getInstance().reloadBouquets()

                else:
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), ret)))
                    wv.close()
                    eDVBDB.getInstance().reloadBouquets()
                    self.keyCancel()
            except:
                print 'My error, value:no xml found'
#self.session.open(MessageBox, _("Chanel-txt File missing, please check it."), MessageBox.TYPE_ERROR)
###new end

        else:
            self.path = "/etc/enigma2"
            lastsc = self.path + "/userbouquet.LastScanned.tv"
            newbouq = self.path + "/userbouquet." + self.scan_provider.value + ".tv"
            newbouq_unsort = self.path + "/userbouquet." + self.scan_provider.value + ".tv_unsort"
            favlist = self.path + "/bouquets.tv"
            newbouq_unsortlist = self.path + newbouq_unsort
            newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + self.scan_provider.value + '.tv" ORDER BY bouquet\r'
            newbouq2 = '#NAME ' + self.scan_provider.value + ' '
            newbouq3 = '"userbouquet.' + self.scan_provider.value + '.tv"'
            newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
            path = self.path
            prefix = self.scan_provider.value
            try:
                txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + self.scan_provider.value.lower(
                ) + ".txt"
                hh = []
                gg = open(txtdoc, "r")
                reta = gg.read().split("\n")
                gg.close()
                ff = open(lastsc, "r")
                retb = ff.read().split("\n")
                ff.close()
                i = 1
                wx = [newbouq2]
                wx1 = [newbouq2]
                if retb[1].startswith("#SERVICE"):
                    while i + 1 < len(retb):
                        self.updateServiceName(int(i))
                        if sname in reta:
                            wx.append(sname + " " + retb[i])

                        i += 1
                    wz = open(newbouq_unsort, "w")
                    wz.write("\n".join(map(lambda x: str(x), wx)))
                    wz.close()
                    for wwww in reta:
                        for s in wx:
                            www1 = s.rsplit("#", 1)
                            wwww1 = www1[0].rstrip()
                            if wwww1 == wwww:
                                s1 = "#" + www1[1]
                                wx1.append(s1)
                                break
                    wz1 = open(newbouq, "w")
                    wz1.write("\n".join(map(lambda x: str(x), wx1)))
                    wz1.close()

                    rety = []
                    if os.path.isfile(favlist):
                        os.remove(favlist)
                    if os.path.isfile(newbouq_unsortlist):
                        os.remove(newbouq_unsortlist)
                    for zz in ret:
                        if newbouq3 in zz:
                            print "no Service add"
                        else:
                            rety.append(zz)
                    rety[1:1] = [newbouq1]
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), rety)))
                    wv.close()
                    eDVBDB.getInstance().reloadBouquets()

                else:
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), ret)))
                    wv.close()
                    eDVBDB.getInstance().reloadBouquets()
                    self.keyCancel()
            except:
                print 'My error, value:no xml found'

#self.session.open(MessageBox, _("Chanel-txt File missing, please check it."), MessageBox.TYPE_ERROR)

    def searchNumberHelper(self, serviceHandler, num, bouquet):
        servicelist = self.serviceHandler.list(bouquet)
        if not servicelist is None:
            while num:
                serviceIterator = servicelist.getNext()
                if not serviceIterator.valid():  #check end of list
                    break
                playable = not (serviceIterator.flags &
                                (eServiceReference.isMarker
                                 | eServiceReference.isDirectory))
                if playable:
                    num -= 1
            if not num:  #found service with searched number ?
                return serviceIterator, 0
        return None, num

    def updateServiceName(self, number):
        global sname
        bouquet = InfoBar.instance.servicelist.bouquet_root
        service = None
        self.serviceHandler = eServiceCenter.getInstance()
        serviceHandler = self.serviceHandler
        bouquetlist = serviceHandler.list(bouquet)
        if not bouquetlist is None:
            while number:
                bouquet = bouquetlist.getNext()
                if not bouquet.valid():  #check end of list
                    break
                if bouquet.flags & eServiceReference.isDirectory:
                    service, number = self.searchNumberHelper(
                        serviceHandler, number, bouquet)
        if service is not None:
            info = serviceHandler.info(service)
            sname = info.getName(service).replace('\xc2\x86',
                                                  '').replace('\xc2\x87', '')
        else:
            sname = _("Unknown Service")

    def keyGo(self):
        prov = self.scan_provider.value.lower()
        if prov == "astra_19_austriasat" or prov == "digitv" or prov == "focussat" or prov == "freesat_czech_republic" or prov == "freesat_hungary" or prov == "freesat_moldavia" or prov == "freesat_slovenske" or prov == "freesat_romania" or prov == "hdplus" or prov == "own_scan" or prov == "sky_de_starter" or prov == "sky_de_cinema" or prov == "sky_de_sport" or prov == "sky_de_bundesliga" or prov == "sky_de_entertainment" or prov == "sky_de_full" or prov == "upc":
            if self.scan_alternative_number_mode.value == True:
                config.usage.alternative_number_mode.value = True
                config.usage.alternative_number_mode.save()
            else:
                config.usage.alternative_number_mode.value = False
                config.usage.alternative_number_mode.save()
            config.misc.fastscan.last_configuration.value = ` (
                self.scan_nims.value, self.scan_provider.value,
                self.scan_hd.value, self.scan_keepnumbering.value,
                self.scan_keepsettings.value,
                self.scan_alternative_number_mode.value) `
            config.misc.fastscan.save()
            self.readXML(self.scan_provider.value.lower())
        else:
            if self.scan_alternative_number_mode.value == True:
                config.usage.alternative_number_mode.value = True
                config.usage.alternative_number_mode.save()
            else:
                config.usage.alternative_number_mode.value = False
                config.usage.alternative_number_mode.save()
            config.misc.fastscan.last_configuration.value = ` (
                self.scan_nims.value, self.scan_provider.value,
                self.scan_hd.value, self.scan_keepnumbering.value,
                self.scan_keepsettings.value,
                self.scan_alternative_number_mode.value) `
            config.misc.fastscan.save()
            self.startScan()

    def getTransponderParameters(self, number):
        transponderParameters = eDVBFrontendParametersSatellite()
        transponderParameters.frequency = self.transponders[number][0]
        transponderParameters.symbol_rate = self.transponders[number][1]
        transponderParameters.fec = self.transponders[number][2]
        transponderParameters.orbital_position = self.transponders[number][3]
        transponderParameters.polarisation = self.transponders[number][4]
        transponderParameters.inversion = self.transponders[number][5]
        transponderParameters.system = self.transponders[number][6]
        transponderParameters.modulation = self.transponders[number][7]
        transponderParameters.rolloff = self.transponders[number][8]
        transponderParameters.pilot = self.transponders[number][9]
        return transponderParameters

    def startScan(self):
        pid = self.providers[self.scan_provider.value][1]
        if self.scan_hd.value and self.providers[self.scan_provider.value][2]:
            pid += 1
        if self.scan_nims.value:
            self.session.open(
                FastScanStatus,
                scanTuner=int(self.scan_nims.value),
                transponderParameters=self.getTransponderParameters(
                    self.providers[self.scan_provider.value][0]),
                scanPid=pid,
                keepNumbers=self.scan_keepnumbering.value,
                keepSettings=self.scan_keepsettings.value,
                providerName=self.scan_provider.getText(),
                alternative_number_mode=config.usage.alternative_number_mode.
                value)

    def keyCancel(self):
        self.restoreService()
        self.close()
Ejemplo n.º 8
0
class FastScanScreen(ConfigListScreen, Screen):
    skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)
        self.setTitle(_("Fast Scan"))

        self["actions"] = ActionMap(
            ["SetupActions", "MenuActions"], {
                "ok": self.keyGo,
                "cancel": self.keyCancel,
                "menu": self.closeRecursive,
            }, -2)

        nim_list = []
        # collect all nims which are *not* set to "nothing"
        for n in nimmanager.nim_slots:
            if not n.isCompatible("DVB-S"):
                continue
            if n.config_mode == "nothing":
                continue
            if n.config_mode in ("loopthrough", "satposdepends"):
                root_id = nimmanager.sec.getRoot(
                    n.slot_id, int(n.config.connectedTo.getValue()))
                if n.type == nimmanager.nim_slots[
                        root_id].type:  # check if connected from a DVB-S to DVB-S2 Nim or vice versa
                    continue
            nim_list.append((str(n.slot), n.friendly_full_description))

        self.scan_nims = ConfigSelection(choices=nim_list)
        provider_list = []
        provider_list.append((str(900), 'Canal Digitaal'))
        provider_list.append((str(910), 'TV Vlaanderen'))
        provider_list.append((str(920), 'TéléSAT'))
        provider_list.append((str(930), 'Mobistar NL'))
        provider_list.append((str(940), 'Mobistar FR'))
        provider_list.append((str(950), 'AustriaSat'))
        provider_list.append((str(30), 'Czech Republic'))
        provider_list.append((str(31), 'Slovak Republic'))

        self.scan_provider = ConfigSelection(choices=provider_list)
        self.scan_hd = ConfigYesNo(default=True)
        self.scan_keepnumbering = ConfigYesNo(default=False)
        self.scan_keepsettings = ConfigYesNo(default=False)

        self.list = []
        self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
        self.list.append(self.tunerEntry)

        self.scanProvider = getConfigListEntry(_("Provider"),
                                               self.scan_provider)
        self.list.append(self.scanProvider)

        self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
        self.list.append(self.scanHD)

        self.list.append(
            getConfigListEntry(_("Use fastscan channel numbering"),
                               self.scan_keepnumbering))

        self.list.append(
            getConfigListEntry(_("Use fastscan channel names"),
                               self.scan_keepsettings))

        ConfigListScreen.__init__(self, self.list)
        self["config"].list = self.list
        self["config"].l.setList(self.list)

        self.finished_cb = None

        self["introduction"] = Label(
            _("Select your provider, and press OK to start the scan"))

    def keyGo(self):
        self.startScan()

    def startScan(self):
        pid = int(self.scan_provider.getValue())
        if self.scan_hd.getValue() and pid >= 900 and pid < 930:
            pid += 1
        if self.scan_nims.getValue():
            self.session.open(FastScanStatus,
                              scanTuner=int(self.scan_nims.getValue()),
                              scanPid=pid,
                              keepNumbers=self.scan_keepnumbering.getValue(),
                              keepSettings=self.scan_keepsettings.getValue(),
                              providerName=self.scan_provider.getText())

    def keyCancel(self):
        self.close()
Ejemplo n.º 9
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	def __init__(self, session, nimList):
		Screen.__init__(self, session)
		self.setTitle(_("Fast Scan"))
		
		self.providers = {}
		
		#hacky way
		self.providers['Kontinent'] = (0, 900, True)
		self.providers['Ntvplus'] = (0, 900, True)
		self.providers['Raduga'] = (0, 900, True)
		self.providers['Telekarta'] = (0, 900, True)
		self.providers['Tricolor'] = (0, 900, True)
		
		#orgin
		self.providers['Canal Digitaal'] = (1, 900, True)
		self.providers['TV Vlaanderen'] = (1, 910, True)
		self.providers['TéléSAT'] = (0, 920, True)
		self.providers['AustriaSat'] = (0, 950, False)
		self.providers['Skylink Czech Republic'] = (1, 30, False)
		self.providers['Skylink Slovak Republic'] = (1, 31, False)
		self.providers['TéléSAT Astra3'] = (1, 920, True)
		self.providers['AustriaSat Astra3'] = (1, 950, False)
		self.providers['Canal Digitaal Astra 1'] = (0, 900, True)
		self.providers['TV Vlaanderen  Astra 1'] = (0, 910, True)
		
		self.transponders = ((12515000, 22000000, eDVBFrontendParametersSatellite.FEC_5_6, 192,
			eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
			eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
			eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
			(12070000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 235,
			eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
			eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
			eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off))

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		providerList = list(x[0] for x in sorted(self.providers.iteritems(), key = operator.itemgetter(1)))

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration:
			lastConfiguration = (nimList[0][0], providerList[0], True, True, False)

		self.scan_nims = ConfigSelection(default = lastConfiguration[0], choices = nimList)
		self.scan_provider = ConfigSelection(default = lastConfiguration[1], choices = providerList)
		self.scan_hd = ConfigYesNo(default = lastConfiguration[2])
		self.scan_keepnumbering = ConfigYesNo(default = lastConfiguration[3])
		self.scan_keepsettings = ConfigYesNo(default = lastConfiguration[4])

		self.list = []
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.list.append(self.scanProvider)

		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.list.append(self.scanHD)

		self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))

		self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))

		ConfigListScreen.__init__(self, self.list)
		self["config"].list = self.list
		self["config"].l.setList(self.list)

		self.finished_cb = None

		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))


	def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation, rolloff, pilot):
		print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + " rolloff" + str(rolloff) + " pilot" + str(pilot)
		print "orbpos: " + str(orbital_position)
		parm = eDVBFrontendParametersSatellite()
		parm.modulation = modulation
		parm.system = system
		parm.frequency = frequency * 1000
		parm.symbol_rate = symbol_rate * 1000
		parm.polarisation = polarisation
		parm.fec = fec
		parm.inversion = inversion
		parm.orbital_position = orbital_position
		parm.rolloff = rolloff
		parm.pilot = pilot
		tlist.append(parm)
		
	def readXML(self, xml):
		tlist = []

		import xml.dom.minidom as minidom
		xmldoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + xml + ".xml"
		xmldoc = minidom.parse(xmldoc)
		tr_list = xmldoc.getElementsByTagName('transporder')
		for lista in tr_list:      
			frequency = lista.getAttribute("frequency")
			symbolrate = lista.getAttribute("symbolrate")
			fec = lista.getAttribute("fec")
			orbpos = lista.getAttribute("orbpos")
			pol = lista.getAttribute("pol")
			system = lista.getAttribute("system")
			modulation = lista.getAttribute("modulation")
					
			self.frequency = frequency
			self.symbolrate = symbolrate
			if pol == "H":
			    pol = 0
			elif pol == "V":
			    pol = 1
			elif pol == "L":
			    pol = 2
			elif pol == "R":
			    pol = 3
			self.polarization =  pol # 0 - H, 1 - V, 2- CL, 3 - CR

			if fec == "Auto":
			    fec = 0
			elif fec == "1/2":
			    fec = 1
			elif fec == "2/3":
			    fec = 2
			elif fec == "3/4":
			    fec = 3
			elif fec == "3/5":
			    fec = 4
			elif fec == "4/5":
			    fec = 5
			elif fec == "5/6":
			    fec = 6
			elif fec == "7/8":
			    fec = 7
			elif fec == "8/9":
			    fec = 8
			elif fec == "9/10":
			    fec = 9
		
			self.fec = fec # 0 - Auto, 1 - 1/2, 2 - 2/3, 3 - 3/4, 4 - 3/5, 5 - 4/5, 6 - 5/6, 7 - 7/8, 8 - 8/9 , 9 - 9/10,
			
			self.inversion = 2 # 0 - off, 1 -on, 2 - AUTO
			
			self.orbpos = orbpos
			
			if system == "DVBS":
			    system = 0
			elif system == "DVBS2":
			    system = 1
			    
			self.system = system # DVB-S = 0, DVB-S2 = 1
			
			if modulation == "QPSK":
			    modulation = 0
			elif modulation == "8PSK":
			    modulation = 1
			    
			self.modulation = modulation # 0- QPSK, 1 -8PSK
			
			self.rolloff = 0 #
			
			self.pilot = 2 # 0 - off, 1 - on 2 - AUTO
		
			print "add sat transponder"
			self.addSatTransponder(tlist, int(self.frequency),
						int(self.symbolrate),
						int(self.polarization),
						int(fec),
						int(self.inversion),
						int(orbpos),
						int(self.system),
						int(self.modulation),
						int(self.rolloff),
						int(self.pilot))
		 
		self.session.open(ServiceScan, [{"transponders": tlist, "feid": int(self.scan_nims.getValue()), "flags": 0, "networkid": 0}])
									
	def keyGo(self):
		prov = self.scan_provider.value.lower()
		if prov == "tricolor" or prov == "kontinent" or prov == "telekarta" or prov == "ntvplus" or prov == "raduga":
		  self.readXML(self.scan_provider.value.lower())
		else:
		  config.misc.fastscan.last_configuration.value = `(self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value)`
		  config.misc.fastscan.save()
		  self.startScan()


	def getTransponderParameters(self, number):
		transponderParameters = eDVBFrontendParametersSatellite()
		transponderParameters.frequency = self.transponders[number][0]
		transponderParameters.symbol_rate = self.transponders[number][1]
		transponderParameters.fec = self.transponders[number][2]
		transponderParameters.orbital_position = self.transponders[number][3]
		transponderParameters.polarisation = self.transponders[number][4]
		transponderParameters.inversion = self.transponders[number][5]
		transponderParameters.system = self.transponders[number][6]
		transponderParameters.modulation = self.transponders[number][7]
		transponderParameters.rolloff = self.transponders[number][8]
		transponderParameters.pilot = self.transponders[number][9]
		return transponderParameters

	def startScan(self):
		pid = self.providers[self.scan_provider.getValue()][1]
		if self.scan_hd.getValue() and self.providers[self.scan_provider.value][2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.getValue()),
				transponderParameters = self.getTransponderParameters(self.providers[self.scan_provider.getValue()][0]),
				scanPid = pid, keepNumbers = self.scan_keepnumbering.getValue(), keepSettings = self.scan_keepsettings.getValue(),
				providerName = self.scan_provider.getText())

	def keyCancel(self):
		self.close()
Ejemplo n.º 10
0
class FastScanScreen(ConfigListScreen, Screen):
	skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

	def __init__(self, session, nimList):
		Screen.__init__(self, session)
		self.prevservice = self.session.nav.getCurrentlyPlayingServiceReference()
		self.setTitle(_("Fast Scan"))
		
		self.providers = {}
		
		#hacky way
		self.providers['Astra_19_AustriaSat'] = (0, 900, True)	
		self.providers['DigiTV'] = (0, 900, True)                	
		self.providers['FocusSat'] = (0, 900, True)
		self.providers['Freesat_Czech_Republic'] = (0, 900, True)
		self.providers['Freesat_Hungary'] = (0, 900, True)
		self.providers['Freesat_Moldavia'] = (0, 900, True)
		self.providers['Freesat_Romania'] = (0, 900, True)		
		self.providers['Freesat_Slovenske'] = (0, 900, True)
		self.providers['HDPlus'] = (0, 900, True)
		self.providers['UPC'] = (0, 900, True)                		
		
		#orgin
		self.providers['CanalDigitaal'] = (1, 900, True)
		self.providers['Canal Digitaal Astra 1'] = (0, 900, True)
		self.providers['TV Vlaanderen'] = (1, 910, True)
		self.providers['TV Vlaanderen  Astra 1'] = (0, 910, True)
		self.providers['TéléSAT'] = (0, 920, True)
		self.providers['TéléSAT Astra3'] = (1, 920, True)
		self.providers['HD Austria'] = (0, 950, False)
		self.providers['Fast Scan Deutschland'] = (0, 960, False)
		self.providers['Fast Scan Deutschland Astra3'] = (1, 960, False) 
		self.providers['Skylink Czech Republic'] = (1, 30, False)
		self.providers['Skylink Slovak Republic'] = (1, 31, False)
		self.providers['AustriaSat Magyarország Eutelsat 9E'] = (2, 951, False)
		self.providers['AustriaSat Magyarország Astra 3'] = (1, 951, False)
		
				
		

		
		self.transponders = ((12515000, 22000000, eDVBFrontendParametersSatellite.FEC_5_6, 192,
			eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
			eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
			eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off),
			(12070000, 27500000, eDVBFrontendParametersSatellite.FEC_3_4, 235,
			eDVBFrontendParametersSatellite.Polarisation_Horizontal, eDVBFrontendParametersSatellite.Inversion_Unknown,
			eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK,
			eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off))
			
                self.session.postScanService = session.nav.getCurrentlyPlayingServiceOrGroup()
                
		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		providerList = list(x[0] for x in sorted(self.providers.iteritems(), key = operator.itemgetter(0)))

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration:
			lastConfiguration = (nimList[0][0], providerList[0], True, True, False, config.usage.alternative_number_mode.value)
                print "nimList;", nimList
		self.scan_nims = ConfigSelection(default = lastConfiguration[0], choices = nimList)
		self.scan_provider = ConfigSelection(default = lastConfiguration[1], choices = providerList)
		self.scan_hd = ConfigYesNo(default = lastConfiguration[2])
		self.scan_keepnumbering = ConfigYesNo(default = lastConfiguration[3])
		self.scan_keepsettings = ConfigYesNo(default = lastConfiguration[4])
		self.scan_alternative_number_mode = ConfigYesNo(default = lastConfiguration[5])

		self.list = []
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.list.append(self.scanProvider)

		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.list.append(self.scanHD)

		self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))
                self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))
		self.list.append(getConfigListEntry(_("Use alternate bouquets numbering"), self.scan_alternative_number_mode))

		ConfigListScreen.__init__(self, self.list)
		self["config"].list = self.list
		self["config"].l.setList(self.list)

		self.finished_cb = None

		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))


	def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation, rolloff, pilot):
		print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + " rolloff" + str(rolloff) + " pilot" + str(pilot)
		print "orbpos: " + str(orbital_position)
		parm = eDVBFrontendParametersSatellite()
		parm.modulation = modulation
		parm.system = system
		parm.frequency = frequency * 1000
		parm.symbol_rate = symbol_rate * 1000
		parm.polarisation = polarisation
		parm.fec = fec
		parm.inversion = inversion
		parm.orbital_position = orbital_position
		parm.rolloff = rolloff
		parm.pilot = pilot
		tlist.append(parm)
		
	def restoreService(self):
		if self.prevservice:
			self.session.nav.playService(self.prevservice)


	def readXML(self, xml):
	        global ret
                self.session.nav.stopService()
		tlist = []
		self.path = "/etc/enigma2"
	       	lastsc1 = self.path + "/userbouquet.LastScanned.tv"
	       	favlist1 = self.path + "/bouquets.tv"
	       	newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
                if os.path.isfile(favlist1):              
                         f = open(favlist1, "a+")
                         ret = f.read().split("\n")
		         if newbouq11 in ret:
				yy = ret.index(newbouq11)
				ret.pop(yy)
                         f.close()
                         os.remove(favlist1)
                yx = [newbouq11]
                yx.extend(ret)
                yz = open(favlist1, "w")
                yz.write("\n".join(map(lambda x: str(x), yx)))
                yz.close()     
                h = open('/etc/enigma2/userbouquet.LastScanned.tv', "w")
                h.write("#NAME Last Scanned\n")
                h.close()
                eDVBDB.getInstance().reloadBouquets()                	
		import xml.dom.minidom as minidom
		try:
                	xmldoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + xml + ".xml"
			xmldoc = minidom.parse(xmldoc)
			tr_list = xmldoc.getElementsByTagName('transporder')
			for lista in tr_list:      
				frequency = lista.getAttribute("frequency")
				symbolrate = lista.getAttribute("symbolrate")
				fec = lista.getAttribute("fec")
				orbpos = lista.getAttribute("orbpos")
				pol = lista.getAttribute("pol")
				system = lista.getAttribute("system")
				modulation = lista.getAttribute("modulation")
					
				self.frequency = frequency
				self.symbolrate = symbolrate
				if pol == "H":
			    		pol = 0
				elif pol == "V":
			    		pol = 1
				elif pol == "L":
			    		pol = 2
				elif pol == "R":
			    		pol = 3
				self.polarization =  pol # 0 - H, 1 - V, 2- CL, 3 - CR

				if fec == "Auto":
			    		fec = 0
				elif fec == "1/2":
			    		fec = 1
				elif fec == "2/3":
			    		fec = 2
				elif fec == "3/4":
			    		fec = 3
				elif fec == "3/5":
			    		fec = 4
				elif fec == "4/5":
			    		fec = 5
				elif fec == "5/6":
			    		fec = 6
				elif fec == "7/8":
			    		fec = 7
				elif fec == "8/9":
			    		fec = 8
				elif fec == "9/10":
			    		fec = 9
		
				self.fec = fec # 0 - Auto, 1 - 1/2, 2 - 2/3, 3 - 3/4, 4 - 3/5, 5 - 4/5, 6 - 5/6, 7 - 7/8, 8 - 8/9 , 9 - 9/10,
			
				self.inversion = 2 # 0 - off, 1 -on, 2 - AUTO
			
				self.orbpos = orbpos
			
				if system == "DVBS":
			    		system = 0
				elif system == "DVBS2":
			    		system = 1
			    
				self.system = system # DVB-S = 0, DVB-S2 = 1
			
				if modulation == "QPSK":
			    		modulation = 0
				elif modulation == "8PSK":
			    		modulation = 1
			    
				self.modulation = modulation # 0- QPSK, 1 -8PSK
			
				self.rolloff = 0 #
			
				self.pilot = 2 # 0 - off, 1 - on 2 - AUTO
		
				print "add sat transponder"
				self.addSatTransponder(tlist, int(self.frequency),
							int(self.symbolrate),
							int(self.polarization),
							int(fec),
							int(self.inversion),
							int(orbpos),
							int(self.system),
							int(self.modulation),
							int(self.rolloff),
							int(self.pilot))
		 
                        print "tuner:", int(self.scan_nims.value)
                	self.session.openWithCallback(self.bouqmake, ServiceScan, [{"transponders": tlist, "feid": int(self.scan_nims.value), "flags": 0, "networkid": 0}])
                except:
                        #self.session.open(MessageBox, _("xml File missing, please check it."), MessageBox.TYPE_ERROR)
                        print "xml File missing, please check it."
									
	def bouqmake(self, session):
		prov = self.scan_provider.value.lower()
		global sname
		self.path = "/etc/enigma2"
		lastsc = self.path + "/userbouquet.LastScanned.tv"
		newbouq = self.path + "/userbouquet." + self.scan_provider.value + ".tv"
		newbouq_unsort = self.path + "/userbouquet." + self.scan_provider.value + ".tv_unsort"
       		favlist = self.path + "/bouquets.tv"
       		newbouq_unsortlist = self.path + newbouq_unsort
       		newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + self.scan_provider.value + '.tv" ORDER BY bouquet\r'
       		newbouq2 = '#NAME ' + self.scan_provider.value + ' '
       		newbouq3 = '"userbouquet.' + self.scan_provider.value + '.tv"'
               	newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
               	path = self.path
       		prefix = self.scan_provider.value 
       		try:
               		txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + self.scan_provider.value.lower() + ".txt"
       			hh = []
               		gg = open(txtdoc, "r")
       			reta = gg.read().split("\n")
			gg.close()
               		ff = open(lastsc, "r")
       			retb = ff.read().split("\n")
			ff.close()
       			i = 1
       			wx = [newbouq2]
       			wx1 = [newbouq2]
                		
                        while i+1 < len(retb):	       
              			self.updateServiceName(int(i))
                               	print "sname:", sname
                               	if sname in reta:
                                       	wx.append(sname + " " + retb[i])
                        	
                       		i +=1
                	wz = open(newbouq_unsort, "w")
                	wz.write("\n".join(map(lambda x: str(x), wx)))    #wx ersetzen mit neuer liste
                	wz.close()
                        for wwww in reta:
                        	for s in wx:
                                        if wwww in s:
                                                s1 = s.lstrip(wwww)
                                       		wx1.append(s1)
                               	                break
                	wz1 = open(newbouq, "w")
                	wz1.write("\n".join(map(lambda x: str(x), wx1)))    #wx ersetzen mit neuer liste
                	wz1.close()
                        		
                 		
                	rety = []
                        if os.path.isfile(favlist):              
                        	os.remove(favlist)                            	
                        if os.path.isfile(newbouq_unsortlist):              
                        	os.remove(newbouq_unsortlist)                
                        for zz in ret: 	       
                        	if newbouq3 in zz:
                        		print "no add"
                               	else:
                                       	rety.append(zz)
                        rety[1:1] = [newbouq1]
                	wv = open(favlist, "w")
                	wv.write("\n".join(map(lambda x: str(x), rety)))
                	wv.close()                   
                	eDVBDB.getInstance().reloadBouquets()
                except:
                	print "Chanel-txt File missing, please check it."
                       	#self.session.open(MessageBox, _("Chanel-txt File missing, please check it."), MessageBox.TYPE_ERROR)
	
        
        def searchNumberHelper(self, serviceHandler, num, bouquet):
		servicelist = self.serviceHandler.list(bouquet)
		if not servicelist is None:
			while num:
				serviceIterator = servicelist.getNext()
				if not serviceIterator.valid(): #check end of list
					break
				playable = not (serviceIterator.flags & (eServiceReference.isMarker|eServiceReference.isDirectory))
				if playable:
					num -= 1;
			if not num: #found service with searched number ?
				return serviceIterator, 0
		return None, num  

	def updateServiceName(self, number):
		global sname
                bouquet = InfoBar.instance.servicelist.bouquet_root
		service = None
		self.serviceHandler = eServiceCenter.getInstance()
		serviceHandler = self.serviceHandler
		bouquetlist = serviceHandler.list(bouquet)
		if not bouquetlist is None:
			while number:
				bouquet = bouquetlist.getNext()
				if not bouquet.valid(): #check end of list
					break
				if bouquet.flags & eServiceReference.isDirectory:
					service, number = self.searchNumberHelper(serviceHandler, number, bouquet)
                if service is not None:
                        print "service:", service
			info = serviceHandler.info(service)
			sname = info.getName(service).replace('\xc2\x86', '').replace('\xc2\x87', '')
		else:
			sname = _("Unknown Service")


        def keyGo(self):
		prov = self.scan_provider.value.lower()
                if prov == "astra_19_austriasat" or prov == "digitv" or prov == "focussat" or prov == "freesat_czech_republic" or prov == "freesat_hungary" or prov == "freesat_moldavia" or prov == "freesat_slovenske" or prov == "freesat_romania" or prov == "hdplus" or prov == "upc":
                  if self.scan_alternative_number_mode.value == True:
                        config.usage.alternative_number_mode.value = True
                        config.usage.alternative_number_mode.save()
                  else:
                        config.usage.alternative_number_mode.value = False
                        config.usage.alternative_number_mode.save()
		  config.misc.fastscan.last_configuration.value = `(self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value, self.scan_alternative_number_mode.value)`
		  config.misc.fastscan.save()
		  self.readXML(self.scan_provider.value.lower())
		else:
		  config.misc.fastscan.last_configuration.value = `(self.scan_nims.value, self.scan_provider.value, self.scan_hd.value, self.scan_keepnumbering.value, self.scan_keepsettings.value, self.scan_alternative_number_mode)`
		  config.misc.fastscan.save()
		  self.startScan()


	def getTransponderParameters(self, number):
		transponderParameters = eDVBFrontendParametersSatellite()
		transponderParameters.frequency = self.transponders[number][0]
		transponderParameters.symbol_rate = self.transponders[number][1]
		transponderParameters.fec = self.transponders[number][2]
		transponderParameters.orbital_position = self.transponders[number][3]
		transponderParameters.polarisation = self.transponders[number][4]
		transponderParameters.inversion = self.transponders[number][5]
		transponderParameters.system = self.transponders[number][6]
		transponderParameters.modulation = self.transponders[number][7]
		transponderParameters.rolloff = self.transponders[number][8]
		transponderParameters.pilot = self.transponders[number][9]
		return transponderParameters

	def startScan(self):
		pid = self.providers[self.scan_provider.value][1]
		if self.scan_hd.value and self.providers[self.scan_provider.value][2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.value),
				transponderParameters = self.getTransponderParameters(self.providers[self.scan_provider.value][0]),
				scanPid = pid, keepNumbers = self.scan_keepnumbering.value, keepSettings = self.scan_keepsettings.value,
				providerName = self.scan_provider.getText(), alternative_number_mode = config.usage.alternative_number_mode.value)

	def keyCancel(self):
	        self.restoreService()
		self.close()