示例#1
0
	def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
		oldref = self.currentlyPlayingServiceOrGroup
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 1
		print "playing", ref and ref.toString()
		if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '1':
			try:
				if '0:0:0:0:0:0:0:0:0' not in ref.toString():
					signal = 1
				else:
					signal = 0
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write(str(signal))
				f.close()
			except:
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write("0")
				f.close()
		elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '0':
			f = open("/proc/stb/lcd/symbol_signal", "w")
			f.write("0")
			f.close()

		if ref is None:
			self.stopService()
			return 0
		from Components.ServiceEventTracker import InfoBarCount
		InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
			if ref.flags & eServiceReference.isGroup:
				oldref = self.currentlyPlayingServiceReference or eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 1
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
					self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()

				if ref.toString().find('//') == -1 and SystemInfo["isGBIPBOX"]:
					playref = ZAP.gref(ref, self.pnav)

				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				return 0
		elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
			self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
		return 1
示例#2
0
	def playService(self, ref, checkParentalControl = True, forceRestart = False):
		if not self.immediatePlay:
			print "delaying playService request until the ChannelSelection is finally initialized"
			self.scheduledServiceReference = (ref, checkParentalControl, forceRestart)
			return
		oldref = self.currentlyPlayingServiceReference
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		print "playing", ref and ref.toString()
		if ref is None:
			self.stopService()
			return 0
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)):
			if ref.flags & eServiceReference.isGroup:
				if not oldref:
					oldref = eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav and not self.pnav.playService(playref):
				self.currentlyPlayingServiceReference = self.pnav.getCurrentServiceReference();
				return 0
		else:
			self.stopService()
		return 1
示例#3
0
	def playService(self, ref, checkParentalControl = True, forceRestart = False):
		if not self.immediatePlay:
			print "delaying playService request until the ChannelSelection is finally initialized"
			self.scheduledServiceReference = (ref, checkParentalControl, forceRestart)
			return
		oldref = self.currentlyPlayingServiceReference
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		print "playing", ref and ref.toString()
		if ref is None:
			self.stopService()
			return 0
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)):
			if ref.flags & eServiceReference.isGroup:
				if not oldref:
					oldref = eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav and not self.pnav.playService(playref):
				self.currentlyPlayingServiceReference = playref
				return 0
		else:
			self.stopService()
		return 1
示例#4
0
	def playService(self, ref, checkParentalControl = True, forceRestart = False):
		oldref = self.currentlyPlayingServiceReference
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		#print "playing", ref and ref.toString()
		print "playing service.."
		if ref is None:
			self.stopService()
			return 0
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)):
			if ref.flags & eServiceReference.isGroup:
				if not oldref:
					oldref = eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav and not self.pnav.playService(playref):
				self.currentlyPlayingServiceReference = playref
				return 0
		else:
			self.stopService()
		return 1
示例#5
0
	def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
		oldref = self.currentlyPlayingServiceOrGroup
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		print "playing", ref and ref.toString()
		if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '1':
			try:
				if '0:0:0:0:0:0:0:0:0' not in ref.toString():
					signal = 1
				else:
					signal = 0
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write(str(signal))
				f.close()
			except:
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write("0")
				f.close()
		elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '0':
			f = open("/proc/stb/lcd/symbol_signal", "w")
			f.write("0")
			f.close()

		if ref is None:
			self.stopService()
			return 0
		from Components.ServiceEventTracker import InfoBarCount
		InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
			if ref.flags & eServiceReference.isGroup:
				oldref = self.currentlyPlayingServiceReference or eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
					self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()

				if ref.toString().find('/') == -1 and SystemInfo["isGBIPBOX"]:
					playref = ZAP.gref(ref, self.pnav)

				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				return 0
		elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
			self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
		return 1
示例#6
0
    def playService(self, ref, checkParentalControl=True, forceRestart=False):
        oldref = self.currentlyPlayingServiceReference
        if ref and oldref and ref == oldref and not forceRestart:
            print "ignore request to play already running service(1)"
            return 0
        print "playing", ref and ref.toString()
        if path.exists("/proc/stb/lcd/symbol_signal"
                       ) and config.lcd.mode.getValue() == '1':
            try:
                if ref.toString().find('0:0:0:0:0:0:0:0:0') == -1:
                    signal = 1
                else:
                    signal = 0
                open("/proc/stb/lcd/symbol_signal", "w").write(str(signal))
            except:
                open("/proc/stb/lcd/symbol_signal", "w").write("0")
        elif path.exists("/proc/stb/lcd/symbol_signal"
                         ) and config.lcd.mode.getValue() == '0':
            open("/proc/stb/lcd/symbol_signal", "w").write("0")

        if ref is None:
            self.stopService()
            return 0
        if not checkParentalControl or parentalControl.isServicePlayable(
                ref, boundFunction(self.playService,
                                   checkParentalControl=False)):
            if ref.flags & eServiceReference.isGroup:
                if not oldref:
                    oldref = eServiceReference()
                playref = getBestPlayableServiceReference(ref, oldref)
                print "playref", playref
                if playref and oldref and playref == oldref and not forceRestart:
                    print "ignore request to play already running service(2)"
                    return 0
                if not playref or (
                        checkParentalControl
                        and not parentalControl.isServicePlayable(
                            playref,
                            boundFunction(self.playService,
                                          checkParentalControl=False))):
                    self.stopService()
                    return 0
            else:
                playref = ref
            if self.pnav:
                self.pnav.stopService()
                self.currentlyPlayingServiceReference = playref
                self.currentlyPlayingSelectedServiceReference = ref
                InfoBarInstance = InfoBar.instance
                if InfoBarInstance is not None:
                    InfoBarInstance.servicelist.servicelist.setCurrent(ref)
                if self.pnav.playService(playref):
                    print "Failed to start", playref
                    self.currentlyPlayingServiceReference = None
                return 0
        else:
            self.stopService()
        return 1
示例#7
0
    def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
        oldref = self.currentlyPlayingServiceOrGroup
        if ref and oldref and ref == oldref and not forceRestart:
            print "ignore request to play already running service(1)"
            return 1
        print "playing", ref and ref.toString()
        if ref is None:
            self.stopService()
            return 0
        from Components.ServiceEventTracker import InfoBarCount

        InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
        if not checkParentalControl or parentalControl.isServicePlayable(
            ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)
        ):
            if ref.flags & eServiceReference.isGroup:
                oldref = self.currentlyPlayingServiceReference or eServiceReference()
                playref = getBestPlayableServiceReference(ref, oldref)
                print "playref", playref
                if playref and oldref and playref == oldref and not forceRestart:
                    print "ignore request to play already running service(2)"
                    return 1
                if not playref:
                    alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
                    self.stopService()
                    if alternativeref and self.pnav and self.pnav.playService(alternativeref):
                        print "Failed to start", alternativeref
                    return 0
                elif checkParentalControl and not parentalControl.isServicePlayable(
                    playref, boundFunction(self.playService, checkParentalControl=False)
                ):
                    if (
                        self.currentlyPlayingServiceOrGroup
                        and InfoBarInstance
                        and InfoBarInstance.servicelist.servicelist.setCurrent(
                            self.currentlyPlayingServiceOrGroup, adjust
                        )
                    ):
                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                    return 1
            else:
                playref = ref
            if self.pnav:
                self.pnav.stopService()
                self.currentlyPlayingServiceReference = playref
                self.currentlyPlayingServiceOrGroup = ref
                if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
                    self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()

                if self.pnav.playService(playref):
                    print "Failed to start", playref
                    self.currentlyPlayingServiceReference = None
                    self.currentlyPlayingServiceOrGroup = None
                return 0
        elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
            self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
        return 1
示例#8
0
 def playService(self,
                 ref,
                 checkParentalControl=True,
                 forceRestart=False,
                 adjust=True):
     oldref = self.currentlyPlayingServiceOrGroup
     if ref and oldref and ref == oldref and not forceRestart:
         print "ignore request to play already running service(1)"
         return 0
     print "playing", ref and ref.toString()
     if ref is None:
         self.stopService()
         return 0
     from Components.ServiceEventTracker import InfoBarCount
     InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
     if not checkParentalControl or parentalControl.isServicePlayable(
             ref,
             boundFunction(self.playService,
                           checkParentalControl=False,
                           forceRestart=forceRestart,
                           adjust=adjust)):
         if ref.flags & eServiceReference.isGroup:
             oldref = self.currentlyPlayingServiceReference or eServiceReference(
             )
             playref = getBestPlayableServiceReference(ref, oldref)
             print "playref", playref
             if playref and oldref and playref == oldref and not forceRestart:
                 print "ignore request to play already running service(2)"
                 return 0
             if not playref or (
                     checkParentalControl
                     and not parentalControl.isServicePlayable(
                         playref,
                         boundFunction(self.playService,
                                       checkParentalControl=False))):
                 self.stopService()
                 return 0
         else:
             playref = ref
         if self.pnav:
             self.pnav.stopService()
             self.currentlyPlayingServiceReference = playref
             self.currentlyPlayingServiceOrGroup = ref
             if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                     ref, adjust):
                 self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                 )
             if self.pnav.playService(playref):
                 print "Failed to start", playref
                 self.currentlyPlayingServiceReference = None
                 self.currentlyPlayingServiceOrGroup = None
             return 0
     elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
             oldref, adjust):
         self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
         )
     return 1
示例#9
0
	def playService(self, ref, checkParentalControl = True, forceRestart = False):
		oldref = self.currentlyPlayingServiceReference
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		print "playing", ref and ref.toString()
		if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.getValue() == '1':
			try:
				if ref.toString().find('0:0:0:0:0:0:0:0:0') == -1:
					signal = 1
				else:
					signal = 0
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write(str(signal))
				f.close()
			except:
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write("0")
				f.close()
		elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.getValue() == '0':
			f = open("/proc/stb/lcd/symbol_signal", "w")
			f.write("0")
			f.close()

		if ref is None:
			self.stopService()
			return 0
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)):
			if ref.flags & eServiceReference.isGroup:
				if not oldref:
					oldref = eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				InfoBarInstance = InfoBar.instance
				if InfoBarInstance is not None:
					InfoBarInstance.servicelist.servicelist.setCurrent(ref)
				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				return 0
		else:
			self.stopService()
		return 1
示例#10
0
	def restartLastMovie(self):
		service = enigma.eServiceReference(config.usage.last_movie_played.value)
		if service:
			if os.path.exists(service.getPath()):
				from Components.ParentalControl import parentalControl
				if parentalControl.isServicePlayable(service, self.openMoviePlayer):
					self.openMoviePlayer(service)
示例#11
0
def zapToNumber(self,
                number,
                bouquet,
                startBouquet,
                checkParentalControl=True,
                ref=None):
    #not all images support recording type indicators
    if hasattr(pNavigation, 'isFromSpecialJumpFastZap'):
        try:
            for rec in NavigationInstance.instance.getRecordings(
                    False, pNavigation.isFromSpecialJumpFastZap):
                NavigationInstance.instance.stopRecordService(rec)
        except:
            pass
    if checkParentalControl:
        service, bouquet = getServiceFromNumber(
            self, number, config.plugins.NumberZapExt.acount.value, bouquet,
            startBouquet)
    else:
        service = ref
    if not service is None:
        if not checkParentalControl or parentalControl.isServicePlayable(
                service,
                boundFunction(zapToNumber,
                              self,
                              number,
                              bouquet,
                              startBouquet,
                              checkParentalControl=False)):
            try:
                if CheckTimeshift is not None and TimeshiftEnabled and config.usage.check_timeshift.value and not self.servicelist.dopipzap:
                    oldref = self.session.nav.getCurrentlyPlayingServiceReference(
                    )
                    if oldref and oldref != service:
                        ref = service
                        self.checkTimeshiftRunning(
                            boundFunction(self.numberZapCheckTimeshiftCallback,
                                          number, bouquet, startBouquet,
                                          checkParentalControl, ref))
                        return
            except:
                pass
            if self.servicelist.getRoot() != bouquet:
                self.servicelist.clearPath()
                if self.servicelist.bouquet_root != bouquet:
                    self.servicelist.enterPath(self.servicelist.bouquet_root)
                self.servicelist.enterPath(bouquet)
            self.servicelist.setCurrentSelection(service)
            try:
                if not self.servicelist.dopipzap:
                    self.session.nav.playService(service,
                                                 checkParentalControl=False,
                                                 adjust=False)
                self.servicelist.zap(enable_pipzap=True,
                                     checkParentalControl=False)
                self.servicelist.correctChannelNumber()
                self.servicelist.startRoot = None
            except:
                self.servicelist.zap()
示例#12
0
 def playService(self, ref, checkParentalControl=True, forceRestart=False):
     oldref = self.currentlyPlayingServiceReference
     if ref and oldref and ref == oldref and not forceRestart:
         print "ignore request to play already running service(1)"
         return 0
     print "playing", ref and ref.toString()
     if ref is None:
         self.stopService()
         return 0
     if not checkParentalControl or parentalControl.isServicePlayable(
             ref, boundFunction(self.playService,
                                checkParentalControl=False)):
         if ref.flags & eServiceReference.isGroup:
             if not oldref:
                 oldref = eServiceReference()
             playref = getBestPlayableServiceReference(ref, oldref)
             print "playref", playref
             if playref and oldref and playref == oldref and not forceRestart:
                 print "ignore request to play already running service(2)"
                 return 0
             if not playref or (
                     checkParentalControl
                     and not parentalControl.isServicePlayable(
                         playref,
                         boundFunction(self.playService,
                                       checkParentalControl=False))):
                 self.stopService()
                 return 0
         else:
             playref = ref
         if self.pnav:
             self.pnav.stopService()
             self.currentlyPlayingServiceReference = playref
             self.currentlyPlayingSelectedServiceReference = ref
             InfoBarInstance = InfoBar.instance
             if InfoBarInstance is not None:
                 InfoBarInstance.servicelist.servicelist.setCurrent(ref)
             if self.pnav.playService(playref):
                 print "Failed to start", playref
                 self.currentlyPlayingServiceReference = None
             return 0
     else:
         self.stopService()
     return 1
示例#13
0
	def playService(self, ref, checkParentalControl = True, forceRestart = False):
		oldref = self.currentlyPlayingServiceReference
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		if config.ParentalControl.moviepinactive.value and ref:
			path = ref.getPath()
			if path is not None and isinstance(path, str):
				path = os_path.split(path)[0]
				path = os_path.realpath(path)
				path = os_path.abspath(path)
				if not path.endswith('/'):
					path = path + '/'
				protect = config.movielist.moviedirs_config.getConfigValue(path, "protect")
				if not parentalControlFolder.configInitialized:
					parentalControlFolder.getConfigValues()
				if protect == 1 and not parentalControlFolder.sessionPinCached:
					print "ignore request to play already due to parental control"
					self.stopService()
					return 1
		print "playing service.."
		if ref is None:
			self.stopService()
			return 0
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)):
			if ref.flags & eServiceReference.isGroup:
				if not oldref:
					oldref = eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav and not self.pnav.playService(playref):
				self.currentlyPlayingServiceReference = playref
				return 0
		else:
			self.stopService()
		return 1
示例#14
0
	def movieSelected(self, service):
		ref = self.lastservice
		del self.lastservice
		if service is None:
			if ref and not self.session.nav.getCurrentlyPlayingServiceOrGroup():
				self.session.nav.playService(ref)
		else:
			from Components.ParentalControl import parentalControl
			if parentalControl.isServicePlayable(service, self.openMoviePlayer):
				self.openMoviePlayer(service)
示例#15
0
	def movieSelected(self, service):
		ref = self.lastservice
		del self.lastservice
		if service is None:
			if ref and not self.session.nav.getCurrentlyPlayingServiceOrGroup():
				self.session.nav.playService(ref)
		else:
			from Components.ParentalControl import parentalControl
			if parentalControl.isServicePlayable(service, self.openMoviePlayer):
				self.openMoviePlayer(service)
示例#16
0
	def playService(self, ref, checkParentalControl = True, forceRestart = False):
		oldref = self.currentlyPlayingServiceReference
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 0
		print "playing", ref and ref.toString()
		if ref is None:
			self.stopService()
			return 0
		InfoBarInstance = InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl = False)):
			if ref.flags & eServiceReference.isGroup:
				if not oldref:
					oldref = eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 0
				if not playref or (checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False))):
					self.stopService()
					return 0
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance is not None:
					InfoBarInstance.servicelist.servicelist.setCurrent(ref)
				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				return 0
		elif oldref:
			InfoBarInstance.servicelist.servicelist.setCurrent(oldref)
		return 1
示例#17
0
 def movieSelected(self, service):
     if isinstance(service, str):
         new_screen = service
         service = None
     else:
         new_screen = None
     ref = self.lastservice
     del self.lastservice
     if service is None:
         if ref and not self.session.nav.getCurrentlyPlayingServiceOrGroup(
         ):
             self.session.nav.playService(ref)
         if new_screen == "timer":
             self.openTimerList()
         elif new_screen == "epg":
             self.showDefaultEPG()
     else:
         from Components.ParentalControl import parentalControl
         if parentalControl.isServicePlayable(service,
                                              self.openMoviePlayer):
             self.openMoviePlayer(service, ref)
示例#18
0
def zapToNumber(self, number, bouquet, startBouquet, checkParentalControl=True, ref=None):
	import NavigationInstance
	from enigma import pNavigation
	try:
		#not all images support recording type indicators
		for rec in NavigationInstance.instance.getRecordings(False,pNavigation.isFromSpecialJumpFastZap):
			NavigationInstance.instance.stopRecordService(rec)
	except:
		pass
	if checkParentalControl:
		service, bouquet = getServiceFromNumber(self, number, config.plugins.NumberZapExt.acount.value, bouquet, startBouquet)
	else:
		service = ref
	if not service is None:
		if not checkParentalControl or parentalControl.isServicePlayable(service, boundFunction(zapToNumber, self, number, bouquet, startBouquet, checkParentalControl=False)):
			try:
				if CheckTimeshift is not None and TimeshiftEnabled and config.usage.check_timeshift.value and not self.servicelist.dopipzap:
					oldref = self.session.nav.getCurrentlyPlayingServiceReference()
					if oldref and oldref != service:
						ref = service
						self.checkTimeshiftRunning(boundFunction(self.numberZapCheckTimeshiftCallback, number, bouquet, startBouquet, checkParentalControl, ref))
						return
			except:
				pass
			if self.servicelist.getRoot() != bouquet:
				self.servicelist.clearPath()
				if self.servicelist.bouquet_root != bouquet:
					self.servicelist.enterPath(self.servicelist.bouquet_root)
				self.servicelist.enterPath(bouquet)
			self.servicelist.setCurrentSelection(service)
			try:
				if not self.servicelist.dopipzap:
					self.session.nav.playService(service, checkParentalControl=False)
				self.servicelist.zap(enable_pipzap=True, checkParentalControl=False)
				self.servicelist.correctChannelNumber()
				self.servicelist.startRoot = None
			except:
				self.servicelist.zap()
示例#19
0
	def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
		oldref = self.currentlyPlayingServiceOrGroup
		if ref and oldref and ref == oldref and not forceRestart:
			print("[Navigation] ignore request to play already running service(1)")
			return 1
		print("[Navigation] playing", ref and ref.toString())
		if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '1':
			try:
				if '0:0:0:0:0:0:0:0:0' not in ref.toString():
					signal = 1
				else:
					signal = 0
				open("/proc/stb/lcd/symbol_signal", "w").write(str(signal))
			except:
				open("/proc/stb/lcd/symbol_signal", "w").write("0")
		elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '0':
			open("/proc/stb/lcd/symbol_signal", "w").write("0")
		if ref is None:
			self.stopService()
			return 0
		from Components.ServiceEventTracker import InfoBarCount
		InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
			if ref.flags & eServiceReference.isGroup:
				oldref = self.currentlyPlayingServiceReference or eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				if playref and config.misc.use_ci_assignment.value and not isPlayableForCur(playref):
					alternative_ci_ref = ResolveCiAlternative(ref, playref)
					if alternative_ci_ref:
						playref = alternative_ci_ref
				print("[Navigation] alternative ref: ", playref and playref.toString())
				if playref and oldref and playref == oldref and not forceRestart:
					print("[Navigation] ignore request to play already running service(2)")
					return 1
				if not playref:
					alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
					self.stopService()
					if alternativeref and self.pnav:
						self.currentlyPlayingServiceReference = alternativeref
						self.currentlyPlayingServiceOrGroup = ref
						if self.pnav.playService(alternativeref):
							print("[Navigation] Failed to start: ", alternativeref.toString())
							self.currentlyPlayingServiceReference = None
							self.currentlyPlayingServiceOrGroup = None
					return 0
				elif checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False)):
					if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(self.currentlyPlayingServiceOrGroup, adjust):
						self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
					return 1
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
					self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
				setPriorityFrontend = False
				if SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo["DVB-C_priority_tuner_available"] or SystemInfo["DVB-S_priority_tuner_available"] or SystemInfo["ATSC_priority_tuner_available"]:
					str_service = playref.toString()
					if '%3a//' not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
						type_service = playref.getUnsignedData(4) >> 16
						if type_service == 0xEEEE:
							if SystemInfo["DVB-T_priority_tuner_available"] and config.usage.frontend_priority_dvbt.value != "-2":
								if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_dvbt.value))
									setPriorityFrontend = True
							if SystemInfo["ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
								if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_atsc.value))
									setPriorityFrontend = True
						elif type_service == 0xFFFF:
							if SystemInfo["DVB-C_priority_tuner_available"] and config.usage.frontend_priority_dvbc.value != "-2":
								if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_dvbc.value))
									setPriorityFrontend = True
							if SystemInfo["ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
								if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_atsc.value))
									setPriorityFrontend = True
						else:
							if SystemInfo["DVB-S_priority_tuner_available"] and config.usage.frontend_priority_dvbs.value != "-2":
								if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_dvbs.value))
									setPriorityFrontend = True
				if self.pnav.playService(playref):
					print("[Navigation] Failed to start: ", playref.toString())
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				if setPriorityFrontend:
					setPreferredTuner(int(config.usage.frontend_priority.value))
				return 0
		elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
			self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
		return 1
示例#20
0
    def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
        oldref = self.currentlyPlayingServiceOrGroup
        if ref and oldref and ref == oldref and not forceRestart:
            print "[Navigation] ignore request to play already running service(1)"
            return 1
        print "[Navigation] playing", ref and ref.toString()
        if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == "1":
            try:
                if "0:0:0:0:0:0:0:0:0" not in ref.toString():
                    signal = 1
                else:
                    signal = 0
                f = open("/proc/stb/lcd/symbol_signal", "w")
                f.write(str(signal))
                f.close()
            except:
                f = open("/proc/stb/lcd/symbol_signal", "w")
                f.write("0")
                f.close()
        elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == "0":
            f = open("/proc/stb/lcd/symbol_signal", "w")
            f.write("0")
            f.close()

        if ref is None:
            self.stopService()
            return 0
        from Components.ServiceEventTracker import InfoBarCount

        InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
        if not checkParentalControl or parentalControl.isServicePlayable(
            ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)
        ):
            if ref.flags & eServiceReference.isGroup:
                oldref = self.currentlyPlayingServiceReference or eServiceReference()
                playref = getBestPlayableServiceReference(ref, oldref)
                print "[Navigation] playref", playref
                if playref and oldref and playref == oldref and not forceRestart:
                    print "[Navigation] ignore request to play already running service(2)"
                    return 1
                if not playref:
                    alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
                    self.stopService()
                    if alternativeref and self.pnav and self.pnav.playService(alternativeref):
                        print "[Navigation] Failed to start", alternativeref
                    return 0
                elif checkParentalControl and not parentalControl.isServicePlayable(
                    playref, boundFunction(self.playService, checkParentalControl=False)
                ):
                    if (
                        self.currentlyPlayingServiceOrGroup
                        and InfoBarInstance
                        and InfoBarInstance.servicelist.servicelist.setCurrent(
                            self.currentlyPlayingServiceOrGroup, adjust
                        )
                    ):
                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                    return 1
            else:
                playref = ref
            if self.pnav:
                self.pnav.stopService()
                self.currentlyPlayingServiceReference = playref
                self.currentlyPlayingServiceOrGroup = ref
                if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
                    self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                setPriorityFrontend = False
                if (
                    SystemInfo["DVB-T_priority_tuner_available"]
                    or SystemInfo["DVB-C_priority_tuner_available"]
                    or SystemInfo["DVB-S_priority_tuner_available"]
                ):
                    str_service = playref.toString()
                    if "%3a//" not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
                        type_service = playref.getUnsignedData(4) >> 16
                        if type_service == 0xEEEE:
                            if config.usage.frontend_priority_dvbt.value != "-2":
                                if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
                                    setPreferredTuner(int(config.usage.frontend_priority_dvbt.value))
                                    setPriorityFrontend = True
                        elif type_service == 0xFFFF:
                            if config.usage.frontend_priority_dvbc.value != "-2":
                                if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
                                    setPreferredTuner(int(config.usage.frontend_priority_dvbc.value))
                                    setPriorityFrontend = True
                        else:
                            if config.usage.frontend_priority_dvbs.value != "-2":
                                if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
                                    setPreferredTuner(int(config.usage.frontend_priority_dvbs.value))
                                    setPriorityFrontend = True
                if self.pnav.playService(playref):
                    print "[Navigation] Failed to start", playref
                    self.currentlyPlayingServiceReference = None
                    self.currentlyPlayingServiceOrGroup = None
                if setPriorityFrontend:
                    setPreferredTuner(int(config.usage.frontend_priority.value))
                return 0
        elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
            self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
        return 1
示例#21
0
 def playService(self,
                 ref,
                 checkParentalControl=True,
                 forceRestart=False,
                 adjust=True):
     oldref = self.currentlyPlayingServiceOrGroup
     if ref and oldref and ref == oldref and not forceRestart:
         print "ignore request to play already running service(1)"
         return 1
     print "playing", ref and ref.toString()
     if ref is None:
         self.stopService()
         return 0
     from Components.ServiceEventTracker import InfoBarCount
     InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
     if not checkParentalControl or parentalControl.isServicePlayable(
             ref,
             boundFunction(self.playService,
                           checkParentalControl=False,
                           forceRestart=forceRestart,
                           adjust=adjust)):
         if ref.flags & eServiceReference.isGroup:
             oldref = self.currentlyPlayingServiceReference or eServiceReference(
             )
             playref = getBestPlayableServiceReference(ref, oldref)
             print "playref", playref
             if playref and oldref and playref == oldref and not forceRestart:
                 print "ignore request to play already running service(2)"
                 return 1
             if not playref:
                 alternativeref = getBestPlayableServiceReference(
                     ref, eServiceReference(), True)
                 self.stopService()
                 if alternativeref and self.pnav:
                     self.currentlyPlayingServiceReference = alternativeref
                     self.currentlyPlayingServiceOrGroup = ref
                     if self.pnav.playService(alternativeref):
                         print "Failed to start", alternativeref
                         self.currentlyPlayingServiceReference = None
                         self.currentlyPlayingServiceOrGroup = None
                 return 0
             elif checkParentalControl and not parentalControl.isServicePlayable(
                     playref,
                     boundFunction(self.playService,
                                   checkParentalControl=False)):
                 if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                         self.currentlyPlayingServiceOrGroup, adjust):
                     self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                     )
                 return 1
         else:
             playref = ref
         if self.pnav:
             self.pnav.stopService()
             self.currentlyPlayingServiceReference = playref
             self.currentlyPlayingServiceOrGroup = ref
             if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                     ref, adjust):
                 self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                 )
             setPriorityFrontend = False
             if SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo[
                     "DVB-C_priority_tuner_available"] or SystemInfo[
                         "DVB-S_priority_tuner_available"]:
                 str_service = playref.toString()
                 if '%3a//' not in str_service and not str_service.rsplit(
                         ":", 1)[1].startswith("/"):
                     type_service = playref.getUnsignedData(4) >> 16
                     if type_service == 0xEEEE:
                         if config.usage.frontend_priority_dvbt.value != "-2":
                             if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbt.value))
                                 setPriorityFrontend = True
                     elif type_service == 0xFFFF:
                         if config.usage.frontend_priority_dvbc.value != "-2":
                             if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbc.value))
                                 setPriorityFrontend = True
                     else:
                         if config.usage.frontend_priority_dvbs.value != "-2":
                             if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbs.value))
                                 setPriorityFrontend = True
             if self.pnav.playService(playref):
                 print "Failed to start", playref
                 self.currentlyPlayingServiceReference = None
                 self.currentlyPlayingServiceOrGroup = None
             if setPriorityFrontend:
                 setPreferredTuner(int(
                     config.usage.frontend_priority.value))
             return 0
     elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
             oldref, adjust):
         self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
         )
     return 1
示例#22
0
	def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
		oldref = self.currentlyPlayingServiceOrGroup
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 1
		print "playing", ref and ref.toString()
		if ref is None:
			self.stopService()
			return 0
		from Components.ServiceEventTracker import InfoBarCount
		InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
			if ref.flags & eServiceReference.isGroup:
				oldref = self.currentlyPlayingServiceReference or eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 1
				if not playref:
					alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
					self.stopService()
					if alternativeref and self.pnav:
						self.currentlyPlayingServiceReference = alternativeref
						self.currentlyPlayingServiceOrGroup = ref
						if self.pnav.playService(alternativeref):
							print "Failed to start", alternativeref
							self.currentlyPlayingServiceReference = None
							self.currentlyPlayingServiceOrGroup = None
					return 0
				elif checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False)):
					if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(self.currentlyPlayingServiceOrGroup, adjust):
						self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
					return 1
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
					self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
				setPriorityFrontend = False
				if SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo["DVB-C_priority_tuner_available"] or SystemInfo["DVB-S_priority_tuner_available"] or SystemInfo["ATSC_priority_tuner_available"]:
					str_service = playref.toString()
					if '%3a//' not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
						type_service = playref.getUnsignedData(4) >> 16
						if type_service == 0xEEEE:
							if SystemInfo["DVB-T_priority_tuner_available"] and config.usage.frontend_priority_dvbt.value != "-2":
								if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_dvbt.value))
									setPriorityFrontend = True
							if SystemInfo["ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
								if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_atsc.value))
									setPriorityFrontend = True
						elif type_service == 0xFFFF:
							if SystemInfo["DVB-C_priority_tuner_available"] and config.usage.frontend_priority_dvbc.value != "-2":
								if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_dvbc.value))
									setPriorityFrontend = True
							if SystemInfo["ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
								if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_atsc.value))
									setPriorityFrontend = True
						else:
							if SystemInfo["DVB-S_priority_tuner_available"] and config.usage.frontend_priority_dvbs.value != "-2":
								if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
									setPreferredTuner(int(config.usage.frontend_priority_dvbs.value))
									setPriorityFrontend = True
				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				if setPriorityFrontend:
					setPreferredTuner(int(config.usage.frontend_priority.value))
				return 0
		elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
			self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
		return 1
示例#23
0
    def playService(self,
                    ref,
                    checkParentalControl=True,
                    forceRestart=False,
                    adjust=True):
        oldref = self.currentlyPlayingServiceOrGroup
        if ref and oldref and ref == oldref and not forceRestart:
            print '[Navigation] ignore request to play already running service(1)'
            return 1
        else:
            print '[Navigation] playing', ref and ref.toString()
            if path.exists('/proc/stb/lcd/symbol_signal'
                           ) and config.lcd.mode.value == '1':
                try:
                    if '0:0:0:0:0:0:0:0:0' not in ref.toString():
                        signal = 1
                    else:
                        signal = 0
                    f = open('/proc/stb/lcd/symbol_signal', 'w')
                    f.write(str(signal))
                    f.close()
                except:
                    f = open('/proc/stb/lcd/symbol_signal', 'w')
                    f.write('0')
                    f.close()

            elif path.exists('/proc/stb/lcd/symbol_signal'
                             ) and config.lcd.mode.value == '0':
                f = open('/proc/stb/lcd/symbol_signal', 'w')
                f.write('0')
                f.close()
            if ref is None:
                self.stopService()
                return 0
            from Components.ServiceEventTracker import InfoBarCount
            InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
            if not checkParentalControl or parentalControl.isServicePlayable(
                    ref,
                    boundFunction(self.playService,
                                  checkParentalControl=False,
                                  forceRestart=forceRestart,
                                  adjust=adjust)):
                if ref.flags & eServiceReference.isGroup:
                    oldref = self.currentlyPlayingServiceReference or eServiceReference(
                    )
                    playref = getBestPlayableServiceReference(ref, oldref)
                    print '[Navigation] playref', playref
                    if playref and oldref and playref == oldref and not forceRestart:
                        print '[Navigation] ignore request to play already running service(2)'
                        return 1
                    if not playref:
                        alternativeref = getBestPlayableServiceReference(
                            ref, eServiceReference(), True)
                        self.stopService()
                        if alternativeref and self.pnav and self.pnav.playService(
                                alternativeref):
                            print '[Navigation] Failed to start', alternativeref
                        return 0
                    if checkParentalControl and not parentalControl.isServicePlayable(
                            playref,
                            boundFunction(self.playService,
                                          checkParentalControl=False)):
                        if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                                self.currentlyPlayingServiceOrGroup, adjust):
                            self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                            )
                        return 1
                else:
                    playref = ref
                if self.pnav:
                    self.pnav.stopService()
                    self.currentlyPlayingServiceReference = playref
                    self.currentlyPlayingServiceOrGroup = ref
                    if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                            ref, adjust):
                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                        )
                    if self.pnav.playService(playref):
                        print 'Failed to start', playref
                        self.currentlyPlayingServiceReference = None
                        self.currentlyPlayingServiceOrGroup = None
                    return 0
            elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                    oldref, adjust):
                self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                )
            return 1
示例#24
0
    def playService(self, ref, checkParentalControl = True, forceRestart = False, adjust = True):
        oldref = self.currentlyPlayingServiceOrGroup
        if ref and oldref and ref == oldref and not forceRestart:
            print 'ignore request to play already running service(1)'
            return 1
        else:
            print 'playing', ref and ref.toString()
            if path.exists('/proc/stb/lcd/symbol_signal') and config.lcd.mode.value == '1':
                try:
                    if '0:0:0:0:0:0:0:0:0' not in ref.toString():
                        signal = 1
                    else:
                        signal = 0
                    f = open('/proc/stb/lcd/symbol_signal', 'w')
                    f.write(str(signal))
                    f.close()
                except:
                    f = open('/proc/stb/lcd/symbol_signal', 'w')
                    f.write('0')
                    f.close()

            elif path.exists('/proc/stb/lcd/symbol_signal') and config.lcd.mode.value == '0':
                f = open('/proc/stb/lcd/symbol_signal', 'w')
                f.write('0')
                f.close()
            if path.exists('/proc/stb/lcd/symbol_scrambled') and config.lcd.mode.getValue() == '1':
                try:
                    if ref.toString().find('0:0:0:0:0:0:0:0:0') == -1:
                        signal = 1
                    else:
                        signal = 0
                    f = open('/proc/stb/lcd/symbol_scrambled', 'w')
                    f.write(str(signal))
                    f.close()
                except:
                    f = open('/proc/stb/lcd/symbol_scrambled', 'w')
                    f.write('0')
                    f.close()

            elif path.exists('/proc/stb/lcd/symbol_scrambled') and config.lcd.mode.getValue() == '0':
                f = open('/proc/stb/lcd/symbol_scrambled', 'w')
                f.write('0')
                f.close()
            if path.exists('/proc/stb/lcd/symbol_mp3') and config.lcd.mode.getValue() == '1':
                try:
                    if ref.toString().endswith('.mp3'):
                        mp3 = 1
                    else:
                        mp3l = 0
                    f = open('/proc/stb/lcd/symbol_mp3', 'w')
                    f.write(str(mp3))
                    f.close()
                except:
                    f = open('/proc/stb/lcd/symbol_mp3', 'w')
                    f.write('0')
                    f.close()

            elif path.exists('/proc/stb/lcd/symbol_mp3') and config.lcd.mode.getValue() == '0':
                f = open('/proc/stb/lcd/symbol_mp3', 'w')
                f.write('0')
                f.close()
            if ref is None:
                self.stopService()
                return 0
            from Components.ServiceEventTracker import InfoBarCount
            InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
            if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
                if ref.flags & eServiceReference.isGroup:
                    oldref = self.currentlyPlayingServiceReference or eServiceReference()
                    playref = getBestPlayableServiceReference(ref, oldref)
                    print 'playref', playref
                    if playref and oldref and playref == oldref and not forceRestart:
                        print 'ignore request to play already running service(2)'
                        return 1
                    if not playref:
                        alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
                        self.stopService()
                        if alternativeref and self.pnav and self.pnav.playService(alternativeref):
                            print 'Failed to start', alternativeref
                        return 0
                    if checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl=False)):
                        if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(self.currentlyPlayingServiceOrGroup, adjust):
                            self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                        return 1
                else:
                    playref = ref
                if self.pnav:
                    self.pnav.stopService()
                    self.currentlyPlayingServiceReference = playref
                    self.currentlyPlayingServiceOrGroup = ref
                    if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                    if self.pnav.playService(playref):
                        print 'Failed to start', playref
                        self.currentlyPlayingServiceReference = None
                        self.currentlyPlayingServiceOrGroup = None
                    return 0
            elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
                self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
            return 1
示例#25
0
	def MoviePlayerCallback(self, reply=None):
		if reply:
			self.lastMoviePlayerService = reply
			from Components.ParentalControl import parentalControl
			if parentalControl.isServicePlayable(service, self.openMoviePlayer):
				self.openMoviePlayer(service)
示例#26
0
 def playService(self,
                 ref,
                 checkParentalControl=True,
                 forceRestart=False,
                 adjust=True):
     session = None
     startPlayingServiceOrGroup = None
     count = isinstance(adjust, list) and len(adjust) or 0
     if count > 1 and adjust[0] is 0:
         session = adjust[1]
         if count == 3:
             startPlayingServiceOrGroup = adjust[2]
         adjust = adjust[0]
     oldref = self.currentlyPlayingServiceOrGroup
     if ref and oldref and ref == oldref and not forceRestart:
         print "[Navigation] ignore request to play already running service(1)"
         return 1
     print "[Navigation] playing: ", ref and ref.toString()
     if ref is None:
         self.stopService()
         return 0
     from Components.ServiceEventTracker import InfoBarCount
     InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
     if not checkParentalControl or parentalControl.isServicePlayable(
             ref,
             boundFunction(self.playService,
                           checkParentalControl=False,
                           forceRestart=forceRestart,
                           adjust=(count > 1 and [0, session] or adjust)),
             session=session):
         if ref.flags & eServiceReference.isGroup:
             oldref = self.currentlyPlayingServiceReference or eServiceReference(
             )
             playref = getBestPlayableServiceReference(ref, oldref)
             if playref and config.misc.use_ci_assignment.value and not isPlayableForCur(
                     playref):
                 alternative_ci_ref = ResolveCiAlternative(ref, playref)
                 if alternative_ci_ref:
                     playref = alternative_ci_ref
             print "[Navigation] alternative ref: ", playref and playref.toString(
             )
             if playref and oldref and playref == oldref and not forceRestart:
                 print "[Navigation] ignore request to play already running service(2)"
                 return 1
             if not playref:
                 alternativeref = getBestPlayableServiceReference(
                     ref, eServiceReference(), True)
                 self.stopService()
                 if alternativeref and self.pnav:
                     self.currentlyPlayingServiceReference = alternativeref
                     self.currentlyPlayingServiceOrGroup = ref
                     if self.pnav.playService(alternativeref):
                         print "[Navigation] Failed to start: ", alternativeref.toString(
                         )
                         self.currentlyPlayingServiceReference = None
                         self.currentlyPlayingServiceOrGroup = None
                     else:
                         print "[Navigation] alternative ref as simulate: ", alternativeref.toString(
                         )
                 return 0
             elif checkParentalControl and not parentalControl.isServicePlayable(
                     playref,
                     boundFunction(self.playService,
                                   checkParentalControl=False,
                                   forceRestart=forceRestart,
                                   adjust=(count > 1 and [0, session, ref]
                                           or adjust)),
                     session=session):
                 if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                         self.currentlyPlayingServiceOrGroup, adjust):
                     self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                     )
                 return 1
         else:
             playref = ref
         if self.pnav:
             if SystemInfo["FCCactive"] and not self.pnav.playService(
                     playref):
                 self.currentlyPlayingServiceReference = playref
                 self.currentlyPlayingServiceOrGroup = ref
                 return 0
             self.pnav.stopService()
             self.currentlyPlayingServiceReference = playref
             self.currentlyPlayingServiceOrGroup = ref
             if startPlayingServiceOrGroup and startPlayingServiceOrGroup.flags & eServiceReference.isGroup and not ref.flags & eServiceReference.isGroup:
                 self.currentlyPlayingServiceOrGroup = startPlayingServiceOrGroup
             if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                     ref, adjust):
                 self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                 )
             setPriorityFrontend = False
             if SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo[
                     "DVB-C_priority_tuner_available"] or SystemInfo[
                         "DVB-S_priority_tuner_available"] or SystemInfo[
                             "ATSC_priority_tuner_available"]:
                 str_service = playref.toString()
                 if '%3a//' not in str_service and not str_service.rsplit(
                         ":", 1)[1].startswith("/"):
                     type_service = playref.getUnsignedData(4) >> 16
                     if type_service == 0xEEEE:
                         if SystemInfo[
                                 "DVB-T_priority_tuner_available"] and config.usage.frontend_priority_dvbt.value != "-2":
                             if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbt.value))
                                 setPriorityFrontend = True
                         if SystemInfo[
                                 "ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
                             if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_atsc.value))
                                 setPriorityFrontend = True
                     elif type_service == 0xFFFF:
                         if SystemInfo[
                                 "DVB-C_priority_tuner_available"] and config.usage.frontend_priority_dvbc.value != "-2":
                             if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbc.value))
                                 setPriorityFrontend = True
                         if SystemInfo[
                                 "ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
                             if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_atsc.value))
                                 setPriorityFrontend = True
                     else:
                         if SystemInfo[
                                 "DVB-S_priority_tuner_available"] and config.usage.frontend_priority_dvbs.value != "-2":
                             if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbs.value))
                                 setPriorityFrontend = True
             if self.pnav.playService(playref):
                 print "[Navigation] Failed to start: ", playref.toString()
                 self.currentlyPlayingServiceReference = None
                 self.currentlyPlayingServiceOrGroup = None
             if setPriorityFrontend:
                 setPreferredTuner(int(
                     config.usage.frontend_priority.value))
             return 0
     elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
             oldref, adjust):
         self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
         )
     return 1
示例#27
0
文件: InfoBar.py 项目: openmb/stb-gui
	def MoviePlayerCallback(self, reply=None):
		if reply:
			self.lastMoviePlayerService = reply
			from Components.ParentalControl import parentalControl
			if parentalControl.isServicePlayable(service, self.openMoviePlayer):
				self.openMoviePlayer(service)