コード例 #1
0
ファイル: FrontendInfo.py プロジェクト: 1198s/enigma2
	def destroy(self):
		if not self.frontend_source and not self.service_source:
			PerServiceBase.destroy(self)
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			res_mgr.frontendUseMaskChanged.get().remove(self.updateTunerMask)
		Source.destroy(self)
コード例 #2
0
ファイル: TunerInfo.py プロジェクト: kingvuplus/boom
 def destroy(self):
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         res_mgr.frontendUseMaskChanged.get().remove(self.tunerUseMaskChanged)
     else:
         print 'no res_mgr!!'
     Source.destroy(self)
コード例 #3
0
ファイル: TunerInfo.py プロジェクト: popazerty/12
	def destroy(self):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			self.frontendUseMaskChanged_conn = None
		else:
			print "no res_mgr!!"
		Source.destroy(self)
コード例 #4
0
ファイル: TunerInfo.py プロジェクト: kingvuplus/boom
 def __init__(self):
     Source.__init__(self)
     self.tuner_use_mask = 0
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         res_mgr.frontendUseMaskChanged.get().append(self.tunerUseMaskChanged)
     else:
         print 'no res_mgr!!'
コード例 #5
0
ファイル: Satconfig.py プロジェクト: idrogeno/IdroMips
	def extraInfo(self):
		nim = self["nimlist"].getCurrent()
		nimname = nim[1]
		nim = nim and nim[3]
		if config.usage.setup_level.index >= 2 and nim is not None:
			nimcapabilities = ",".join(eDVBResourceManager.getInstance().getFrontendCapabilities(nim.slot).splitlines())
			text = _("Capabilities ") + str(nimname) + " \n" + str(nimcapabilities)
			self.session.open(MessageBox, text, MessageBox.TYPE_INFO, simple=True)
コード例 #6
0
ファイル: TunerInfo.py プロジェクト: popazerty/12
	def __init__(self):
		Source.__init__(self)
		self.tuner_use_mask = 0
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			self.frontendUseMaskChanged_conn = res_mgr.frontendUseMaskChanged.connect(self.tunerUseMaskChanged)
		else:
			print "no res_mgr!!"
コード例 #7
0
ファイル: AutoDiseqc.py プロジェクト: BlackHole/enigma2-1
	def openFrontend(self):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			self.raw_channel = res_mgr.allocateRawChannel(self.feid)
			if self.raw_channel:
				self.frontend = self.raw_channel.getFrontend()
				if self.frontend:
					return True
		return False
コード例 #8
0
 def __init__(self):
     Source.__init__(self)
     self.tuner_use_mask = 0
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         res_mgr.frontendUseMaskChanged.get().append(
             self.tunerUseMaskChanged)
     else:
         print('no res_mgr!!')
コード例 #9
0
ファイル: plugin.py プロジェクト: vuteam/ts-e2
	def openFrontend(self):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			self.raw_channel = res_mgr.allocateRawChannel(self.feid)
			if self.raw_channel:
				self.frontend = self.raw_channel.getFrontend()
				if self.frontend:
					return True
		return False
コード例 #10
0
ファイル: FrontendInfo.py プロジェクト: norhap/vix-u5pvr
	def destroy(self):
		if not self.frontend_source and not self.service_source:
			PerServiceBase.destroy(self)
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			res_mgr.frontendUseMaskChanged.get().remove(self.updateTunerMask)
		sec = eDVBSatelliteEquipmentControl.getInstance()
		if sec:
			sec.slotRotorSatPosChanged.get().remove(self.updateSlotRotorSatPosition)
		Source.destroy(self)
コード例 #11
0
ファイル: plugin.py プロジェクト: Open-Plus/opgui
	def openFrontend(self):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			fe_id = int(self.scan_nims.value)
			self.raw_channel = res_mgr.allocateRawChannel(fe_id)
			if self.raw_channel:
				self.frontend = self.raw_channel.getFrontend()
				if self.frontend:
					return True
		return False
コード例 #12
0
 def __init__(self):
     Source.__init__(self)
     self.isAnimated = False
     self.tuner_use_mask = 0
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         self.frontendUseMaskChanged_conn = res_mgr.frontendUseMaskChanged.connect(
             self.tunerUseMaskChanged)
     else:
         print "no res_mgr!!"
コード例 #13
0
	def openFrontend(self):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			fe_id = int(self.scan_nims.value)
			self.raw_channel = res_mgr.allocateRawChannel(fe_id)
			if self.raw_channel:
				self.frontend = self.raw_channel.getFrontend()
				if self.frontend:
					return True
		return False
コード例 #14
0
ファイル: plugin.py プロジェクト: idrogeno/FusionOE
	def TunerTypeChanged(self):
		fe_id = int(self.scan_nims.value)
		multiType = config.Nims[fe_id].multiType
		system = multiType.getText()
		if (system in ('DVB-S','DVB-S2') and config.Nims[fe_id].dvbs.configMode.value == "nothing") or \
			(system in ('DVB-T','DVB-T2') and config.Nims[fe_id].dvbt.configMode.value == "nothing") or \
			(system in ('DVB-C') and config.Nims[fe_id].dvbc.configMode.value == "nothing"):
			self.createSetup()
			return
		nim = nimmanager.nim_slots[fe_id]
		print "dvb_api_version ",iDVBFrontend.dvb_api_version
		self.frontend = None
		if not self.openFrontend():
			self.session.nav.stopService()
			if not self.openFrontend():
				if self.session.pipshown:
					from Screens.InfoBar import InfoBar
					InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()
					if not self.openFrontend():
						self.frontend = None # in normal case this should not happen
		self.tuner = Tuner(self.frontend)
		eDVBResourceManager.getInstance().setFrontendType(nim.frontend_id, nim.getType())
#			if not path.exists("/proc/stb/frontend/%d/mode" % fe_id) and iDVBFrontend.dvb_api_version >= 5:
		print "api >=5 and new style tuner driver"
		if self.frontend:
			if system == 'DVB-C':
				ret = self.frontend.changeType(iDVBFrontend.feCable)
			elif system in ('DVB-T','DVB-T2'):
				ret = self.frontend.changeType(iDVBFrontend.feTerrestrial)
			elif system in ('DVB-S','DVB-S2'):
				ret = self.frontend.changeType(iDVBFrontend.feSatellite)
			elif system == 'ATSC':
				ret = self.frontend.changeType(iDVBFrontend.feATSC)
			else:
				ret = False
			if not ret:
				print "%d: tunerTypeChange to '%s' failed" %(fe_id, system)
			else:
				print "new system ",system
		else:
			print "%d: tunerTypeChange to '%s' failed (BUSY)" %(fe_id, multiType.getText())
		self.createSetup()
コード例 #15
0
ファイル: ScanSetup.py プロジェクト: kakunbsc/enigma2.1
	def tryGetRawFrontend(self, feid):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			raw_channel = res_mgr.allocateRawChannel(self.feid)
			if raw_channel:
				frontend = raw_channel.getFrontend()
				if frontend:
					del frontend
					del raw_channel
					return True
		return False
コード例 #16
0
ファイル: plugin.py プロジェクト: crayzy13/pur-e3
 def openFrontend(self):
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         self.raw_channel = res_mgr.allocateRawChannel(self.feid)
         if self.raw_channel:
             self.frontend = self.raw_channel.getFrontend()
             if self.frontend:
                 if dvbreader_available:
                     self.demux = self.raw_channel.reserveDemux(
                     )  # used for keyReadServices()
                 return True
     return False
コード例 #17
0
	def tryGetRawFrontend(self, feid):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			raw_channel = res_mgr.allocateRawChannel(self.feid)
			if raw_channel:
				frontend = raw_channel.getFrontend()
				if frontend:
					frontend.closeFrontend() # immediate close...
					del frontend
					del raw_channel
					return True
		return False
コード例 #18
0
	def TunerTypeChanged(self):
		fe_id = int(self.scan_nims.value)
		multiType = config.Nims[fe_id].multiType
		system = multiType.getText()
		if (system in ('DVB-S', 'DVB-S2') and config.Nims[fe_id].dvbs.configMode.value == "nothing") or \
			(system in ('DVB-T', 'DVB-T2') and config.Nims[fe_id].dvbt.configMode.value == "nothing") or \
			(system in ('DVB-C') and config.Nims[fe_id].dvbc.configMode.value == "nothing") or \
			(system in ('ATSC') and config.Nims[fe_id].atsc.configMode.value == "nothing"):
			return
		slot = nimmanager.nim_slots[fe_id]
		print("dvb_api_version ", iDVBFrontend.dvb_api_version)
		self.frontend = None
		if not self.openFrontend():
			self.session.nav.stopService()
			if not self.openFrontend():
				if self.session.pipshown:
					from Screens.InfoBar import InfoBar
					InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()
					if not self.openFrontend():
						self.frontend = None # in normal case this should not happen
		self.tuner = Tuner(self.frontend)

		if slot.isMultiType():
			eDVBResourceManager.getInstance().setFrontendType(slot.frontend_id, "dummy", False) #to force a clear of m_delsys_whitelist
			types = slot.getMultiTypeList()
			import six
			for FeType in six.itervalues(types):
				if FeType in ("DVB-S", "DVB-S2", "DVB-S2X") and config.Nims[slot.slot].dvbs.configMode.value == "nothing":
					continue
				elif FeType in ("DVB-T", "DVB-T2") and config.Nims[slot.slot].dvbt.configMode.value == "nothing":
					continue
				elif FeType in ("DVB-C", "DVB-C2") and config.Nims[slot.slot].dvbc.configMode.value == "nothing":
					continue
				elif FeType in ("ATSC") and config.Nims[slot.slot].atsc.configMode.value == "nothing":
					continue
				eDVBResourceManager.getInstance().setFrontendType(slot.frontend_id, FeType, True)
		else:
			eDVBResourceManager.getInstance().setFrontendType(slot.frontend_id, slot.getType())


#			if not path.exists("/proc/stb/frontend/%d/mode" % fe_id) and iDVBFrontend.dvb_api_version >= 5:
		print("api >=5 and new style tuner driver")
		if self.frontend:
			if system == 'DVB-C':
				ret = self.frontend.changeType(iDVBFrontend.feCable)
			elif system in ('DVB-T', 'DVB-T2'):
				ret = self.frontend.changeType(iDVBFrontend.feTerrestrial)
			elif system in ('DVB-S', 'DVB-S2'):
				ret = self.frontend.changeType(iDVBFrontend.feSatellite)
			elif system == 'ATSC':
				ret = self.frontend.changeType(iDVBFrontend.feATSC)
			else:
				ret = False
			if not ret:
				print("%d: tunerTypeChange to '%s' failed" % (fe_id, system))
			else:
				print("new system ", system)
		else:
			print("%d: tunerTypeChange to '%s' failed (BUSY)" % (fe_id, multiType.getText()))
		self.retune()
コード例 #19
0
    def __init__(self, type):
        Converter.__init__(self, type)
        self.colors = (0x0000FF00, 0x00FFFF00, 0x007F7F7F
                       )  # tuner active, busy, available colors

        self.TunerMaskAttrib = None

        if type == "BER":
            self.type = self.BER
        elif type == "SNR":
            self.type = self.SNR
        elif type == "SNRdB":
            self.type = self.SNRdB
        elif type == "AGC":
            self.type = self.AGC
        elif type == "NUMBER":
            self.type = self.SLOT_NUMBER
        elif type == "TYPE":
            self.type = self.TUNER_TYPE
        elif type == "SNR_ANALOG":
            self.type = self.SNR_ANALOG
        elif type == "AGC_ANALOG":
            self.type = self.AGC_ANALOG
        elif type.startswith("ACTIVE_BUSY_AVAILABLE_TUNER_COLORS"):
            self.type = self.ACTIVE_BUSY_AVAILABLE_TUNER_COLORS
            type = type.split(",")
            if len(type) == 4 and type[1].startswith('0x') and type[
                    2].startswith('0x') and type[3].startswith('0x'):
                self.colors = (int(type[1], 0), int(type[2],
                                                    0), int(type[3], 0))

            try:
                self.TunerMaskAttrib = self.source.tuner_mask
            except Exception as e:
                if DBG:
                    j00zekDEBUG(
                        '[j00zekModFrontendInfo2:__init__] getting self.source.tuner_mask Exception: %s'
                        % str(e))
                try:
                    from enigma import eDVBResourceManager
                    res_mgr = eDVBResourceManager.getInstance()
                    if res_mgr:
                        res_mgr.frontendUseMaskChanged.get().append(
                            self.updateTunerMask)
                except Exception as e:
                    if DBG:
                        j00zekDEBUG(
                            '[j00zekModFrontendInfo2:__init__] setting res_mgr Exception: %s'
                            % str(e))
                    self.TunerMaskAttrib = None
        else:
            self.type = self.LOCK
コード例 #20
0
ファイル: Unknown.py プロジェクト: dpuschek/enigma2-plugins
	def appendEvent(self):
		if config.infobartunerstate.plugin_unknown.enabled.value:
			res_mgr = eDVBResourceManager.getInstance()
			if res_mgr:
				try:
					# OE2.2
					self.conn = res_mgr.frontendUseMaskChanged.connect(self.onEvent)
				except:
					try:
						# OE2.0
						res_mgr.frontendUseMaskChanged.get().append(self.onEvent)
					except:
						pass
コード例 #21
0
	def appendEvent(self):
		if config.infobartunerstate.plugin_unknown.enabled.value:
			res_mgr = eDVBResourceManager.getInstance()
			if res_mgr:
				try:
					# OE2.2
					self.conn = res_mgr.frontendUseMaskChanged.connect(self.onEvent)
				except:
					try:
						# OE2.0
						res_mgr.frontendUseMaskChanged.get().append(self.onEvent)
					except:
						pass
コード例 #22
0
 def __init__(self, service_source = None, frontend_source = None, navcore = None):
     self.navcore = None
     Source.__init__(self)
     if navcore:
         PerServiceBase.__init__(self, navcore, {iPlayableService.evTunedIn: self.updateFrontendData,
          iPlayableService.evEnd: self.serviceEnd})
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         res_mgr.frontendUseMaskChanged.get().append(self.updateTunerMask)
     self.service_source = service_source
     self.frontend_source = frontend_source
     self.tuner_mask = 0
     self.updateFrontendData()
コード例 #23
0
 def TryCloseFrontend(self, feId):
     print('BBrowserLauncher:TryCloseFrontend')
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         raw_channel = res_mgr.allocateRawChannel(feId)
         if raw_channel:
             frontend = raw_channel.getFrontend()
             if frontend:
                 frontend.closeFrontend()
                 del frontend
                 del raw_channel
                 return True
     return False
コード例 #24
0
ファイル: plugin.py プロジェクト: Open-Plus/opgui
	def TunerTypeChanged(self):
		fe_id = int(self.scan_nims.value)
		multiType = config.Nims[fe_id].multiType
		system = multiType.getText()
		if (system in ('DVB-S','DVB-S2') and config.Nims[fe_id].dvbs.configMode.value == "nothing") or \
			(system in ('DVB-T','DVB-T2') and config.Nims[fe_id].dvbt.configMode.value == "nothing") or \
			(system in ('DVB-C') and config.Nims[fe_id].dvbc.configMode.value == "nothing") or \
			(system in ('ATSC') and config.Nims[fe_id].atsc.configMode.value == "nothing") :
			return
		slot = nimmanager.nim_slots[fe_id]
		print "dvb_api_version ",iDVBFrontend.dvb_api_version
		self.frontend = None
		if not self.openFrontend():
			self.session.nav.stopService()
			if not self.openFrontend():
				if self.session.pipshown:
					from Screens.InfoBar import InfoBar
					InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()
					if not self.openFrontend():
						self.frontend = None # in normal case this should not happen
		self.tuner = Tuner(self.frontend)

		if slot.isMultiType():
			eDVBResourceManager.getInstance().setFrontendType(slot.frontend_id, "dummy", False) #to force a clear of m_delsys_whitelist
			types = slot.getMultiTypeList()
			for FeType in types.itervalues():
				if FeType in ("DVB-S", "DVB-S2", "DVB-S2X") and config.Nims[slot.slot].dvbs.configMode.value == "nothing":
					continue
				elif FeType in ("DVB-T", "DVB-T2") and config.Nims[slot.slot].dvbt.configMode.value == "nothing":
					continue
				elif FeType in ("DVB-C", "DVB-C2") and config.Nims[slot.slot].dvbc.configMode.value == "nothing":
					continue
				elif FeType in ("ATSC") and config.Nims[slot.slot].atsc.configMode.value == "nothing":
					continue
				eDVBResourceManager.getInstance().setFrontendType(slot.frontend_id, FeType, True)
		else:
			eDVBResourceManager.getInstance().setFrontendType(slot.frontend_id, slot.getType())


#			if not path.exists("/proc/stb/frontend/%d/mode" % fe_id) and iDVBFrontend.dvb_api_version >= 5:
		print "api >=5 and new style tuner driver"
		if self.frontend:
			if system == 'DVB-C':
				ret = self.frontend.changeType(iDVBFrontend.feCable)
			elif system in ('DVB-T','DVB-T2'):
				ret = self.frontend.changeType(iDVBFrontend.feTerrestrial)
			elif system in ('DVB-S','DVB-S2'):
				ret = self.frontend.changeType(iDVBFrontend.feSatellite)
			elif system == 'ATSC':
				ret = self.frontend.changeType(iDVBFrontend.feATSC)
			else:
				ret = False
			if not ret:
				print "%d: tunerTypeChange to '%s' failed" %(fe_id, system)
			else:
				print "new system ",system
		else:
			print "%d: tunerTypeChange to '%s' failed (BUSY)" %(fe_id, multiType.getText())
		self.retune()
コード例 #25
0
    def getFrontend(self):
        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print(
                "[MakeBouquet][getFrontend] Cannot retrieve Resource Manager instance"
            )
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        self.rawchannel = resmanager.allocateRawChannel(self.selectedNIM)
        if not self.rawchannel:
            print("[MakeBouquet][getFrontend] Cannot get the NIM")
            self.showError(_('Cannot get the NIM'))
            return

        print(
            "[MakeBouquet][getFrontend] Will wait up to %i seconds for tuner lock."
            % (self.lockTimeout / 10))

        self["tuner_text"].setText(chr(ord('A') + self.selectedNIM))

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print("[MakeBouquet][getFrontend] Cannot get frontend")
            self.showError(_('Cannot get frontend'))
            return

        self.demuxer_id = self.rawchannel.reserveDemux()
        if self.demuxer_id < 0:
            print("[MakeBouquet][getFrontend] Cannot allocate the demuxer",
                  file=log)
            self.showError(_('Cannot allocate the demuxer'))
            return

        self.frontend.tune(
            setParamsFe(
                setParams(self.transponder["frequency"],
                          self.transponder["system"],
                          self.transponder["bandwidth"])))

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #26
0
ファイル: TuneTest.py プロジェクト: kingvuplus/eg-e2
 def openFrontend(self):
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         self.raw_channel = res_mgr.allocateRawChannel(self.feid)
         if self.raw_channel:
             self.frontend = self.raw_channel.getFrontend()
             if self.frontend:
                 return True
             print '[TuneTest] getFrontend failed'
         else:
             print '[TuneTest] getRawChannel failed'
     else:
         print '[TuneTest] getResourceManager instance failed'
     return False
コード例 #27
0
ファイル: FrontendInfo.py プロジェクト: kingvuplus/boom
 def __init__(self, service_source = None, frontend_source = None, navcore = None):
     self.navcore = None
     Source.__init__(self)
     if navcore:
         PerServiceBase.__init__(self, navcore, {iPlayableService.evTunedIn: self.updateFrontendData,
          iPlayableService.evEnd: self.serviceEnd})
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         res_mgr.frontendUseMaskChanged.get().append(self.updateTunerMask)
     self.service_source = service_source
     self.frontend_source = frontend_source
     self.tuner_mask = 0
     self.updateFrontendData()
     return
コード例 #28
0
ファイル: plugin.py プロジェクト: ggguih8zt7/enigma2-wetek
 def OpenFrontend(self):
     frontend = None
     resource_manager = eDVBResourceManager.getInstance()
     if resource_manager is None:
         print 'get resource manager instance failed'
     else:
         self.raw_channel = resource_manager.allocateRawChannel(self.feid)
         if self.raw_channel is None:
             print 'allocateRawChannel failed'
         else:
             frontend = self.raw_channel.getFrontend()
             if frontend is None:
                 print 'getFrontend failed'
     return frontend
コード例 #29
0
	def OpenFrontend(self):
		frontend = None
		resource_manager = eDVBResourceManager.getInstance()
		if resource_manager is None:
			print "get resource manager instance failed"
		else:
			self.raw_channel = resource_manager.allocateRawChannel(int(self.select_nim.value))

			if self.raw_channel is None:
				print "allocateRawChannel failed"
			else:
				frontend = self.raw_channel.getFrontend()
				if frontend is None:
					print "getFrontend failed"
		return(frontend)
コード例 #30
0
 def openFrontend(self):
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         self.raw_channel = res_mgr.allocateRawChannel(self.feid)
         if self.raw_channel:
             self.frontend = self.raw_channel.getFrontend()
             if self.frontend:
                 return True
             else:
                 print("getFrontend failed")
         else:
             print("getRawChannel failed")
     else:
         print("getResourceManager instance failed")
     return False
コード例 #31
0
    def OpenFrontend(self):
        frontend = None
        resource_manager = eDVBResourceManager.getInstance()
        if resource_manager is None:
            print "get resource manager instance failed"
        else:
            self.raw_channel = resource_manager.allocateRawChannel(
                int(self.select_nim.value))

            if self.raw_channel is None:
                print "allocateRawChannel failed"
            else:
                frontend = self.raw_channel.getFrontend()
                if frontend is None:
                    print "getFrontend failed"
        return (frontend)
コード例 #32
0
	def tryGetRawFrontend(self, feid, ret_boolean=True, do_close=True):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			raw_channel = res_mgr.allocateRawChannel(self.feid)
			if raw_channel:
				frontend = raw_channel.getFrontend()
				if frontend:
					if do_close:
						frontend.closeFrontend() # immediate close... 
					if ret_boolean:
						del raw_channel
						del frontend
						return True
					return raw_channel, frontend
		if ret_boolean:
			return False
		return (False, False)
コード例 #33
0
 def tryGetRawFrontend(self, feid, ret_boolean=True, do_close=True):
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         raw_channel = res_mgr.allocateRawChannel(self.feid)
         if raw_channel:
             frontend = raw_channel.getFrontend()
             if frontend:
                 if do_close:
                     frontend.closeFrontend()  # immediate close...
                 if ret_boolean:
                     del raw_channel
                     del frontend
                     return True
                 return raw_channel, frontend
     if ret_boolean:
         return False
     return (False, False)
コード例 #34
0
ファイル: FrontendInfo.py プロジェクト: norhap/vix-u5pvr
	def __init__(self, service_source=None, frontend_source=None, navcore=None):
		self.navcore = None
		Source.__init__(self)
		if navcore:
			PerServiceBase.__init__(self, navcore,
			{
				iPlayableService.evTunedIn: self.updateFrontendData,
				iPlayableService.evEnd: self.serviceEnd
			})
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			res_mgr.frontendUseMaskChanged.get().append(self.updateTunerMask)
		self.service_source = service_source
		self.frontend_source = frontend_source
		self.tuner_mask = 0
		sec = eDVBSatelliteEquipmentControl.getInstance()
		if sec:
			sec.slotRotorSatPosChanged.get().append(self.updateSlotRotorSatPosition)
		self.updateFrontendData()
コード例 #35
0
	def getFrontend(self):
		resmanager = eDVBResourceManager.getInstance()
		if not resmanager:
			print "[MakeBouquet][getFrontend] Cannot retrieve Resource Manager instance"
			self.showError(_('Cannot retrieve Resource Manager instance'))
			return

		if self.rawchannel:
			del(self.rawchannel)

		self.frontend = None
		self.rawchannel = None

		self.rawchannel = resmanager.allocateRawChannel(self.selectedNIM)
		if not self.rawchannel:
			print "[MakeBouquet][getFrontend] Cannot get the NIM"
			self.showError(_('Cannot get the NIM'))
			return

		print "[MakeBouquet][getFrontend] Will wait up to %i seconds for tuner lock." % (self.lockTimeout/10)

		self.frontend = self.rawchannel.getFrontend()
		if not self.frontend:
			print "[MakeBouquet][getFrontend] Cannot get frontend"
			self.showError(_('Cannot get frontend'))
			return

		self.demuxer_id = self.rawchannel.reserveDemux()
		if self.demuxer_id < 0:
			print>>log, "[MakeBouquet][getFrontend] Cannot allocate the demuxer"
			self.showError(_('Cannot allocate the demuxer'))
			return

		self.frontend.tune(setParamsFe(setParams(self.transponder["frequency"], self.transponder["system"], self.transponder["bandwidth"])))

		self.lockcounter = 0
		self.locktimer = eTimer()
		self.locktimer.callback.append(self.checkTunerLock)
		self.locktimer.start(100, 1)
コード例 #36
0
    def getFrontend(self):
        print "[TerrestrialScan][getFrontend] searching for available tuner"
        nimList = []
        if self.selectedNIM < 0:  # automatic tuner selection
            for nim in nimmanager.nim_slots:
                if nim.config_mode not in ("nothing",) and (
                    nim.isCompatible("DVB-T2") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T2"))
                ):
                    nimList.append(nim.slot)
                    self.isT2tuner = True
            if len(nimList) == 0:
                print "[TerrestrialScan][getFrontend] No T2 tuner found"
                for nim in nimmanager.nim_slots:
                    if nim.config_mode not in ("nothing",) and (
                        nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))
                    ):
                        nimList.append(nim.slot)
            if len(nimList) == 0:
                print "[TerrestrialScan][getFrontend] No terrestrial tuner found"
                self.showError(_("No terrestrial tuner found"))
                return
        else:  # manual tuner selection, and subsequent iterations
            nim = nimmanager.nim_slots[self.selectedNIM]
            if nim.config_mode not in ("nothing",) and (
                nim.isCompatible("DVB-T2") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T2"))
            ):
                nimList.append(nim.slot)
                self.isT2tuner = True
            if len(nimList) == 0:
                print "[TerrestrialScan][getFrontend] User selected tuner is not T2 compatible"
                if nim.config_mode not in ("nothing",) and (
                    nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))
                ):
                    nimList.append(nim.slot)
            if len(nimList) == 0:
                print "[TerrestrialScan][getFrontend] User selected tuner not configured"
                self.showError(_("Selected tuner is not cofigured"))
                return

        if len(nimList) == 0:
            print "[TerrestrialScan][getFrontend] No terrestrial tuner found"
            self.showError(_("No terrestrial tuner found"))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print "[TerrestrialScan][getFrontend] Cannot retrieve Resource Manager instance"
            self.showError(_("Cannot retrieve Resource Manager instance"))
            return

        if self.selectedNIM < 0:  # automatic tuner selection
            print "[TerrestrialScan][getFrontend] Choosing NIM"

            # stop pip if running
        if self.session.pipshown:
            self.session.pipshown = False
            del self.session.pip
            print "[TerrestrialScan][getFrontend] Stopping PIP."

            # Find currently playin NIM
        currentlyPlayingNIM = None
        currentService = self.session and self.session.nav.getCurrentService()
        frontendInfo = currentService and currentService.frontendInfo()
        frontendData = frontendInfo and frontendInfo.getAll(True)
        if frontendData is not None:
            currentlyPlayingNIM = frontendData.get("tuner_number", None)
        del frontendInfo
        del currentService

        current_slotid = -1
        if self.rawchannel:
            self.rawchannel.receivedTsidOnid.get().remove(self.gotTsidOnid)
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList.reverse()  # start from the last
        for slotid in nimList:
            if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                current_slotid = slotid
            self.rawchannel = resmanager.allocateRawChannel(slotid)
            if self.rawchannel:
                print "[TerrestrialScan][getFrontend] Nim found on slot id %d" % (slotid)
                current_slotid = slotid
                break

        if current_slotid == -1:
            print "[TerrestrialScan][getFrontend] No valid NIM found"
            self.showError(_("No valid NIM found for terrestrial"))
            return

        if not self.rawchannel:
            # if we are here the only possible option is to close the active service
            if currentlyPlayingNIM in nimList:
                slotid = currentlyPlayingNIM
                print "[TerrestrialScan][getFrontend] Nim found on slot id %d but it's busy. Stopping active service" % slotid
                self.session.postScanService = self.session.nav.getCurrentlyPlayingServiceOrGroup()
                self.session.nav.stopService()
                self.rawchannel = resmanager.allocateRawChannel(slotid)
                if self.rawchannel:
                    print "[TerrestrialScan][getFrontend] The active service was stopped, and the NIM is now free to use."
                    current_slotid = slotid

            if not self.rawchannel:
                if self.session.nav.RecordTimer.isRecording():
                    print "[TerrestrialScan][getFrontend] Cannot free NIM because a recording is in progress"
                    self.showError(_("Cannot free NIM because a recording is in progress"))
                    return
                else:
                    print "[TerrestrialScan][getFrontend] Cannot get the NIM"
                    self.showError(_("Cannot get the NIM"))
                    return

        print "[TerrestrialScan][getFrontend] Will wait up to %i seconds for tuner lock." % (self.lockTimeout / 10)

        self.selectedNIM = current_slotid  # Remember for next iteration

        self.rawchannel.receivedTsidOnid.get().append(self.gotTsidOnid)

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print "[TerrestrialScan][getFrontend] Cannot get frontend"
            self.showError(_("Cannot get frontend"))
            return

        self.rawchannel.requestTsidOnid()

        self.tsid = None
        self.onid = None

        self.frontend.tune(setParamsFe(setParams(self.frequency, self.system, self.bandwidth)))

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #37
0
ファイル: plugin.py プロジェクト: OpenViX/HRTunerProxy
 def __init__(self):
     res_mgr = eDVBResourceManager.getInstance()
     if res_mgr:
         res_mgr.frontendUseMaskChanged.get().append(
             self.tunerUseMaskChanged)
コード例 #38
0
ファイル: main.py プロジェクト: oe-alliance/AutoBouquetsMaker
	def doTune(self):
		print>>log, "[ABM-main][doTune] searching for tuner for %s" % self.providers[self.currentAction]["name"]
		from Screens.Standby import inStandby
		if self.providers[self.currentAction]["streamtype"] == "dvbs":
			transponder = self.providers[self.currentAction]["transponder"]
		else:
			bouquet_key = None
			providers_tmp = self.abm_settings_str.split("|")
			for provider_tmp in providers_tmp:
				provider_config = ProviderConfig(provider_tmp)
				provider_key = provider_config.getProvider()
				if self.currentAction != provider_key:
					continue
				bouquet_key = provider_config.getArea()

			if not bouquet_key:
				print>>log, "[ABM-main][doTune] No area found"
				self.showError(_('No area found'))
				return

			transponder = self.providers[self.currentAction]["bouquets"][bouquet_key]

		nimList = []
		for nim in nimmanager.nim_slots:
			if self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.isCompatible("DVB-S"):
				try:
					if nim.isFBCTuner() and not nim.isFBCRoot():
						continue # do not load FBC links, only root tuners
				except:
					pass
			try: # OpenPLi Hot Switch compatible image
				if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and \
					{"dvbs": "DVB-S", "dvbc": "DVB-C", "dvbt": "DVB-T"}.get(self.providers[self.currentAction]["streamtype"], "UNKNOWN") in [x[:5] for x in nim.getTunerTypesEnabled()]:
					nimList.append(nim.slot)
			except AttributeError:
				try:
					if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and \
						((self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.isCompatible("DVB-S")) or \
						(self.providers[self.currentAction]["streamtype"] == "dvbc" and (nim.isCompatible("DVB-C") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-C")))) or \
						(self.providers[self.currentAction]["streamtype"] == "dvbt" and (nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))))):
						nimList.append(nim.slot)
				except AttributeError: # OpenATV > 5.3
					if (self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.canBeCompatible("DVB-S") and nim.config_mode_dvbs not in ("loopthrough", "satposdepends", "nothing")) or \
						(self.providers[self.currentAction]["streamtype"] == "dvbc" and nim.canBeCompatible("DVB-C") and nim.config_mode_dvbc != "nothing") or \
						(self.providers[self.currentAction]["streamtype"] == "dvbt" and nim.canBeCompatible("DVB-T") and nim.config_mode_dvbt != "nothing"):
						nimList.append(nim.slot)

		if len(nimList) == 0:
			print>>log, "[ABM-main][doTune] No NIMs found"
			self.showError(_('No NIMs found for ') + self.providers[self.currentAction]["name"])
			return

		resmanager = eDVBResourceManager.getInstance()
		if not resmanager:
			print>>log, "[ABM-main][doTune] Cannot retrieve Resource Manager instance"
			self.showError(_('Cannot retrieve Resource Manager instance'))
			return

		if self.providers[self.currentAction]["streamtype"] == "dvbs":
			print>>log, "[ABM-main][doTune] Search NIM for orbital position %d" % transponder["orbital_position"]
		else:
			print>>log, "[ABM-main][doTune] Search NIM"

		# stop pip if running
		if self.session.pipshown:
			self.session.pipshown = False
			del self.session.pip
			print>>log, "[ABM-main][doTune] Stopping PIP."

		# stop currently playing service if it is using a tuner in ("loopthrough", "satposdepends")
		currentlyPlayingNIM = None
		currentService = self.session and self.session.nav.getCurrentService()
		frontendInfo = currentService and currentService.frontendInfo()
		frontendData = frontendInfo and frontendInfo.getAll(True)
		if frontendData is not None:
			currentlyPlayingNIM = frontendData.get("tuner_number", None)
			if self.providers[self.currentAction]["streamtype"] == "dvbs" and currentlyPlayingNIM is not None and nimmanager.nim_slots[currentlyPlayingNIM].isCompatible("DVB-S"):
				try:
					nimConfigMode = nimmanager.nim_slots[currentlyPlayingNIM].config_mode
				except AttributeError: # OpenATV > 5.3
					nimConfigMode = nimmanager.nim_slots[currentlyPlayingNIM].config_mode_dvbs
				if nimConfigMode in ("loopthrough", "satposdepends"):
					self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
					self.session.nav.stopService()
					currentlyPlayingNIM = None
					print>>log, "[ABM-main][doTune] The active service was using a %s tuner, so had to be stopped (slot id %s)." % (nimConfigMode, currentlyPlayingNIM)
		del frontendInfo
		del currentService

		current_slotid = -1
		if self.rawchannel:
			del(self.rawchannel)

		self.frontend = None
		self.rawchannel = None

		nimList.reverse() # start from the last
		for slotid in nimList:
			if self.providers[self.currentAction]["streamtype"] == "dvbs":
				sats = nimmanager.getSatListForNim(slotid)
				for sat in sats:
					if sat[0] == transponder["orbital_position"]:
						if current_slotid == -1:	# mark the first valid slotid in case of no other one is free
							current_slotid = slotid

						self.rawchannel = resmanager.allocateRawChannel(slotid)
						if self.rawchannel:
							print>>log, "[ABM-main][doTune] Nim found on slot id %d with sat %s" % (slotid, sat[1])
							current_slotid = slotid
						break
			else:
				if current_slotid == -1:	# mark the first valid slotid in case of no other one is free
					current_slotid = slotid
				self.rawchannel = resmanager.allocateRawChannel(slotid)
				if self.rawchannel:
 					print>>log, "[ABM-main][doTune] Nim found on slot id %d" % (slotid)
					current_slotid = slotid
					break

			if self.rawchannel:
				break

		if current_slotid == -1:
			print>>log, "[ABM-main][doTune] No valid NIM found"
			self.showError(_('No valid NIM found for ') + self.providers[self.currentAction]["name"])
			return

		if not self.rawchannel:
			# if we are here the only possible option is to close the active service
			if currentlyPlayingNIM in nimList:
				slotid = currentlyPlayingNIM
				if self.providers[self.currentAction]["streamtype"] == "dvbs":
					sats = nimmanager.getSatListForNim(slotid)
					for sat in sats:
						if sat[0] == transponder["orbital_position"]:
							print>>log, "[ABM-main][doTune] Nim found on slot id %d but it's busy. Stopping active service" % slotid
							self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
							self.session.nav.stopService()
							self.rawchannel = resmanager.allocateRawChannel(slotid)
							if self.rawchannel:
								print>>log, "[ABM-main][doTune] The active service was stopped, and the NIM is now free to use."
								current_slotid = slotid
							break
				else:
					print>>log, "[ABM-main][doTune] Nim found on slot id %d but it's busy. Stopping active service" % slotid
					self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
					self.session.nav.stopService()
					self.rawchannel = resmanager.allocateRawChannel(slotid)
					if self.rawchannel:
						print>>log, "[ABM-main][doTune] The active service was stopped, and the NIM is now free to use."
						current_slotid = slotid

			if not self.rawchannel:
				if self.session.nav.RecordTimer.isRecording():
					print>>log, "[ABM-main][doTune] Cannot free NIM because a recording is in progress"
					self.showError(_('Cannot free NIM because a recording is in progress'))
					return
				else:
					print>>log, "[ABM-main][doTune] Cannot get the NIM"
					self.showError(_('Cannot get the NIM'))
					return

		# set extended timeout for rotors
		self.motorised = False
		if self.providers[self.currentAction]["streamtype"] == "dvbs" and self.isRotorSat(current_slotid, transponder["orbital_position"]):
			self.motorised = True
			self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_ROTOR
			print>>log, "[ABM-main][doTune] Motorised dish. Will wait up to %i seconds for tuner lock." % (self.LOCK_TIMEOUT/10)
		else:
			self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_FIXED
			print>>log, "[ABM-main][doTune] Fixed dish. Will wait up to %i seconds for tuner lock." % (self.LOCK_TIMEOUT/10)

		self.frontend = self.rawchannel.getFrontend()
		if not self.frontend:
			print>>log, "[ABM-main][doTune] Cannot get frontend"
			self.showError(_('Cannot get frontend'))
			return

		demuxer_id = self.rawchannel.reserveDemux()
		if demuxer_id < 0:
			print>>log, "[ABM-main][doTune] Cannot allocate the demuxer."
			self.showError(_('Cannot allocate the demuxer.'))
			return

		if self.providers[self.currentAction]["streamtype"] == "dvbs":
			params = eDVBFrontendParametersSatellite()
			params.frequency = transponder["frequency"]
			params.symbol_rate = transponder["symbol_rate"]
			params.polarisation = transponder["polarization"]
			params.fec = transponder["fec_inner"]
			params.inversion = transponder["inversion"]
			params.orbital_position = transponder["orbital_position"]
			params.system = transponder["system"]
			params.modulation = transponder["modulation"]
			params.rolloff = transponder["roll_off"]
			params.pilot = transponder["pilot"]
			try: # if distro is MIS capable
				params.pls_mode = eDVBFrontendParametersSatellite.PLS_Root
				params.is_id = -1
				params.pls_code = 1
			except:
				pass
			params_fe = eDVBFrontendParameters()
			params_fe.setDVBS(params, False)

		elif self.providers[self.currentAction]["streamtype"] == "dvbt":
			params = eDVBFrontendParametersTerrestrial()
			params.frequency = transponder["frequency"]
			params.bandwidth = transponder["bandwidth"]
			params.code_rate_hp = transponder["code_rate_hp"]
			params.code_rate_lp = transponder["code_rate_lp"]
			params.inversion = transponder["inversion"]
			params.system = transponder["system"]
			params.modulation = transponder["modulation"]
			params.transmission_mode = transponder["transmission_mode"]
			params.guard_interval = transponder["guard_interval"]
			params.hierarchy = transponder["hierarchy"]
			params_fe = eDVBFrontendParameters()
			params_fe.setDVBT(params)

		elif self.providers[self.currentAction]["streamtype"] == "dvbc":
			params = eDVBFrontendParametersCable()
			params.frequency = transponder["frequency"]
			params.symbol_rate = transponder["symbol_rate"]
			params.fec_inner = transponder["fec_inner"]
			params.inversion = transponder["inversion"]
			params.modulation = transponder["modulation"]
			params_fe = eDVBFrontendParameters()
			params_fe.setDVBC(params)

		try:
			self.rawchannel.requestTsidOnid()
		except (TypeError):
			# for compatibility with some third party images
			self.rawchannel.requestTsidOnid(self.gotTsidOnid)

		self.frontend.tune(params_fe)
		self.manager.setAdapter(0)	# FIX: use the correct device
		self.manager.setDemuxer(demuxer_id)
		self.manager.setFrontend(current_slotid)

		self.current_slotid = current_slotid
		self.lockcounter = 0
		self.locktimer = eTimer()
		self.locktimer.callback.append(self.checkTunerLock)
		self.locktimer.start(100, 1)
コード例 #39
0
ファイル: main.py プロジェクト: pr2git/AutoBouquetsMaker
    def doTune(self):
        print("[ABM-main][doTune] searching for tuner for %s" %
              self.providers[self.currentAction]["name"],
              file=log)
        from Screens.Standby import inStandby
        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            transponder = self.providers[self.currentAction]["transponder"]
        else:
            bouquet_key = None
            providers_tmp = self.abm_settings_str.split("|")
            for provider_tmp in providers_tmp:
                provider_config = ProviderConfig(provider_tmp)
                provider_key = provider_config.getProvider()
                if self.currentAction != provider_key:
                    continue
                bouquet_key = provider_config.getArea()

            if not bouquet_key:
                print("[ABM-main][doTune] No area found", file=log)
                self.showError(_('No area found'))
                return

            transponder = self.providers[
                self.currentAction]["bouquets"][bouquet_key]

        self.transponder = transponder

        nimList = []
        tunerSelectionAlgorithm = "UNKNOWN"  # for debug
        for nim in nimmanager.nim_slots:
            if self.providers[self.currentAction][
                    "streamtype"] == "dvbs" and nim.isCompatible("DVB-S"):
                try:
                    if nim.isFBCLink():
                        continue  # do not load FBC links, only root tuners
                except:
                    pass
            try:  # OpenPLi Hot Switch compatible image
                if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and \
                 {"dvbs": "DVB-S", "dvbc": "DVB-C", "dvbt": "DVB-T"}.get(self.providers[self.currentAction]["streamtype"], "UNKNOWN") in [x[:5] for x in nim.getTunerTypesEnabled()]:
                    if self.validNIM(nim.slot):
                        nimList.append(nim.slot)
                    tunerSelectionAlgorithm = "OpenPLi Hot Switch compatible"
            except AttributeError:
                try:
                    if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and \
                     ((self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.isCompatible("DVB-S")) or
                     (self.providers[self.currentAction]["streamtype"] == "dvbc" and (nim.isCompatible("DVB-C") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-C")))) or
                     (self.providers[self.currentAction]["streamtype"] == "dvbt" and (nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))))):
                        if self.validNIM(nim.slot):
                            nimList.append(nim.slot)
                        tunerSelectionAlgorithm = "Conventional"
                except AttributeError:  # OpenATV > 5.3
                    if (self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.canBeCompatible("DVB-S") and nim.config_mode_dvbs not in ("loopthrough", "satposdepends", "nothing")) or \
                     (self.providers[self.currentAction]["streamtype"] == "dvbc" and nim.canBeCompatible("DVB-C") and nim.config_mode_dvbc != "nothing") or \
                     (self.providers[self.currentAction]["streamtype"] == "dvbt" and nim.canBeCompatible("DVB-T") and nim.config_mode_dvbt != "nothing"):
                        if self.validNIM(nim.slot):
                            nimList.append(nim.slot)
                        tunerSelectionAlgorithm = "OpenATV > 5.3"

        print("[ABM-main][doTune] tuner selection algorithm '%s'" %
              tunerSelectionAlgorithm,
              file=log)

        if len(nimList) == 0:
            print("[ABM-main][doTune] No NIMs found", file=log)
            self.showError(
                _('No NIMs found for ') +
                self.providers[self.currentAction]["name"])
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print(
                "[ABM-main][doTune] Cannot retrieve Resource Manager instance",
                file=log)
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        if self.providers[self.currentAction][
                "streamtype"] == "dvbs":  # If we have a choice of dishes sort the nimList so "fixed" dishes have a higher priority than "motorised".
            nimList = [
                slot for slot in nimList
                if not self.isRotorSat(slot, transponder["orbital_position"])
            ] + [
                slot for slot in nimList
                if self.isRotorSat(slot, transponder["orbital_position"])
            ]

        # stop pip if running
        if self.session.pipshown:
            self.session.pipshown = False
            del self.session.pip
            print("[ABM-main][doTune] Stopping PIP.", file=log)

        # find currently playing nim
        currentlyPlayingNIM = None
        currentService = self.session and self.session.nav.getCurrentService()
        frontendInfo = currentService and currentService.frontendInfo()
        frontendData = frontendInfo and frontendInfo.getAll(True)
        if frontendData is not None:
            currentlyPlayingNIM = frontendData.get("tuner_number", None)
            # stop currently playing service if it is using a tuner in ("loopthrough", "satposdepends"), as running in this configuration will prevent getting rawchannel on the root tuner.
            if self.providers[self.currentAction][
                    "streamtype"] == "dvbs" and currentlyPlayingNIM is not None and nimmanager.nim_slots[
                        currentlyPlayingNIM].isCompatible("DVB-S"):
                try:
                    nimConfigMode = nimmanager.nim_slots[
                        currentlyPlayingNIM].config_mode
                except AttributeError:  # OpenATV > 5.3
                    nimConfigMode = nimmanager.nim_slots[
                        currentlyPlayingNIM].config_mode_dvbs
                if nimConfigMode in ("loopthrough", "satposdepends"):
                    self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                    )
                    self.session.nav.stopService()
                    currentlyPlayingNIM = None
                    print(
                        "[ABM-main][doTune] The active service was using a %s tuner, so had to be stopped (slot id %s)."
                        % (nimConfigMode, currentlyPlayingNIM),
                        file=log)
        del frontendInfo
        del currentService

        self.releaseFrontend()

        for current_slotid in nimList:
            self.rawchannel = resmanager.allocateRawChannel(current_slotid)
            if self.rawchannel:
                print("[ABM-main][doTune] Tuner %s selected%s" %
                      (chr(ord('A') + current_slotid),
                       (" for orbital position %d" %
                        transponder["orbital_position"]
                        if "orbital_position" in transponder else "")),
                      file=log)
                break

        if not self.rawchannel:
            # if we are here the only possible option is to close the active service
            if currentlyPlayingNIM in nimList:
                print(
                    "[ABM-main][doTune] Tuner %s has been selected but it's busy. Stopping currently playing service."
                    % chr(ord('A') + currentlyPlayingNIM),
                    file=log)
                self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                )
                self.session.nav.stopService()
                self.rawchannel = resmanager.allocateRawChannel(
                    currentlyPlayingNIM)
                if self.rawchannel:
                    print(
                        "[ABM-main][doTune] The active service was stopped, and tuner %s is now free to use."
                        % chr(ord('A') + currentlyPlayingNIM),
                        file=log)
                    current_slotid = currentlyPlayingNIM

            if not self.rawchannel:
                if self.session.nav.RecordTimer.isRecording():
                    print(
                        "[ABM-main][doTune] Cannot free NIM because a recording is in progress",
                        file=log)
                    self.showError(
                        _('Cannot free NIM because a recording is in progress')
                    )
                    return
                else:
                    print("[ABM-main][doTune] Cannot get the NIM", file=log)
                    self.showError(_('Cannot get the NIM'))
                    return

        # set extended timeout for rotors
        self.motorised = False
        if self.providers[self.currentAction][
                "streamtype"] == "dvbs" and self.isRotorSat(
                    current_slotid, transponder["orbital_position"]):
            self.motorised = True
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_ROTOR
            print(
                "[ABM-main][doTune] Motorised dish. Will wait up to %i seconds for tuner lock."
                % (self.LOCK_TIMEOUT // 10),
                file=log)
        else:
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_FIXED
            print(
                "[ABM-main][doTune] Fixed dish. Will wait up to %i seconds for tuner lock."
                % (self.LOCK_TIMEOUT // 10),
                file=log)

        if not inStandby:
            self["tuner_text"].setText(chr(ord('A') + current_slotid))

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print("[ABM-main][doTune] Cannot get frontend", file=log)
            self.showError(_('Cannot get frontend'))
            return

        demuxer_id = self.rawchannel.reserveDemux()
        if demuxer_id < 0:
            print("[ABM-main][doTune] Cannot allocate the demuxer.", file=log)
            self.showError(_('Cannot allocate the demuxer.'))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            params = eDVBFrontendParametersSatellite()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.polarisation = transponder["polarization"]
            params.fec = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.orbital_position = transponder["orbital_position"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.rolloff = transponder["roll_off"]
            params.pilot = transponder["pilot"]
            if hasattr(eDVBFrontendParametersSatellite, "No_Stream_Id_Filter"):
                params.is_id = eDVBFrontendParametersSatellite.No_Stream_Id_Filter
            if hasattr(eDVBFrontendParametersSatellite, "PLS_Gold"):
                params.pls_mode = eDVBFrontendParametersSatellite.PLS_Gold
            if hasattr(eDVBFrontendParametersSatellite,
                       "PLS_Default_Gold_Code"):
                params.pls_code = eDVBFrontendParametersSatellite.PLS_Default_Gold_Code
            if hasattr(eDVBFrontendParametersSatellite, "No_T2MI_PLP_Id"):
                params.t2mi_plp_id = eDVBFrontendParametersSatellite.No_T2MI_PLP_Id
            if hasattr(eDVBFrontendParametersSatellite, "T2MI_Default_Pid"):
                params.t2mi_pid = eDVBFrontendParametersSatellite.T2MI_Default_Pid
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBS(params, False)

        elif self.providers[self.currentAction]["streamtype"] == "dvbt":
            params = eDVBFrontendParametersTerrestrial()
            params.frequency = transponder["frequency"]
            params.bandwidth = transponder["bandwidth"]
            params.code_rate_hp = transponder["code_rate_hp"]
            params.code_rate_lp = transponder["code_rate_lp"]
            params.inversion = transponder["inversion"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.transmission_mode = transponder["transmission_mode"]
            params.guard_interval = transponder["guard_interval"]
            params.hierarchy = transponder["hierarchy"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBT(params)

        elif self.providers[self.currentAction]["streamtype"] == "dvbc":
            params = eDVBFrontendParametersCable()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.fec_inner = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.modulation = transponder["modulation"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBC(params)

        try:
            self.rawchannel.requestTsidOnid()
        except TypeError:
            # for compatibility with some third party images
            self.rawchannel.requestTsidOnid(self.gotTsidOnid)

        self.frontend.tune(params_fe)
        self.manager.setAdapter(0)  # FIX: use the correct device
        self.manager.setDemuxer(demuxer_id)
        self.manager.setFrontend(current_slotid)

        self.current_slotid = current_slotid
        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #40
0
	if fileExists("/proc/bus/nim_sockets"):
		nimfile = open("/proc/bus/nim_sockets")
		data = nimfile.read().strip()
		nimfile.close()
		return len(data) > 0
	return False

SystemInfo["CommonInterface"] = eDVBCIInterfaces.getInstance().getNumOfSlots()
SystemInfo["CommonInterfaceCIDelay"] = fileCheck("/proc/stb/tsmux/rmx_delay")
for cislot in range (0, SystemInfo["CommonInterface"]):
	SystemInfo["CI%dSupportsHighBitrates" % cislot] = fileCheck("/proc/stb/tsmux/ci%d_tsclk"  % cislot)
	SystemInfo["CI%dRelevantPidsRoutingSupport" % cislot] = fileCheck("/proc/stb/tsmux/ci%d_relevant_pids_routing"  % cislot)

SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
SystemInfo["PIPAvailable"] = SystemInfo["NumVideoDecoders"] > 1
SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance().canMeasureFrontendInputPower()
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck("/proc/stb/video/zapping_mode")
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
SystemInfo["LCDsymbol_circle_recording"] = fileCheck("/proc/stb/lcd/symbol_circle") or getBoxType() in ("hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_recording")
SystemInfo["LCDsymbol_timeshift"] = fileCheck("/proc/stb/lcd/symbol_timeshift")
SystemInfo["LCDshow_symbols"] = (getBoxType().startswith("et9") or getBoxType() in  ("hd51", "vs1500")) and fileCheck("/proc/stb/lcd/show_symbols")
SystemInfo["LCDsymbol_hdd"] = getBoxType() in ("hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_hdd")
SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0")
SystemInfo["DeepstandbySupport"] = getBoxType() != "dm800"
SystemInfo["OledDisplay"] = fileExists(resolveFilename(SCOPE_SKIN, 'lcd_skin/skin_lcd_default.xml'))
SystemInfo["GraphicLCD"] = getBoxType() in ('quadbox2400')
SystemInfo["GBWOL"] = fileExists("/usr/bin/gigablue_wol")
SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan")
コード例 #41
0
    def doTune(self):
        from Screens.Standby import inStandby
        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            transponder = self.providers[self.currentAction]["transponder"]
        else:
            bouquet_key = None
            providers_tmp = config.autobouquetsmaker.providers.value.split("|")
            for provider_tmp in providers_tmp:
                provider_config = ProviderConfig(provider_tmp)
                provider_key = provider_config.getProvider()
                if self.currentAction != provider_key:
                    continue
                bouquet_key = provider_config.getArea()

            if not bouquet_key:
                print >> log, "[AutoBouquetsMaker] No area found"
                self.showError(_('No area found'))
                return

            transponder = self.providers[
                self.currentAction]["bouquets"][bouquet_key]

        nimList = []
        for nim in nimmanager.nim_slots:
            if (self.providers[self.currentAction]["streamtype"] == "dvbs"
                    and nim.isCompatible("DVB-S")
                    and nim.config_mode not in ("loopthrough")) or (
                        self.providers[self.currentAction]["streamtype"]
                        == "dvbc" and nim.isCompatible("DVB-C")) or (
                            self.providers[self.currentAction]["streamtype"]
                            == "dvbt" and nim.isCompatible("DVB-T")):
                nimList.append(nim.slot)
        if len(nimList) == 0:
            print >> log, "[AutoBouquetsMaker] No NIMs found"
            self.showError(_('No NIMs found'))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print >> log, "[AutoBouquetsMaker] Cannot retrieve Resource Manager instance"
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            print >> log, "[AutoBouquetsMaker] Search NIM for orbital position %d" % transponder[
                "orbital_position"]
        else:
            print >> log, "[AutoBouquetsMaker] Search NIM"

        current_slotid = -1
        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList.reverse()  # start from the last
        for slotid in nimList:
            if self.providers[self.currentAction]["streamtype"] == "dvbs":
                sats = nimmanager.getSatListForNim(slotid)
                for sat in sats:
                    if sat[0] == transponder["orbital_position"]:
                        if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                            current_slotid = slotid

                        self.rawchannel = resmanager.allocateRawChannel(slotid)
                        if self.rawchannel:
                            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d with sat %s" % (
                                slotid, sat[1])
                            current_slotid = slotid
                            break
            else:
                if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                    current_slotid = slotid
                self.rawchannel = resmanager.allocateRawChannel(slotid)
                if self.rawchannel:
                    print >> log, "[AutoBouquetsMaker] Nim found on slot id %d" % (
                        slotid)
                    current_slotid = slotid
                    break

            if self.rawchannel:
                break

        if current_slotid == -1:
            print >> log, "[AutoBouquetsMaker] No valid NIM found"
            self.showError(_('No valid NIM found'))
            return

        if not self.rawchannel:
            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stop current service" % current_slotid
            if self.session.nav.RecordTimer.isRecording():
                print >> log, "[AutoBouquetsMaker] Cannot free NIM because a record is in progress"
                self.showError(
                    _('Cannot free NIM because a record is in progress'))
                return

            self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
            )
            self.session.nav.stopService()
            if self.session.pipshown:
                self.session.pipshown = False

            self.rawchannel = resmanager.allocateRawChannel(current_slotid)
            if not self.rawchannel:
                print >> log, "[AutoBouquetsMaker] Cannot get the NIM"
                self.showError(_('Cannot get the NIM'))
                return

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print >> log, "[AutoBouquetsMaker] Cannot get frontend"
            self.showError(_('Cannot get frontend'))
            return

        demuxer_id = self.rawchannel.reserveDemux()
        if demuxer_id < 0:
            print >> log, "[AutoBouquetsMaker] Cannot allocate the demuxer"
            self.showError(_('Cannot allocate the demuxer'))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            params = eDVBFrontendParametersSatellite()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.polarisation = transponder["polarization"]
            params.fec = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.orbital_position = transponder["orbital_position"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.rolloff = transponder["roll_off"]
            params.pilot = transponder["pilot"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBS(params, False)

        elif self.providers[self.currentAction]["streamtype"] == "dvbt":
            params = eDVBFrontendParametersTerrestrial()
            params.frequency = transponder["frequency"]
            params.bandwidth = transponder["bandwidth"]
            params.code_rate_hp = transponder["code_rate_hp"]
            params.code_rate_lp = transponder["code_rate_lp"]
            params.inversion = transponder["inversion"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.transmission_mode = transponder["transmission_mode"]
            params.guard_interval = transponder["guard_interval"]
            params.hierarchy = transponder["hierarchy"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBT(params)

        elif self.providers[self.currentAction]["streamtype"] == "dvbc":
            params = eDVBFrontendParametersCable()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.fec_inner = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.modulation = transponder["modulation"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBC(params)

        self.rawchannel.requestTsidOnid()
        self.frontend.tune(params_fe)
        self.manager.setAdapter(0)  # FIX: use the correct device
        self.manager.setDemuxer(demuxer_id)
        self.manager.setFrontend(current_slotid)

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #42
0
	def doTune(self):
		from Screens.Standby import inStandby
		transponder = self.providers[self.currentAction]["transponder"]
		nimList = nimmanager.getNimListOfType("DVB-S")
		if len(nimList) == 0:
			print>>log, "[AutoBouquetsMaker] No DVB-S NIMs founds"
			self.showError(_('No DVB-S NIMs founds'))
			return

		resmanager = eDVBResourceManager.getInstance()
		if not resmanager:
			print>>log, "[AutoBouquetsMaker] Cannot retrieve Resource Manager instance"
			self.showError(_('Cannot retrieve Resource Manager instance'))
			return

		print>>log, "[AutoBouquetsMaker] Search NIM for orbital position %d" % transponder["orbital_position"]
		current_slotid = -1
		if self.rawchannel:
			del(self.rawchannel)

		self.frontend = None
		self.rawchannel = None

		nimList.reverse() # start from the last
		for slotid in nimList:
			sats = nimmanager.getSatListForNim(slotid)
			for sat in sats:
				if sat[0] == transponder["orbital_position"]:
					if current_slotid == -1:	# mark the first valid slotid in case of no other one is free
						current_slotid = slotid

					self.rawchannel = resmanager.allocateRawChannel(slotid)
					if self.rawchannel:
						print>>log, "[AutoBouquetsMaker] Nim found on slot id %d with sat %s" % (slotid, sat[1])
						current_slotid = slotid
						break

			if self.rawchannel:
				break

		if current_slotid == -1:
			print>>log, "[AutoBouquetsMaker] No valid NIM found"
			self.showError(_('No valid NIM found'))
			return

		if not self.rawchannel:
			print>>log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stop current service" % current_slotid
			if self.session.nav.RecordTimer.isRecording():
				print>>log, "[AutoBouquetsMaker] Cannot free NIM because a record is in progress"
				self.showError(_('Cannot free NIM because a record is in progress'))
				return

			self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
			self.session.nav.stopService()
			if self.session.pipshown:
				self.session.pipshown = False

			self.rawchannel = resmanager.allocateRawChannel(current_slotid)
			if not self.rawchannel:
				print>>log, "[AutoBouquetsMaker] Cannot get the NIM"
				self.showError(_('Cannot get the NIM'))
				return

		self.frontend = self.rawchannel.getFrontend()
		if not self.frontend:
			print>>log, "[AutoBouquetsMaker] Cannot get frontend"
			self.showError(_('Cannot get frontend'))
			return

		demuxer_id = self.rawchannel.reserveDemux()
		if demuxer_id < 0:
			print>>log, "[AutoBouquetsMaker] Cannot allocate the demuxer"
			self.showError(_('Cannot allocate the demuxer'))
			return

		params = eDVBFrontendParametersSatellite()
		params.frequency = transponder["frequency"]
		params.symbol_rate = transponder["symbol_rate"]
		params.polarisation = transponder["polarization"]
		params.fec = transponder["fec_inner"]
		params.inversion = transponder["inversion"]
		params.orbital_position = transponder["orbital_position"]
		params.system = transponder["system"]
		params.modulation = transponder["modulation"]
		params.rolloff = transponder["roll_off"]
		params.pilot = transponder["pilot"]
		params_fe = eDVBFrontendParameters()
		params_fe.setDVBS(params, False)
		self.rawchannel.requestTsidOnid()
		self.frontend.tune(params_fe)
		self.manager.setAdapter(0)	# FIX: use the correct device
		self.manager.setDemuxer(demuxer_id)
		self.manager.setFrontend(current_slotid)

		self.lockcounter = 0
		self.locktimer = eTimer()
		self.locktimer.callback.append(self.checkTunerLock)
		self.locktimer.start(100, 1)
コード例 #43
0
    def getFrontend(self):
        print("[MisPlsLcnScan][getFrontend] searching for available tuner")
        nimList = []
        for nim in nimmanager.nim_slots:
            if not nim.isCompatible("DVB-S") or \
             not nim.isMultistream() or \
             nim.isFBCLink() or \
             (hasattr(nim, 'config_mode_dvbs') and nim.config_mode_dvbs or nim.config_mode) in ("loopthrough", "satposdepends", "nothing") or \
             self.transpondercurrent.orbital_position not in [sat[0] for sat in nimmanager.getSatListForNim(nim.slot)]:
                continue
            nimList.append(nim.slot)

        if len(nimList) == 0:
            print("[MisPlsLcnScan][getFrontend] No compatible tuner found")
            self.showError(_('No compatible tuner found'))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print(
                "[MisPlsLcnScan][getFrontend] Cannot retrieve Resource Manager instance"
            )
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        # stop pip if running
        if self.session.pipshown:
            self.session.pipshown = False
            del self.session.pip
            print("[MisPlsLcnScan][getFrontend] Stopping PIP.")

        # stop currently playing service if it is using a tuner in ("loopthrough", "satposdepends")
        currentlyPlayingNIM = None
        currentService = self.session and self.session.nav.getCurrentService()
        frontendInfo = currentService and currentService.frontendInfo()
        frontendData = frontendInfo and frontendInfo.getAll(True)
        if frontendData is not None:
            currentlyPlayingNIM = frontendData.get("tuner_number", None)
            if currentlyPlayingNIM is not None and nimmanager.nim_slots[
                    currentlyPlayingNIM].isCompatible("DVB-S"):
                nimConfigMode = hasattr(
                    nimmanager.nim_slots[currentlyPlayingNIM],
                    "config_mode_dvbs"
                ) and nimmanager.nim_slots[
                    currentlyPlayingNIM].config_mode_dvbs or nimmanager.nim_slots[
                        currentlyPlayingNIM].config_mode
                if nimConfigMode in ("loopthrough", "satposdepends"):
                    self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                    )
                    self.session.nav.stopService()
                    currentlyPlayingNIM = None
                    print(
                        "[MisPlsLcnScan][getFrontend] The active service was using a %s tuner, so had to be stopped (slot id %s)."
                        % (nimConfigMode, currentlyPlayingNIM))
        del frontendInfo
        del currentService

        current_slotid = -1
        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList = [
            slot for slot in nimList if
            not self.isRotorSat(slot, self.transpondercurrent.orbital_position)
        ] + [
            slot for slot in nimList
            if self.isRotorSat(slot, self.transpondercurrent.orbital_position)
        ]  #If we have a choice of dishes try "fixed" before "motorised".
        for slotid in nimList:
            if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                current_slotid = slotid

            self.rawchannel = resmanager.allocateRawChannel(slotid)
            if self.rawchannel:
                print(
                    "[MisPlsLcnScan][getFrontend] Nim found on slot id %d with sat %s"
                    % (slotid,
                       nimmanager.getSatName(
                           self.transpondercurrent.orbital_position)))
                current_slotid = slotid
                break

            if self.rawchannel:
                break

        if current_slotid == -1:
            print("[MisPlsLcnScan][getFrontend] No valid NIM found")
            self.showError(
                _('No valid NIM found for %s') %
                PROVIDERS[config.plugins.MisPlsLcnScan.provider.value]["name"])
            return

        if not self.rawchannel:
            # if we are here the only possible option is to close the active service
            if currentlyPlayingNIM in nimList:
                slotid = currentlyPlayingNIM
                print(
                    "[MisPlsLcnScan][getFrontend] Nim found on slot id %d but it's busy. Stopping active service"
                    % slotid)
                self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                )
                self.session.nav.stopService()
                self.rawchannel = resmanager.allocateRawChannel(slotid)
                if self.rawchannel:
                    print(
                        "[MisPlsLcnScan][getFrontend] The active service was stopped, and the NIM is now free to use."
                    )
                    current_slotid = slotid

            if not self.rawchannel:
                if self.session.nav.RecordTimer.isRecording():
                    print(
                        "[MisPlsLcnScan][getFrontend] Cannot free NIM because a recording is in progress"
                    )
                    self.showError(
                        _('Cannot free NIM because a recording is in progress')
                    )
                    return
                else:
                    print("[MisPlsLcnScan][getFrontend] Cannot get the NIM")
                    self.showError(_('Cannot get the NIM'))
                    return

        # set extended timeout for rotors
        self.motorised = False
        if self.isRotorSat(current_slotid,
                           self.transpondercurrent.orbital_position):
            self.motorised = True
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_ROTOR
            print(
                "[MisPlsLcnScan][getFrontend] Motorised dish. Will wait up to %i seconds for tuner lock."
                % (self.LOCK_TIMEOUT // 10))
        else:
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_FIXED
            print(
                "[MisPlsLcnScan][getFrontend] Fixed dish. Will wait up to %i seconds for tuner lock."
                % (self.LOCK_TIMEOUT // 10))

        self.selectedNIM = current_slotid  # Remember for downloading SI tables

        self["tuner_text"].setText(chr(ord('A') + current_slotid))

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print("[MisPlsLcnScan][getFrontend] Cannot get frontend")
            self.showError(_('Cannot get frontend'))
            return

        self.demuxer_id = self.rawchannel.reserveDemux()
        if self.demuxer_id < 0:
            print("[MisPlsLcnScan][getFrontend] Cannot allocate the demuxer.")
            self.showError(_('Cannot allocate the demuxer.'))
            return

        params_fe = eDVBFrontendParameters()
        params_fe.setDVBS(self.transpondercurrent, False)

        #		try:
        #			self.rawchannel.requestTsidOnid()
        #		except (TypeError):
        #			# for compatibility with some third party images
        #			self.rawchannel.requestTsidOnid(self.gotTsidOnid)

        self.frontend.tune(params_fe)

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #44
0
    def doTune(self):
        from Screens.Standby import inStandby
        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            transponder = self.providers[self.currentAction]["transponder"]
        else:
            bouquet_key = None
            providers_tmp = config.autobouquetsmaker.providers.value.split("|")
            for provider_tmp in providers_tmp:
                provider_config = ProviderConfig(provider_tmp)
                provider_key = provider_config.getProvider()
                if self.currentAction != provider_key:
                    continue
                bouquet_key = provider_config.getArea()

            if not bouquet_key:
                print >> log, "[AutoBouquetsMaker] No area found"
                self.showError(_('No area found'))
                return

            transponder = self.providers[
                self.currentAction]["bouquets"][bouquet_key]

        nimList = []
        for nim in nimmanager.nim_slots:
            if (nim.config_mode not in
                ("loopthrough", "satposdepends", "nothing")) and (
                    (self.providers[self.currentAction]["streamtype"] == "dvbs"
                     and nim.isCompatible("DVB-S")) or
                    (self.providers[self.currentAction]["streamtype"] == "dvbc"
                     and nim.isCompatible("DVB-C")) or
                    (self.providers[self.currentAction]["streamtype"] == "dvbt"
                     and nim.isCompatible("DVB-T"))):
                nimList.append(nim.slot)
        if len(nimList) == 0:
            print >> log, "[AutoBouquetsMaker] No NIMs found"
            self.showError(_('No NIMs found'))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print >> log, "[AutoBouquetsMaker] Cannot retrieve Resource Manager instance"
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            print >> log, "[AutoBouquetsMaker] Search NIM for orbital position %d" % transponder[
                "orbital_position"]
        else:
            print >> log, "[AutoBouquetsMaker] Search NIM"

        # stop pip if running
        if self.session.pipshown:
            self.session.pipshown = False
            del self.session.pip
            print >> log, "[AutoBouquetsMaker] Stopping PIP."

        # stop currently playing service if it is using a tuner in ("loopthrough", "satposdepends")
        currentlyPlayingNIM = None
        currentService = self.session and self.session.nav.getCurrentService()
        frontendInfo = currentService and currentService.frontendInfo()
        frontendData = frontendInfo and frontendInfo.getAll(True)
        if frontendData is not None:
            currentlyPlayingNIM = frontendData.get("tuner_number", None)
            if self.providers[self.currentAction][
                    "streamtype"] == "dvbs" and currentlyPlayingNIM is not None:
                nimConfigMode = nimmanager.nim_slots[
                    currentlyPlayingNIM].config_mode
                if nimConfigMode in ("loopthrough", "satposdepends"):
                    self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                    )
                    self.session.nav.stopService()
                    currentlyPlayingNIM = None
                    print >> log, "[AutoBouquetsMaker] The active service was using a %s tuner, so had to be stopped (slot id %s)." % (
                        nimConfigMode, currentlyPlayingNIM)
        del frontendInfo
        del currentService

        current_slotid = -1
        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList.reverse()  # start from the last
        for slotid in nimList:
            if self.providers[self.currentAction]["streamtype"] == "dvbs":
                sats = nimmanager.getSatListForNim(slotid)
                for sat in sats:
                    if sat[0] == transponder["orbital_position"]:
                        if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                            current_slotid = slotid

                        self.rawchannel = resmanager.allocateRawChannel(slotid)
                        if self.rawchannel:
                            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d with sat %s" % (
                                slotid, sat[1])
                            current_slotid = slotid
                            break
            else:
                if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                    current_slotid = slotid
                self.rawchannel = resmanager.allocateRawChannel(slotid)
                if self.rawchannel:
                    print >> log, "[AutoBouquetsMaker] Nim found on slot id %d" % (
                        slotid)
                    current_slotid = slotid
                    break

            if self.rawchannel:
                break

        if current_slotid == -1:
            print >> log, "[AutoBouquetsMaker] No valid NIM found"
            self.showError(_('No valid NIM found'))
            return

        if not self.rawchannel:
            # if we are here the only possible option is to close the active service
            if currentlyPlayingNIM in nimList:
                slotid = currentlyPlayingNIM
                if self.providers[self.currentAction]["streamtype"] == "dvbs":
                    sats = nimmanager.getSatListForNim(currentlyPlayingNIM)
                    for sat in sats:
                        if sat[0] == transponder["orbital_position"]:
                            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stopping active service" % currentlyPlayingNIM
                            self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                            )
                            self.session.nav.stopService()
                            self.rawchannel = resmanager.allocateRawChannel(
                                slotid)
                            break
                else:
                    print >> log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stopping active service" % currentlyPlayingNIM
                    self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                    )
                    self.session.nav.stopService()
                    self.rawchannel = resmanager.allocateRawChannel(slotid)

            if not self.rawchannel:
                if self.session.nav.RecordTimer.isRecording():
                    print >> log, "[AutoBouquetsMaker] Cannot free NIM because a record is in progress"
                    self.showError(
                        _('Cannot free NIM because a recording is in progress')
                    )
                    return
                else:
                    print >> log, "[AutoBouquetsMaker] Cannot get the NIM"
                    self.showError(_('Cannot get the NIM'))
                    return

        # set extended timeout for rotors
        if self.providers[self.currentAction][
                "streamtype"] == "dvbs" and self.isRotorSat(
                    slotid, transponder["orbital_position"]):
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_ROTOR
            print >> log, "[AutoBouquetsMaker] Motorised dish. Will wait up to %i seconds for tuner lock." % (
                self.LOCK_TIMEOUT / 10)
        else:
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_FIXED
            print >> log, "[AutoBouquetsMaker] Fixed dish. Will wait up to %i seconds for tuner lock." % (
                self.LOCK_TIMEOUT / 10)

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print >> log, "[AutoBouquetsMaker] Cannot get frontend"
            self.showError(_('Cannot get frontend'))
            return

        demuxer_id = self.rawchannel.reserveDemux()
        if demuxer_id < 0:
            print >> log, "[AutoBouquetsMaker] Cannot allocate the demuxer"
            self.showError(_('Cannot allocate the demuxer'))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            params = eDVBFrontendParametersSatellite()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.polarisation = transponder["polarization"]
            params.fec = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.orbital_position = transponder["orbital_position"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.rolloff = transponder["roll_off"]
            params.pilot = transponder["pilot"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBS(params, False)

        elif self.providers[self.currentAction]["streamtype"] == "dvbt":
            params = eDVBFrontendParametersTerrestrial()
            params.frequency = transponder["frequency"]
            params.bandwidth = transponder["bandwidth"]
            params.code_rate_hp = transponder["code_rate_hp"]
            params.code_rate_lp = transponder["code_rate_lp"]
            params.inversion = transponder["inversion"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.transmission_mode = transponder["transmission_mode"]
            params.guard_interval = transponder["guard_interval"]
            params.hierarchy = transponder["hierarchy"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBT(params)

        elif self.providers[self.currentAction]["streamtype"] == "dvbc":
            params = eDVBFrontendParametersCable()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.fec_inner = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.modulation = transponder["modulation"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBC(params)

        self.rawchannel.requestTsidOnid()
        self.frontend.tune(params_fe)
        self.manager.setAdapter(0)  # FIX: use the correct device
        self.manager.setDemuxer(demuxer_id)
        self.manager.setFrontend(current_slotid)

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #45
0
ファイル: main.py プロジェクト: mickeyreg/GOS-plugins
    def doTune(self):
        from Screens.Standby import inStandby

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            transponder = self.providers[self.currentAction]["transponder"]
        else:
            bouquet_key = None
            providers_tmp = config.autobouquetsmaker.providers.value.split("|")
            for provider_tmp in providers_tmp:
                provider_config = ProviderConfig(provider_tmp)
                provider_key = provider_config.getProvider()
                if self.currentAction != provider_key:
                    continue
                bouquet_key = provider_config.getArea()

            if not bouquet_key:
                print >> log, "[AutoBouquetsMaker] No area found"
                self.showError(_("No area found"))
                return

            transponder = self.providers[self.currentAction]["bouquets"][bouquet_key]

        nimList = []
        for nim in nimmanager.nim_slots:
            if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and (
                (self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.isCompatible("DVB-S"))
                or (self.providers[self.currentAction]["streamtype"] == "dvbc" and nim.isCompatible("DVB-C"))
                or (self.providers[self.currentAction]["streamtype"] == "dvbt" and nim.isCompatible("DVB-T"))
            ):
                nimList.append(nim.slot)
        if len(nimList) == 0:
            print >> log, "[AutoBouquetsMaker] No NIMs found"
            self.showError(_("No NIMs found"))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print >> log, "[AutoBouquetsMaker] Cannot retrieve Resource Manager instance"
            self.showError(_("Cannot retrieve Resource Manager instance"))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            print >> log, "[AutoBouquetsMaker] Search NIM for orbital position %d" % transponder["orbital_position"]
        else:
            print >> log, "[AutoBouquetsMaker] Search NIM"

            # stop pip if running
        if self.session.pipshown:
            self.session.pipshown = False
            del self.session.pip
            print >> log, "[AutoBouquetsMaker] Stopping PIP."

            # stop currently playing service if it is using a tuner in ("loopthrough", "satposdepends")
        currentlyPlayingNIM = None
        currentService = self.session and self.session.nav.getCurrentService()
        frontendInfo = currentService and currentService.frontendInfo()
        frontendData = frontendInfo and frontendInfo.getAll(True)
        if frontendData is not None:
            currentlyPlayingNIM = frontendData.get("tuner_number", None)
            if self.providers[self.currentAction]["streamtype"] == "dvbs" and currentlyPlayingNIM is not None:
                nimConfigMode = nimmanager.nim_slots[currentlyPlayingNIM].config_mode
                if nimConfigMode in ("loopthrough", "satposdepends"):
                    self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
                    self.session.nav.stopService()
                    currentlyPlayingNIM = None
                    print >> log, "[AutoBouquetsMaker] The active service was using a %s tuner, so had to be stopped (slot id %s)." % (
                        nimConfigMode,
                        currentlyPlayingNIM,
                    )
        del frontendInfo
        del currentService

        current_slotid = -1
        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList.reverse()  # start from the last
        for slotid in nimList:
            if self.providers[self.currentAction]["streamtype"] == "dvbs":
                sats = nimmanager.getSatListForNim(slotid)
                for sat in sats:
                    if sat[0] == transponder["orbital_position"]:
                        if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                            current_slotid = slotid

                        self.rawchannel = resmanager.allocateRawChannel(slotid)
                        if self.rawchannel:
                            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d with sat %s" % (slotid, sat[1])
                            current_slotid = slotid
                            break
            else:
                if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                    current_slotid = slotid
                self.rawchannel = resmanager.allocateRawChannel(slotid)
                if self.rawchannel:
                    print >> log, "[AutoBouquetsMaker] Nim found on slot id %d" % (slotid)
                    current_slotid = slotid
                    break

            if self.rawchannel:
                break

        if current_slotid == -1:
            print >> log, "[AutoBouquetsMaker] No valid NIM found"
            self.showError(_("No valid NIM found"))
            return

        if not self.rawchannel:
            # if we are here the only possible option is to close the active service
            if currentlyPlayingNIM in nimList:
                slotid = currentlyPlayingNIM
                if self.providers[self.currentAction]["streamtype"] == "dvbs":
                    sats = nimmanager.getSatListForNim(currentlyPlayingNIM)
                    for sat in sats:
                        if sat[0] == transponder["orbital_position"]:
                            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stopping active service" % currentlyPlayingNIM
                            self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
                            self.session.nav.stopService()
                            self.rawchannel = resmanager.allocateRawChannel(slotid)
                            break
                else:
                    print >> log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stopping active service" % currentlyPlayingNIM
                    self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
                    self.session.nav.stopService()
                    self.rawchannel = resmanager.allocateRawChannel(slotid)

            if not self.rawchannel:
                if self.session.nav.RecordTimer.isRecording():
                    print >> log, "[AutoBouquetsMaker] Cannot free NIM because a record is in progress"
                    self.showError(_("Cannot free NIM because a recording is in progress"))
                    return
                else:
                    print >> log, "[AutoBouquetsMaker] Cannot get the NIM"
                    self.showError(_("Cannot get the NIM"))
                    return

                    # set extended timeout for rotors
        if self.providers[self.currentAction]["streamtype"] == "dvbs" and self.isRotorSat(
            slotid, transponder["orbital_position"]
        ):
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_ROTOR
            print >> log, "[AutoBouquetsMaker] Motorised dish. Will wait up to %i seconds for tuner lock." % (
                self.LOCK_TIMEOUT / 10
            )
        else:
            self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_FIXED
            print >> log, "[AutoBouquetsMaker] Fixed dish. Will wait up to %i seconds for tuner lock." % (
                self.LOCK_TIMEOUT / 10
            )

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print >> log, "[AutoBouquetsMaker] Cannot get frontend"
            self.showError(_("Cannot get frontend"))
            return

        demuxer_id = self.rawchannel.reserveDemux()
        if demuxer_id < 0:
            print >> log, "[AutoBouquetsMaker] Cannot allocate the demuxer"
            self.showError(_("Cannot allocate the demuxer"))
            return

        if self.providers[self.currentAction]["streamtype"] == "dvbs":
            params = eDVBFrontendParametersSatellite()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.polarisation = transponder["polarization"]
            params.fec = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.orbital_position = transponder["orbital_position"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.rolloff = transponder["roll_off"]
            params.pilot = transponder["pilot"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBS(params, False)

        elif self.providers[self.currentAction]["streamtype"] == "dvbt":
            params = eDVBFrontendParametersTerrestrial()
            params.frequency = transponder["frequency"]
            params.bandwidth = transponder["bandwidth"]
            params.code_rate_hp = transponder["code_rate_hp"]
            params.code_rate_lp = transponder["code_rate_lp"]
            params.inversion = transponder["inversion"]
            params.system = transponder["system"]
            params.modulation = transponder["modulation"]
            params.transmission_mode = transponder["transmission_mode"]
            params.guard_interval = transponder["guard_interval"]
            params.hierarchy = transponder["hierarchy"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBT(params)

        elif self.providers[self.currentAction]["streamtype"] == "dvbc":
            params = eDVBFrontendParametersCable()
            params.frequency = transponder["frequency"]
            params.symbol_rate = transponder["symbol_rate"]
            params.fec_inner = transponder["fec_inner"]
            params.inversion = transponder["inversion"]
            params.modulation = transponder["modulation"]
            params_fe = eDVBFrontendParameters()
            params_fe.setDVBC(params)

        self.rawchannel.requestTsidOnid()
        self.frontend.tune(params_fe)
        self.manager.setAdapter(0)  # FIX: use the correct device
        self.manager.setDemuxer(demuxer_id)
        self.manager.setFrontend(current_slotid)

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #46
0
ファイル: SystemInfo.py プロジェクト: TwolDE2/ATV65
# 	_("Welcome to %s") % BoxInfo.getItem("displaydistro", "Enigma2")
# ]
# BoxInfo.setItem("InformationDistributionWelcome", welcome)

BoxInfo.setItem("12V_Output", Misc_Options.getInstance().detected_12V_output())  #FIXME : Do we need this?
BoxInfo.setItem("3DMode", fileCheck("/proc/stb/fb/3dmode") or fileCheck("/proc/stb/fb/primary/3d"))
BoxInfo.setItem("3DZNorm", fileCheck("/proc/stb/fb/znorm") or fileCheck("/proc/stb/fb/primary/zoffset"))
BoxInfo.setItem("7segment", DISPLAYTYPE in ("7segment",))
BoxInfo.setItem("AmlogicFamily", SOC_FAMILY.startswith(("aml", "meson")) or exists("/proc/device-tree/amlogic-dt-id") or exists("/usr/bin/amlhalt") or exists("/sys/module/amports"))
BoxInfo.setItem("ArchIsARM64", ARCHITECTURE == "aarch64" or "64" in ARCHITECTURE)
BoxInfo.setItem("ArchIsARM", ARCHITECTURE.startswith(("arm", "cortex")))
BoxInfo.setItem("Blindscan", isPluginInstalled("Blindscan"))
BoxInfo.setItem("BoxName", GetBoxName())
canImageBackup = not MODEL.startswith('az') and not BRAND.startswith('cube') and not BRAND.startswith('wetek') and not MODEL.startswith('alien')
BoxInfo.setItem("canImageBackup", canImageBackup)
BoxInfo.setItem("CanMeasureFrontendInputPower", eDVBResourceManager.getInstance().canMeasureFrontendInputPower())
BoxInfo.setItem("canMultiBoot", MultiBoot.getBootSlots())
BoxInfo.setItem("CanNotDoSimultaneousTranscodeAndPIP", MODEL in ("vusolo4k", "gbquad4k", "gbue4k"))
BoxInfo.setItem("canRecovery", MODEL in ("hd51", "vs1500", "h7", "8100s") and ("disk.img", "mmcblk0p1") or MODEL in ("xc7439", "osmio4k", "osmio4kplus", "osmini4k") and ("emmc.img", "mmcblk1p1") or MODEL in ("gbmv200", "cc1", "sf8008", "sf8008m", "sf8008opt", "sx988", "ustym4kpro", "ustym4kottpremium", "beyonwizv2", "viper4k", "og2ott4k") and ("usb_update.bin", "none"))
BoxInfo.setItem("CanUse3DModeChoices", fileExists("/proc/stb/fb/3dmode_choices") and True or False)
BoxInfo.setItem("CIHelper", fileExists("/usr/bin/cihelper"))
BoxInfo.setItem("DeepstandbySupport", MODEL != 'dm800')
BoxInfo.setItem("DefaultDisplayBrightness", MODEL in ("dm900", "dm920") and 8 or 5)
BoxInfo.setItem("FBLCDDisplay", fileCheck("/proc/stb/fb/sd_detach"))
BoxInfo.setItem("Fan", fileCheck("/proc/stb/fp/fan"))
BoxInfo.setItem("FanPWM", BoxInfo.getItem("Fan") and fileCheck("/proc/stb/fp/fan_pwm"))
BoxInfo.setItem("ForceLNBPowerChanged", fileCheck("/proc/stb/frontend/fbc/force_lnbon"))
BoxInfo.setItem("ForceToneBurstChanged", fileCheck("/proc/stb/frontend/fbc/force_toneburst"))
BoxInfo.setItem("FrontpanelDisplay", fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0"))
BoxInfo.setItem("GBWOL", fileExists("/usr/bin/gigablue_wol"))
BoxInfo.setItem("grautec", fileExists("/tmp/usbtft"))
コード例 #47
0
ファイル: Satconfig.py プロジェクト: R0T13Z/enigma2
	def extraInfo(self):
		nim = self["nimlist"].getCurrent()
		nim = nim and nim[3]
		if config.usage.setup_level.index >= 2 and nim is not None:
			text = _("Capabilities: ") + eDVBResourceManager.getInstance().getFrontendCapabilities(nim.slot)
			self.session.open(MessageBox, text, MessageBox.TYPE_INFO, simple=True)
コード例 #48
0
    def TunerTypeChanged(self):
        fe_id = int(self.scan_nims.value)
        multiType = config.Nims[fe_id].multiType
        system = multiType.getText()
        if system in (
                'DVB-S', 'DVB-S2'
        ) and config.Nims[fe_id].dvbs.configMode.value == 'nothing' or system in (
                'DVB-T', 'DVB-T2'
        ) and config.Nims[
                fe_id].dvbt.configMode.value == 'nothing' or system in 'DVB-C' and config.Nims[
                    fe_id].dvbc.configMode.value == 'nothing' or system in 'ATSC' and config.Nims[
                        fe_id].atsc.configMode.value == 'nothing':
            return
        else:
            slot = nimmanager.nim_slots[fe_id]
            print 'dvb_api_version ', iDVBFrontend.dvb_api_version
            self.frontend = None
            if not self.openFrontend():
                self.session.nav.stopService()
                if not self.openFrontend():
                    if self.session.pipshown:
                        from Screens.InfoBar import InfoBar
                        InfoBar.instance and hasattr(
                            InfoBar.instance,
                            'showPiP') and InfoBar.instance.showPiP()
                        if not self.openFrontend():
                            self.frontend = None
            self.tuner = Tuner(self.frontend)
            if slot.isMultiType():
                eDVBResourceManager.getInstance().setFrontendType(
                    slot.frontend_id, 'dummy', False)
                types = slot.getMultiTypeList()
                for FeType in types.itervalues():
                    if FeType in (
                            'DVB-S', 'DVB-S2', 'DVB-S2X') and config.Nims[
                                slot.slot].dvbs.configMode.value == 'nothing':
                        continue
                    elif FeType in ('DVB-T', 'DVB-T2') and config.Nims[
                            slot.slot].dvbt.configMode.value == 'nothing':
                        continue
                    elif FeType in ('DVB-C', 'DVB-C2') and config.Nims[
                            slot.slot].dvbc.configMode.value == 'nothing':
                        continue
                    elif FeType in 'ATSC' and config.Nims[
                            slot.slot].atsc.configMode.value == 'nothing':
                        continue
                    eDVBResourceManager.getInstance().setFrontendType(
                        slot.frontend_id, FeType, True)

            else:
                eDVBResourceManager.getInstance().setFrontendType(
                    slot.frontend_id, slot.getType())
            print 'api >=5 and new style tuner driver'
            if self.frontend:
                if system == 'DVB-C':
                    ret = self.frontend.changeType(iDVBFrontend.feCable)
                elif system in ('DVB-T', 'DVB-T2'):
                    ret = self.frontend.changeType(iDVBFrontend.feTerrestrial)
                elif system in ('DVB-S', 'DVB-S2'):
                    ret = self.frontend.changeType(iDVBFrontend.feSatellite)
                elif system == 'ATSC':
                    ret = self.frontend.changeType(iDVBFrontend.feATSC)
                else:
                    ret = False
                if not ret:
                    print "%d: tunerTypeChange to '%s' failed" % (fe_id,
                                                                  system)
                else:
                    print 'new system ', system
            else:
                print "%d: tunerTypeChange to '%s' failed (BUSY)" % (
                    fe_id, multiType.getText())
            return
コード例 #49
0
	def extraInfo(self):
		nim = self["nimlist"].getCurrent()
		nim = nim and nim[3]
		if config.usage.setup_level.index >= 2 and nim is not None:
			text = _("Capabilities: ") + eDVBResourceManager.getInstance().getFrontendCapabilities(nim.slot)
			self.session.open(MessageBox, text, MessageBox.TYPE_INFO, simple=True)
コード例 #50
0
ファイル: main.py プロジェクト: anaboland/oe-alliance-plugins
	def doTune(self):
		from Screens.Standby import inStandby
		if self.providers[self.currentAction]["streamtype"] == "dvbs":
			transponder = self.providers[self.currentAction]["transponder"]
		else:
			bouquet_key = None
			providers_tmp = config.autobouquetsmaker.providers.value.split("|")
			for provider_tmp in providers_tmp:
				provider_config = ProviderConfig(provider_tmp)
				provider_key = provider_config.getProvider()
				if self.currentAction != provider_key:
					continue
				bouquet_key = provider_config.getArea()

			if not bouquet_key:
				print>>log, "[AutoBouquetsMaker] No area found"
				self.showError(_('No area found'))
				return
			
			transponder = self.providers[self.currentAction]["bouquets"][bouquet_key]

		nimList = []
		for nim in nimmanager.nim_slots:
			if (self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.isCompatible("DVB-S") and nim.config_mode not in ("loopthrough")) or (self.providers[self.currentAction]["streamtype"] == "dvbc" and nim.isCompatible("DVB-C")) or (self.providers[self.currentAction]["streamtype"] == "dvbt" and nim.isCompatible("DVB-T")):
				nimList.append(nim.slot)
		if len(nimList) == 0:
			print>>log, "[AutoBouquetsMaker] No NIMs found"
			self.showError(_('No NIMs found'))
			return

		resmanager = eDVBResourceManager.getInstance()
		if not resmanager:
			print>>log, "[AutoBouquetsMaker] Cannot retrieve Resource Manager instance"
			self.showError(_('Cannot retrieve Resource Manager instance'))
			return

		if self.providers[self.currentAction]["streamtype"] == "dvbs":
			print>>log, "[AutoBouquetsMaker] Search NIM for orbital position %d" % transponder["orbital_position"]
		else:
			print>>log, "[AutoBouquetsMaker] Search NIM"

		current_slotid = -1
		if self.rawchannel:
			del(self.rawchannel)

		self.frontend = None
		self.rawchannel = None

		nimList.reverse() # start from the last
		for slotid in nimList:
			if self.providers[self.currentAction]["streamtype"] == "dvbs":
				sats = nimmanager.getSatListForNim(slotid)
				for sat in sats:
					if sat[0] == transponder["orbital_position"]:
						if current_slotid == -1:	# mark the first valid slotid in case of no other one is free
							current_slotid = slotid

						self.rawchannel = resmanager.allocateRawChannel(slotid)
						if self.rawchannel:
							print>>log, "[AutoBouquetsMaker] Nim found on slot id %d with sat %s" % (slotid, sat[1])
							current_slotid = slotid
							break
			else:
				if current_slotid == -1:	# mark the first valid slotid in case of no other one is free
					current_slotid = slotid
				self.rawchannel = resmanager.allocateRawChannel(slotid)
				if self.rawchannel:
 					print>>log, "[AutoBouquetsMaker] Nim found on slot id %d" % (slotid)
					current_slotid = slotid
					break


			if self.rawchannel:
				break

		if current_slotid == -1:
			print>>log, "[AutoBouquetsMaker] No valid NIM found"
			self.showError(_('No valid NIM found'))
			return

		if not self.rawchannel:
			print>>log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stop current service" % current_slotid
			if self.session.nav.RecordTimer.isRecording():
				print>>log, "[AutoBouquetsMaker] Cannot free NIM because a record is in progress"
				self.showError(_('Cannot free NIM because a record is in progress'))
				return

			self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference()
			self.session.nav.stopService()
			if self.session.pipshown:
				self.session.pipshown = False

			self.rawchannel = resmanager.allocateRawChannel(current_slotid)
			if not self.rawchannel:
				print>>log, "[AutoBouquetsMaker] Cannot get the NIM"
				self.showError(_('Cannot get the NIM'))
				return

		self.frontend = self.rawchannel.getFrontend()
		if not self.frontend:
			print>>log, "[AutoBouquetsMaker] Cannot get frontend"
			self.showError(_('Cannot get frontend'))
			return

		demuxer_id = self.rawchannel.reserveDemux()
		if demuxer_id < 0:
			print>>log, "[AutoBouquetsMaker] Cannot allocate the demuxer"
			self.showError(_('Cannot allocate the demuxer'))
			return

		if self.providers[self.currentAction]["streamtype"] == "dvbs":
			params = eDVBFrontendParametersSatellite()
			params.frequency = transponder["frequency"]
			params.symbol_rate = transponder["symbol_rate"]
			params.polarisation = transponder["polarization"]
			params.fec = transponder["fec_inner"]
			params.inversion = transponder["inversion"]
			params.orbital_position = transponder["orbital_position"]
			params.system = transponder["system"]
			params.modulation = transponder["modulation"]
			params.rolloff = transponder["roll_off"]
			params.pilot = transponder["pilot"]
			params_fe = eDVBFrontendParameters()
			params_fe.setDVBS(params, False)

		elif self.providers[self.currentAction]["streamtype"] == "dvbt":
			params = eDVBFrontendParametersTerrestrial()
			params.frequency = transponder["frequency"]
			params.bandwidth = transponder["bandwidth"]
			params.code_rate_hp = transponder["code_rate_hp"]
			params.code_rate_lp = transponder["code_rate_lp"]
			params.inversion = transponder["inversion"]
			params.system = transponder["system"]
			params.modulation = transponder["modulation"]
			params.transmission_mode = transponder["transmission_mode"]
			params.guard_interval = transponder["guard_interval"]
			params.hierarchy = transponder["hierarchy"]
			params_fe = eDVBFrontendParameters()
			params_fe.setDVBT(params)

		elif self.providers[self.currentAction]["streamtype"] == "dvbc":
			params = eDVBFrontendParametersCable()
			params.frequency = transponder["frequency"]
			params.symbol_rate = transponder["symbol_rate"]
			params.fec_inner = transponder["fec_inner"]
			params.inversion = transponder["inversion"]
			params.modulation = transponder["modulation"]
			params_fe = eDVBFrontendParameters()
			params_fe.setDVBC(params)

		self.rawchannel.requestTsidOnid()
		self.frontend.tune(params_fe)
		self.manager.setAdapter(0)	# FIX: use the correct device
		self.manager.setDemuxer(demuxer_id)
		self.manager.setFrontend(current_slotid)

		self.lockcounter = 0
		self.locktimer = eTimer()
		self.locktimer.callback.append(self.checkTunerLock)
		self.locktimer.start(100, 1)
コード例 #51
0
ファイル: main.py プロジェクト: jall19/oe-alliance-plugins
    def doTune(self):
        from Screens.Standby import inStandby
        transponder = self.providers[self.currentAction]["transponder"]
        nimList = nimmanager.getNimListOfType("DVB-S")
        if len(nimList) == 0:
            print >> log, "[AutoBouquetsMaker] No DVB-S NIMs founds"
            self.showError(_('No DVB-S NIMs founds'))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print >> log, "[AutoBouquetsMaker] Cannot retrieve Resource Manager instance"
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        print >> log, "[AutoBouquetsMaker] Search NIM for orbital position %d" % transponder[
            "orbital_position"]
        current_slotid = -1
        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList.reverse()  # start from the last
        for slotid in nimList:
            sats = nimmanager.getSatListForNim(slotid)
            for sat in sats:
                if sat[0] == transponder["orbital_position"]:
                    if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                        current_slotid = slotid

                    self.rawchannel = resmanager.allocateRawChannel(slotid)
                    if self.rawchannel:
                        print >> log, "[AutoBouquetsMaker] Nim found on slot id %d with sat %s" % (
                            slotid, sat[1])
                        current_slotid = slotid
                        break

            if self.rawchannel:
                break

        if current_slotid == -1:
            print >> log, "[AutoBouquetsMaker] No valid NIM found"
            self.showError(_('No valid NIM found'))
            return

        if not self.rawchannel:
            print >> log, "[AutoBouquetsMaker] Nim found on slot id %d but it's busy. Stop current service" % current_slotid
            if self.session.nav.RecordTimer.isRecording():
                print >> log, "[AutoBouquetsMaker] Cannot free NIM because a record is in progress"
                self.showError(
                    _('Cannot free NIM because a record is in progress'))
                return

            self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
            )
            self.session.nav.stopService()
            if self.session.pipshown:
                self.session.pipshown = False

            self.rawchannel = resmanager.allocateRawChannel(current_slotid)
            if not self.rawchannel:
                print >> log, "[AutoBouquetsMaker] Cannot get the NIM"
                self.showError(_('Cannot get the NIM'))
                return

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print >> log, "[AutoBouquetsMaker] Cannot get frontend"
            self.showError(_('Cannot get frontend'))
            return

        demuxer_id = self.rawchannel.reserveDemux()
        if demuxer_id < 0:
            print >> log, "[AutoBouquetsMaker] Cannot allocate the demuxer"
            self.showError(_('Cannot allocate the demuxer'))
            return

        params = eDVBFrontendParametersSatellite()
        params.frequency = transponder["frequency"]
        params.symbol_rate = transponder["symbol_rate"]
        params.polarisation = transponder["polarization"]
        params.fec = transponder["fec_inner"]
        params.inversion = transponder["inversion"]
        params.orbital_position = transponder["orbital_position"]
        params.system = transponder["system"]
        params.modulation = transponder["modulation"]
        params.rolloff = transponder["roll_off"]
        params.pilot = transponder["pilot"]
        params_fe = eDVBFrontendParameters()
        params_fe.setDVBS(params, False)
        self.rawchannel.requestTsidOnid()
        self.frontend.tune(params_fe)
        self.manager.setAdapter(0)  # FIX: use the correct device
        self.manager.setDemuxer(demuxer_id)
        self.manager.setFrontend(current_slotid)

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)
コード例 #52
0
ファイル: SystemInfo.py プロジェクト: 4doemaster/enigma2
from enigma import eDVBResourceManager
from Tools.Directories import fileExists
from Tools.HardwareInfo import HardwareInfo

SystemInfo = { }

#FIXMEE...
def getNumVideoDecoders():
	idx = 0
	while fileExists("/dev/dvb/adapter0/video%d"%(idx), 'f'):
		idx += 1
	return idx

SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance().canMeasureFrontendInputPower()


def countFrontpanelLEDs():
	leds = 0
	if fileExists("/proc/stb/fp/led_set_pattern"):
		leds += 1

	while fileExists("/proc/stb/fp/led%d_pattern" % leds):
		leds += 1

	return leds

SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
# iq [
#SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
SystemInfo["FrontpanelDisplay"] = HardwareInfo().has_micom()
コード例 #53
0
    def getFrontend(self):
        print "[ABM-FrequencyFinder][getFrontend] searching for available tuner"
        nimList = []
        if self.selectedNIM < 0:  # automatic tuner selection
            for nim in nimmanager.nim_slots:
                if self.config_mode(nim) not in (
                        "nothing", ) and (nim.isCompatible("DVB-T2") or
                                          (nim.isCompatible("DVB-S")
                                           and nim.canBeCompatible("DVB-T2"))):
                    nimList.append(nim.slot)
                    self.isT2tuner = True
            if len(nimList) == 0:
                print "[ABM-FrequencyFinder][getFrontend] No T2 tuner found"
                for nim in nimmanager.nim_slots:
                    if self.config_mode(nim) not in ("nothing", ) and (
                            nim.isCompatible("DVB-T") or
                        (nim.isCompatible("DVB-S")
                         and nim.canBeCompatible("DVB-T"))):
                        nimList.append(nim.slot)
            if len(nimList) == 0:
                print "[ABM-FrequencyFinder][getFrontend] No terrestrial tuner found."
                self.showError(_('No terrestrial tuner found.'))
                return
        else:  # manual tuner selection, and subsequent iterations
            nim = nimmanager.nim_slots[self.selectedNIM]
            if self.config_mode(nim) not in ("nothing", ) and (
                    nim.isCompatible("DVB-T2") or
                (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T2"))):
                nimList.append(nim.slot)
                self.isT2tuner = True
            if len(nimList) == 0:
                print "[ABM-FrequencyFinder][getFrontend] User selected tuner is not T2 compatible"
                if self.config_mode(nim) not in (
                        "nothing", ) and (nim.isCompatible("DVB-T") or
                                          (nim.isCompatible("DVB-S")
                                           and nim.canBeCompatible("DVB-T"))):
                    nimList.append(nim.slot)
            if len(nimList) == 0:
                print "[ABM-FrequencyFinder][getFrontend] User selected tuner not configured"
                self.showError(_('Selected tuner is not configured.'))
                return

        if len(nimList) == 0:
            print "[ABM-FrequencyFinder][getFrontend] No terrestrial tuner found."
            self.showError(_('No terrestrial tuner found.'))
            return

        resmanager = eDVBResourceManager.getInstance()
        if not resmanager:
            print "[ABM-FrequencyFinder][getFrontend] Cannot retrieve Resource Manager instance"
            self.showError(_('Cannot retrieve Resource Manager instance'))
            return

        if self.selectedNIM < 0:  # automatic tuner selection
            print "[ABM-FrequencyFinder][getFrontend] Choosing NIM"

        # stop pip if running
        if self.session.pipshown:
            self.session.pipshown = False
            del self.session.pip
            print "[ABM-FrequencyFinder][getFrontend] Stopping PIP."

        # Find currently playing NIM
        currentlyPlayingNIM = None
        currentService = self.session and self.session.nav.getCurrentService()
        frontendInfo = currentService and currentService.frontendInfo()
        frontendData = frontendInfo and frontendInfo.getAll(True)
        if frontendData is not None:
            currentlyPlayingNIM = frontendData.get("tuner_number", None)
        del frontendInfo
        del currentService

        current_slotid = -1
        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        nimList.reverse()  # start from the last
        for slotid in nimList:
            if current_slotid == -1:  # mark the first valid slotid in case of no other one is free
                current_slotid = slotid
            self.rawchannel = resmanager.allocateRawChannel(slotid)
            if self.rawchannel:
                print "[ABM-FrequencyFinder][getFrontend] Nim found on slot id %d" % (
                    slotid)
                current_slotid = slotid
                break

        if current_slotid == -1:
            print "[ABM-FrequencyFinder][getFrontend] No valid NIM found"
            self.showError(_('No valid NIM found for terrestrial.'))
            return

        if not self.rawchannel:
            # if we are here the only possible option is to close the active service
            if currentlyPlayingNIM in nimList:
                slotid = currentlyPlayingNIM
                print "[ABM-FrequencyFinder][getFrontend] Nim found on slot id %d but it's busy. Stopping active service" % slotid
                self.session.postScanService = self.session.nav.getCurrentlyPlayingServiceReference(
                )
                self.session.nav.stopService()
                self.rawchannel = resmanager.allocateRawChannel(slotid)
                if self.rawchannel:
                    print "[ABM-FrequencyFinder][getFrontend] The active service was stopped, and the NIM is now free to use."
                    current_slotid = slotid

            if not self.rawchannel:
                if self.session.nav.RecordTimer.isRecording():
                    print "[ABM-FrequencyFinder][getFrontend] Cannot free NIM because a recording is in progress"
                    self.showError(
                        _('Cannot free NIM because a recording is in progress')
                    )
                    return
                else:
                    print "[ABM-FrequencyFinder][getFrontend] Cannot get the NIM"
                    self.showError(_('Cannot get the NIM'))
                    return

        print "[ABM-FrequencyFinder][getFrontend] Will wait up to %i seconds for tuner lock." % (
            self.lockTimeout / 10)

        self.selectedNIM = current_slotid  # Remember for next iteration

        self.frontend = self.rawchannel.getFrontend()
        if not self.frontend:
            print "[ABM-FrequencyFinder][getFrontend] Cannot get frontend"
            self.showError(_('Cannot get frontend'))
            return

        self.rawchannel.requestTsidOnid()

        self.tsid = None
        self.onid = None

        self.demuxer_id = self.rawchannel.reserveDemux()
        if self.demuxer_id < 0:
            print >> log, "[ABM-FrequencyFinder][getFrontend] Cannot allocate the demuxer."
            self.showError(_('Cannot allocate the demuxer.'))
            return

        self.frontend.tune(
            setParamsFe(setParams(self.frequency, self.system,
                                  self.bandwidth)))

        self.lockcounter = 0
        self.locktimer = eTimer()
        self.locktimer.callback.append(self.checkTunerLock)
        self.locktimer.start(100, 1)