def update(self, id, tunerstate):

        #TODO Avolid blocking - avoid using getTimer to update the timer times use timer.time_changed if possible

        timer = getTimer(id)
        if timer:
            tunerstate.name = timer.name

            tunerstate.begin = timer.begin
            tunerstate.end = timer.end
            tunerstate.endless = timer.autoincrease

            irecordservice = timer.record_service
            servicereference = timer.service_ref

            # Delete references to avoid blocking tuners
            del timer

            if not tunerstate.tuner or not tunerstate.tunertype or not tunerstate.tunernumber:
                tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = getTunerByPlayableService(
                    irecordservice)

            if not tunerstate.number:
                tunerstate.number = getNumber(servicereference.ref)
            if not tunerstate.channel:
                tunerstate.channel = getChannel(servicereference.ref)

            return True

        else:
            # This can happen, if the time has been changed or if the timer does not exist anymore

            self.onInit()

            return None
Esempio n. 2
0
	def update(self, id, tunerstate):
		
		#TODO Avolid blocking - avoid using getTimer to update the timer times use timer.time_changed if possible
		
		timer = getTimer( id )
		if timer:
			tunerstate.name = timer.name
			
			tunerstate.begin = timer.begin
			tunerstate.end = timer.end
			
			if hasattr(timer, 'vpsplugin_enabled') and timer.vpsplugin_enabled:
			#and hasattr(timer, 'vpsplugin_overwrite') and timer.vpsplugin_overwrite:
				tunerstate.endless = False
				epgcache = eEPGCache.getInstance()
				
				if timer.eit:
					print "IBTS Records event by lookupEventId"
					event = epgcache.lookupEventId(timer.service_ref.ref, timer.eit)
				
				if not event:
					print "IBTS Records event by lookupEventTime"
					event = epgcache.lookupEventTime( timer.service_ref.ref, timer.begin + 5 );
				
				if event:
					print "IBTS Records event"
					begin = event.getBeginTime() or 0
					duration = event.getDuration() or 0
					tunerstate.end  = begin + duration
					
					if not tunerstate.end:
						print "IBTS Records no end"
						tunerstate.endless = True
				else:
					tunerstate.endless = timer.autoincrease
			else:
				tunerstate.endless = timer.autoincrease
			
			irecordservice = timer.record_service
			servicereference = timer.service_ref
			
			# Delete references to avoid blocking tuners
			del timer
			
			if not tunerstate.tuner or not tunerstate.tunertype or not tunerstate.tunernumber:
				tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = getTunerByPlayableService(irecordservice)
			
			if not tunerstate.number:
				tunerstate.number = getNumber(servicereference.ref)
			if not tunerstate.channel:
				tunerstate.channel = getChannel(servicereference.ref)
			
			return True
		
		else:
			# This can happen, if the time has been changed or if the timer does not exist anymore
			
			self.onInit()
			
			return False
	def update(self, id, tunerstate):
		
		log.debug( "IBTS Timers update ID", id )
		if id in self.nextids:
			
			timer = getTimer( id )
			if timer:
				
				tunerstate.name = timer.name
				
				tunerstate.begin = timer.begin
				tunerstate.end = timer.end
				tunerstate.endless = timer.autoincrease
				
				servicereference = timer.service_ref
				
				del timer
				
				if not tunerstate.number:
					tunerstate.number = getNumber(servicereference.ref)
				if not tunerstate.channel:
					tunerstate.channel = getChannel(servicereference.ref)
				if not tunerstate.reference:
					tunerstate.reference = str(servicereference.ref)
				
				return True
			else:
				log.debug( "IBTS timers update FINISHED no timer", id )
				return None
		else:
			log.debug( "IBTS timers update FINISHED not in ids", id )
			return None
	def update(self, id, tunerstate):
		
		stream = getStream( id )
		if stream:
		
			eservicereference = stream.getRecordServiceRef()
			
			del stream
			
			tunerstate.name = getEventName(eservicereference)
			
			if not tunerstate.number:
				tunerstate.number = getNumber(eservicereference)
			if not tunerstate.channel:
				tunerstate.channel = getChannel(eservicereference)
			if tunerstate.reference != str(ServiceReference(eservicereference)):
				tunerstate.reference = str(ServiceReference(eservicereference))
				print "=== IBTS update Stream reference:", tunerstate.reference
				tunerstate.updatePicon()

			return True
			
		else:
			
			# Stream is not active anymore				
			return None
    def update(self, id, tunerstate):

        stream = getStream(id)
        if stream:

            eservicereference = stream.getRecordServiceRef()

            del stream

            tunerstate.name = getEventName(eservicereference)

            if not tunerstate.number:
                tunerstate.number = getNumber(eservicereference)
            if not tunerstate.channel:
                tunerstate.channel = getChannel(eservicereference)
            if tunerstate.reference != str(
                    ServiceReference(eservicereference)):
                tunerstate.reference = str(ServiceReference(eservicereference))
                print "=== IBTS update Stream reference:", tunerstate.reference
                tunerstate.updatePicon()

            return True

        else:

            # Stream is not active anymore
            return None
Esempio n. 6
0
	def update(self, id, tunerstate):
		
		#TODO Avolid blocking - avoid using getTimer to update the timer times use timer.time_changed if possible
		
		timer = getTimer( id )
		if timer:
			tunerstate.name = timer.name
			
			tunerstate.begin = timer.begin
			tunerstate.end = timer.end
			tunerstate.endless = timer.autoincrease
			
			irecordservice = timer.record_service
			servicereference = timer.service_ref
			
			# Delete references to avoid blocking tuners
			del timer
			
			if not tunerstate.tuner or not tunerstate.tunertype or not tunerstate.tunernumber:
				tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = getTunerByPlayableService(irecordservice)
			
			if not tunerstate.number:
				tunerstate.number = getNumber(servicereference.ref)
			if not tunerstate.channel:
				tunerstate.channel = getChannel(servicereference.ref)
			
			return True
		
		else:
			# This can happen, if the time has been changed or if the timer does not exist anymore
			
			self.onInit()
			
			return None
Esempio n. 7
0
    def update(self, id, tunerstate):

        # print "IBTS Timers update ID", id

        if id in self.nextids:

            timer = getTimer(id)
            if timer:

                tunerstate.name = timer.name

                tunerstate.begin = timer.begin
                tunerstate.end = timer.end
                tunerstate.endless = timer.autoincrease

                servicereference = timer.service_ref

                del timer

                if not tunerstate.number:
                    tunerstate.number = getNumber(servicereference.ref)
                if not tunerstate.channel:
                    tunerstate.channel = getChannel(servicereference.ref)

                return True
            else:
                return None
        else:
            return None
    def onEvent(self, event, stream):
        if StreamingWebScreen and stream:
            if (event == StreamingWebScreen.EVENT_START):
                id = getStreamID(stream)
                log.debug("IBTS Stream Event WebIf Start " + id)

                irecordservice = stream.getRecordService()

                eservicereference = stream.getRecordServiceRef()

                # Extract parameters
                ip = str(stream.clientIP)
                if ip and ':' in ip and '.' in ip:
                    # Mixed style ::ffff:192.168.64.27
                    ip = string.split(str(stream.clientIP), ':')[-1]

                # Delete references to avoid blocking tuners
                del stream

                tuner, tunertype, tunernumber = getTunerByPlayableService(
                    irecordservice)

                name = getEventName(eservicereference)

                number = getNumber(eservicereference)
                channel = getChannel(eservicereference)

                reference = ""
                if eservicereference is not None:
                    reference = str(ServiceReference(eservicereference))

                client = getClient(ip)

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.addEntry(id, self.getPluginName(),
                                                self.getType(), self.getText(),
                                                tuner, tunertype, tunernumber,
                                                name,
                                                number, channel, reference,
                                                time(), 0, True, "", client,
                                                ip)
                    if config.infobartunerstate.plugin_webif.show_events.value:
                        gInfoBarTunerState.onEvent()

            elif event == StreamingWebScreen.EVENT_END:

                # Remove Finished Stream
                id = getStreamID(stream)
                log.debug("IBTS Stream Event WebIf End " + id)

                # Delete references to avoid blocking tuners
                del stream

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.finishEntry(id)
                    if config.infobartunerstate.plugin_webif.show_events.value:
                        gInfoBarTunerState.onEvent()
Esempio n. 9
0
	def onEvent(self, timer):
		if not timer.justplay:
			#print "IBTS Timer Event "+ str(timer.state) + ' ' + str(timer.repeated)
			#TODO
			# w.processRepeated()
			# w.state = TimerEntry.StateWaiting
			if timer.state == timer.StatePrepared:
				print "IBTS Records StatePrepared"
				pass
			
			elif timer.state == timer.StateRunning:
				id = getTimerID( timer )
				print "IBTS Records StateRunning ID " + id
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState and not gInfoBarTunerState.hasEntry(id):
					
					#TEST Bug Repeating timer blocking tuner and are not marked as finished
					#timer.timeChanged = self.__OnTimeChanged
					
					name = timer.name
					
					begin = timer.begin
					end = timer.end
					endless = timer.autoincrease
					
					# Is this really necessary?
					try: timer.Filename
					except: timer.calculateFilename()
					filename = timer.Filename
					
					irecordservice = timer.record_service
					servicereference = timer.service_ref
					
					# Delete references to avoid blocking tuners
					del timer
					
					tuner, tunertype, tunernumber = getTunerByPlayableService(irecordservice)
					
					number = getNumber(servicereference.ref)
					channel = getChannel(servicereference.ref)
					
					gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, tunertype, tunernumber, name, number, channel, begin, end, endless, filename)
					gInfoBarTunerState.onEvent()
			
			# Finished repeating timer will report the state StateEnded+1 or StateWaiting
			else:
				id = getTimerID( timer )
				print "IBTS Records StateEnded ID " + id
				
				# Delete references to avoid blocking tuners
				del timer
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
					gInfoBarTunerState.onEvent()
Esempio n. 10
0
    def onEvent(self, ev):
        #log.debug( "IBTS Live onEvent ev", ev, str(self.tunerstate) )
        if ev == iPlayableService.evUpdatedEventInfo or ev == iPlayableService.evUpdatedInfo:

            if self.tunerstate:
                tunerstate = self.tunerstate

                from NavigationInstance import instance
                if instance:

                    changed = False

                    eservicereference = instance.getCurrentlyPlayingServiceReference(
                    )
                    eservicereference_string = str(eservicereference)

                    # Avoid recalculations
                    if self.eservicereference_string != eservicereference_string:
                        tunerstate.number = None
                        tunerstate.channel = ""

                        tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = "", "", None
                        tunerstate.name, tunerstate.begin, tunerstate.end = "", 0, 0

                        self.eservicereference_string = eservicereference_string

                    if not tunerstate.number:
                        tunerstate.number = getNumber(eservicereference)
                        changed = True
                    if not tunerstate.channel:
                        tunerstate.channel = getChannel(eservicereference)
                        changed = True
                    if not tunerstate.reference:
                        tunerstate.reference = eservicereference_string
                        changed = True

                    iplayableservice = instance.getCurrentService()

                    if not tunerstate.tuner or not tunerstate.tunertype or not tunerstate.tunernumber:
                        tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = getTunerByPlayableService(
                            iplayableservice)
                        changed = True

                    if not tunerstate.name or not tunerstate.begin or not tunerstate.end:
                        tunerstate.name, tunerstate.begin, tunerstate.end = getEventData(
                            iplayableservice)
                        changed = True

                    if changed:
                        from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                        if gInfoBarTunerState:
                            gInfoBarTunerState.updateMetrics()

            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
            if gInfoBarTunerState:
                gInfoBarTunerState.onEvent()
    def onEvent(self, event, stream):
        log.debug("IBTS Stream Event OpenWebIf")
        if StreamAdapter and stream:
            if (event == StreamAdapter.EV_BEGIN):
                id = getStreamID(stream)
                log.debug("IBTS Stream Event OpenWebIf Start " + id)

                irecordservice = stream.getService()

                eservicereference = stream.ref

                # Extract parameters
                ip = stream.clientIP

                # Delete references to avoid blocking tuners
                del stream

                tuner, tunertype, tunernumber = getTunerByPlayableService(
                    irecordservice)

                name = getEventName(eservicereference)

                number = getNumber(eservicereference)
                channel = getChannel(eservicereference)
                reference = str(eservicereference)

                client = getClient(ip)

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.addEntry(id, self.getPluginName(),
                                                self.getType(), self.getText(),
                                                tuner, tunertype, tunernumber,
                                                name,
                                                number, channel, reference,
                                                time(), 0, True, "", client,
                                                ip)
                    if config.infobartunerstate.plugin_openwebif.show_events.value:
                        gInfoBarTunerState.onEvent()

            elif event == StreamAdapter.EV_STOP:

                # Remove Finished Stream
                id = getStreamID(stream)
                log.debug("IBTS Stream Event OpenWebIf End " + id)

                # Delete references to avoid blocking tuners
                del stream

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.finishEntry(id)
                    if config.infobartunerstate.plugin_openwebif.show_events.value:
                        gInfoBarTunerState.onEvent()
	def onEvent(self, event, stream):
		if StreamingWebScreen and stream:
			if (event == StreamingWebScreen.EVENT_START):
				id = getStreamID(stream)
				log.debug( "IBTS Stream Event WebIf Start " + id )
				
				irecordservice = stream.getRecordService()
				
				eservicereference = stream.getRecordServiceRef()
				
				# Extract parameters
				ip = str(stream.clientIP)
				if ip and ':' in ip and '.' in ip:
					# Mixed style ::ffff:192.168.64.27
					ip = string.split(str(stream.clientIP), ':')[-1]
				
				# Delete references to avoid blocking tuners
				del stream
				
				tuner, tunertype, tunernumber = getTunerByPlayableService( irecordservice ) 
				
				name = getEventName(eservicereference)
				
				number = getNumber(eservicereference)
				channel = getChannel(eservicereference)
				
				reference = ""
				if eservicereference is not None:
					reference = str(ServiceReference(eservicereference))
				
				client = getClient(ip)
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, tunertype, tunernumber, name, number, channel, reference, time(), 0, True, "", client, ip)
					if config.infobartunerstate.plugin_webif.show_events.value:
						gInfoBarTunerState.onEvent()
				
			elif event == StreamingWebScreen.EVENT_END:
				
				# Remove Finished Stream
				id = getStreamID(stream)
				log.debug( "IBTS Stream Event WebIf End " + id )
				
				# Delete references to avoid blocking tuners
				del stream
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
					if config.infobartunerstate.plugin_webif.show_events.value:
						gInfoBarTunerState.onEvent()
    def onEvent(self, ev):
        # print "IBTS Live onEvent ev", ev, str(self.tunerstate)
        if ev == iPlayableService.evUpdatedEventInfo or ev == iPlayableService.evUpdatedInfo:

            if self.tunerstate:
                tunerstate = self.tunerstate

                from NavigationInstance import instance

                if instance:

                    changed = False

                    eservicereference = instance.getCurrentlyPlayingServiceReference()
                    eservicereference_string = str(eservicereference)

                    # Avoid recalculations
                    if self.eservicereference_string != eservicereference_string:
                        tunerstate.number = None
                        tunerstate.channel = ""

                        tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = "", "", None
                        tunerstate.name, tunerstate.begin, tunerstate.end = "", 0, 0

                        self.eservicereference_string = eservicereference_string

                    if not tunerstate.number:
                        tunerstate.number = getNumber(eservicereference)
                        changed = True
                    if not tunerstate.channel:
                        tunerstate.channel = getChannel(eservicereference)
                        changed = True

                    iplayableservice = instance.getCurrentService()

                    if not tunerstate.tuner or not tunerstate.tunertype or not tunerstate.tunernumber:
                        tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = getTunerByPlayableService(
                            iplayableservice
                        )
                        changed = True

                    if not tunerstate.name or not tunerstate.begin or not tunerstate.end:
                        tunerstate.name, tunerstate.begin, tunerstate.end = getEventData(iplayableservice)
                        changed = True

                    if changed:
                        from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState

                        gInfoBarTunerState.updateMetrics()
	def onEvent(self, event, stream):
		log.debug( "IBTS Stream Event OpenWebIf" )
		if StreamAdapter and stream:
			if (event == StreamAdapter.EV_BEGIN):
				id = getStreamID(stream)
				log.debug( "IBTS Stream Event OpenWebIf Start " + id )
				
				irecordservice = stream.getService()
				
				eservicereference = stream.ref
				
				# Extract parameters
				ip = stream.clientIP
				
				# Delete references to avoid blocking tuners
				del stream
				
				tuner, tunertype, tunernumber = getTunerByPlayableService(irecordservice) 
				
				name = getEventName(eservicereference)
				
				number =  getNumber(eservicereference)
				channel = getChannel(eservicereference)
				reference = str(eservicereference)
				
				client = getClient(ip)
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, tunertype, tunernumber, name, number, channel, reference, time(), 0, True, "", client, ip)
					if config.infobartunerstate.plugin_openwebif.show_events.value:
						gInfoBarTunerState.onEvent()
			
			elif event == StreamAdapter.EV_STOP:
				
				# Remove Finished Stream
				id = getStreamID(stream)
				log.debug( "IBTS Stream Event OpenWebIf End " + id )
				
				# Delete references to avoid blocking tuners
				del stream
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
					if config.infobartunerstate.plugin_openwebif.show_events.value:
						gInfoBarTunerState.onEvent()
Esempio n. 15
0
    def onEventParametersChanged(self, params):
        try:
            if self.ids:
                id, ip, servicereference_string = self.ids[-1]
                print "IBTS Stream Event StreamServer Changed " + id

                if servicereference_string is None:

                    servicereference_string = str(
                        params.get(streamServerControl.URI_PARAM_REF, [""])[0])

                    self.ids[-1] = (id, ip, servicereference_string)

                    if servicereference_string:

                        eservicereference = eServiceReference(
                            servicereference_string)
                        if eservicereference and eservicereference.valid():

                            service_ref = ServiceReference(
                                servicereference_string)

                            tuner, tunertype, tunernumber = getTunerByServiceReference(
                                service_ref)

                            name = getEventName(eservicereference)

                            number = getNumber(eservicereference)
                            channel = getChannel(eservicereference)
                            name = getEventName(eservicereference)

                            client = getClient(ip)

                            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                            if gInfoBarTunerState:
                                gInfoBarTunerState.addEntry(
                                    id, self.getPluginName(), self.getType(),
                                    self.getText(), tuner, tunertype,
                                    tunernumber, name, number, channel, time(),
                                    0, True, "", client, ip)
                                gInfoBarTunerState.onEvent()
        except Exception, e:
            print "IBTS exception " + str(e)
            import os, sys, traceback
            print str(sys.exc_info()[0])
            print str(traceback.format_exc())
            sys.exc_clear()
Esempio n. 16
0
    def update(self, id, tunerstate):

        servicereference_string = self.getRef(id)

        if servicereference_string:

            eservicereference = eServiceReference(servicereference_string)
            if eservicereference and eservicereference.valid():

                tunerstate.name = getEventName(eservicereference)

                if not tunerstate.number:
                    tunerstate.number = getNumber(eservicereference)
                if not tunerstate.channel:
                    tunerstate.channel = getChannel(eservicereference)

            return True

        else:

            return None
Esempio n. 17
0
	def update(self, id, tunerstate):
		
		servicereference_string = self.getRef(id)
		
		if servicereference_string:
			
			eservicereference = eServiceReference(servicereference_string)
			if eservicereference and eservicereference.valid():
				
				tunerstate.name = getEventName(eservicereference)
				
				if not tunerstate.number:
					tunerstate.number = getNumber(eservicereference)
				if not tunerstate.channel:
					tunerstate.channel = getChannel(eservicereference)
		
			return True
		
		else:
			
			return None
    def update(self, id, tunerstate):

        stream = getStream(id)
        if stream:

            eservicereference = stream.getRecordServiceRef()

            del stream

            tunerstate.name = getEventName(eservicereference)

            if not tunerstate.number:
                tunerstate.number = getNumber(eservicereference)
            if not tunerstate.channel:
                tunerstate.channel = getChannel(eservicereference)

            return True

        else:

            # Stream is not active anymore
            return None
Esempio n. 19
0
	def onEventParametersChanged(self, params):
		try:
			if self.ids:
				id, ip, servicereference_string = self.ids[-1]
				print "IBTS Stream Event StreamServer Changed " + id
				
				if servicereference_string is None:
				
					servicereference_string = str(params.get(streamServerControl.URI_PARAM_REF, [""])[0])
					
					self.ids[-1] = (id, ip, servicereference_string)
					
					if servicereference_string:
						
						eservicereference = eServiceReference(servicereference_string)
						if eservicereference and eservicereference.valid():
							
							service_ref = ServiceReference(servicereference_string)
							
							tuner, tunertype, tunernumber = getTunerByServiceReference( service_ref ) 
							
							name = getEventName(eservicereference)
							
							number = getNumber(eservicereference)
							channel = getChannel(eservicereference)
							name = getEventName(eservicereference)
							
							client = getClient(ip)
							
							from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
							if gInfoBarTunerState:
								gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, tunertype, tunernumber, name, number, channel, time(), 0, True, "", client, ip)
								gInfoBarTunerState.onEvent()
		except Exception, e:
			print "IBTS exception " + str(e)
			import os, sys, traceback
			print str(sys.exc_info()[0])
			print str(traceback.format_exc())
			sys.exc_clear()
Esempio n. 20
0
    def update(self, id, tunerstate):

        stream = getStream(id)
        if stream:

            eservicereference = stream.getRecordServiceRef()

            del stream

            tunerstate.name = getEventName(eservicereference)

            if not tunerstate.number:
                tunerstate.number = getNumber(eservicereference)
            if not tunerstate.channel:
                tunerstate.channel = getChannel(eservicereference)

            return True

        else:

            # Stream is not active anymore
            return None
Esempio n. 21
0
	def onEventParametersChanged(self, params):
		try:
			if self.ids:
				id, ip, servicereference_string = self.ids[-1]
				log.debug( "IBTS Stream Event StreamServer Changed " + id )
				
				if servicereference_string is None:
				
					servicereference_string = str(params.get(streamServerControl.URI_PARAM_REF, [""])[0])
					
					self.ids[-1] = (id, ip, servicereference_string)
					
					if servicereference_string:
						
						eservicereference = eServiceReference(servicereference_string)
						if eservicereference and eservicereference.valid():
							
							service_ref = ServiceReference(servicereference_string)
							
							tuner, tunertype, tunernumber = getTunerByServiceReference( service_ref ) 
							
							name = getEventName(eservicereference)
							
							number = getNumber(eservicereference)
							channel = getChannel(eservicereference)
							name = getEventName(eservicereference)
							reference = str(eservicereference)
							
							client = getClient(ip)
							
							from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
							if gInfoBarTunerState:
								gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, tunertype, tunernumber, name, number, channel, reference, time(), 0, True, "", client, ip)
								if config.infobartunerstate.plugin_openwebif.show_events.value:
									gInfoBarTunerState.onEvent()
		except Exception, e:
			log.exception( "IBTS exception " + str(e) )
Esempio n. 22
0
	def update(self, id, tunerstate):
		if config.infobartunerstate.plugin_pip.enabled.value:
			
			remove = True
			
			if tunerstate:
				
				from Screens.InfoBar import InfoBar
				if InfoBar.instance and InfoBar.instance.session:

					if hasattr(InfoBar.instance.session, "pip"):
					
						pip = InfoBar.instance.session.pip
						
						eservicereference = None
						if hasattr(pip, "currentService"): 
							eservicereference = pip.currentService
						
						if eservicereference:
							log.debug( "IBTS PiP update service" )
							
							remove = False
							changed = False
							
							eservicereference_string = str(eservicereference)
							
							# Avoid recalculations
							if self.eservicereference_string != eservicereference_string:
								tunerstate.number = None
								tunerstate.channel = ""
								tunerstate.reference = ""
								
								tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = "", "", None
								tunerstate.name, tunerstate.begin, tunerstate.end = "", 0, 0
								
								self.eservicereference_string = eservicereference_string
								
							if not tunerstate.number:
								tunerstate.number = getNumber(eservicereference)
								changed = True
							if not tunerstate.channel:
								tunerstate.channel = getChannel(eservicereference)
								changed = True
							if not tunerstate.reference:
								#tunerstate.reference = eservicereference_string
								tunerstate.reference = str(ServiceReference(eservicereference))
								tunerstate.updatePicon()
								changed = True
							
							iplayableservice = None
							if hasattr(pip, "pipservice"):
								iplayableservice = pip.pipservice
							#if hasattr(pip, "getCurrentServiceReference"):
							#	iplayableservice = pip.getCurrentServiceReference()
							
							log.debug( "IBTS PiP update iPlay", str(iplayableservice) )
							if iplayableservice:
								if not tunerstate.tuner or not tunerstate.tunertype or not tunerstate.tunernumber:
									tunerstate.tuner, tunerstate.tunertype, tunerstate.tunernumber = getTunerByPlayableService(iplayableservice)
									changed = True
								
								if not tunerstate.name or not tunerstate.begin or not tunerstate.end:
									tunerstate.name, tunerstate.begin, tunerstate.end = getEventData(iplayableservice)
									changed = True
								
							if changed:
								from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
								if gInfoBarTunerState:
									gInfoBarTunerState.updateMetrics()
					
			if remove:
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
				return False
				
			else:
				return True
	def onEvent(self, timer):
		if timer.justplay:
			return
		
		elif timer.state == timer.StatePrepared:
			log.debug( "IBTS Records StatePrepared" )
			return
		
		elif timer.state == timer.StateRunning:
			id = getTimerID( timer )
			log.debug( "IBTS Records StateRunning ID " + id )
			
			from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
			if gInfoBarTunerState and not gInfoBarTunerState.hasEntry(id):
				
				#TEST Bug Repeating timer blocking tuner and are not marked as finished
				#timer.timeChanged = self.__OnTimeChanged
				
				name = timer.name
				
				begin = timer.begin
				end = timer.end
				endless = timer.autoincrease
				
				# Is this really necessary?
				try: timer.Filename
				except: timer.calculateFilename()
				
				try: filename = timer.Filename
				except: filename = timer.name
				
				irecordservice = timer.record_service
				servicereference = timer.service_ref
				
				# Delete references to avoid blocking tuners
				del timer
				
				tuner, tunertype, tunernumber = getTunerByPlayableService(irecordservice)
				
				number = getNumber(servicereference.ref)
				channel = getChannel(servicereference.ref)
				reference = str(servicereference)
				
				gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, tunertype, tunernumber, name, number, channel, reference, begin, end, endless, filename)
				if config.infobartunerstate.plugin_records.show_events.value == "start" or config.infobartunerstate.plugin_records.show_events.value == "startend":
					gInfoBarTunerState.onEvent()
		
		elif timer.state == timer.StateEnded:
			id = getTimerID( timer )
			log.debug( "IBTS Records StateEnded ID " + id )
			
			# Delete references to avoid blocking tuners
			del timer
			
			self.finish(id)
			
			from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
			if gInfoBarTunerState:
				if config.infobartunerstate.plugin_records.show_events.value == "startend" or config.infobartunerstate.plugin_records.show_events.value == "end":
					gInfoBarTunerState.onEvent()
		
		elif timer.state == timer.StateWaiting:
			id = getTimerID( timer )
			log.debug( "IBTS Records StateWaiting ID " + id )
			
			finish = False
			
			# Finished repeating timer will report the state StateEnded+1 or StateWaiting
			if (timer.repeated != 0):
				finish = True
			
			# Delete references to avoid blocking tuners
			del timer
			
			if finish:
				self.finish(id)
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					if config.infobartunerstate.plugin_records.show_events.value == "startend" or config.infobartunerstate.plugin_records.show_events.value == "end":
						gInfoBarTunerState.onEvent()
		
		elif timer.state == (timer.StateEnded+1):
			id = getTimerID( timer )
			log.debug( "IBTS Records StateEnded+1 ID " + id )
			
			finish = False
			
			# Finished repeating timer will report the state StateEnded+1 or StateWaiting
			if (timer.repeated != 0):
				finish = True
			
			# Delete references to avoid blocking tuners
			del timer
			
			if finish:
				self.finish(id)
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					if config.infobartunerstate.plugin_records.show_events.value == "startend" or config.infobartunerstate.plugin_records.show_events.value == "end":
						gInfoBarTunerState.onEvent()
		
		else:
			# Unknown timer state
			id = getTimerID( timer )
			log.debug( "IBTS Records unknown state  " + str(timer.state) + " ID " + id )
			
			# Delete references to avoid blocking tuners
			del timer
Esempio n. 24
0
    def onShow(self, tunerstates):
        if config.infobartunerstate.plugin_timers.enabled.value:
            number_pending_timers = int(config.infobartunerstate.plugin_timers.
                                        number_pending_timers.value)
            #print "IBTS number_pending_timers", number_pending_timers

            toremove = self.nextids[:]

            if number_pending_timers:
                pending_seconds = int(config.infobartunerstate.plugin_timers.
                                      pending_hours.value) * 3600
                pending_limit = (time() +
                                 pending_seconds) if pending_seconds else 0
                #print "IBTS pending_limit", pending_limit

                timer_list = getNextPendingRecordTimers(
                    pending_limit)[:number_pending_timers]

                if timer_list:

                    timer_list.reverse()

                    for i, timer in enumerate(timer_list):

                        if timer:

                            id = getTimerID(timer)
                            #print "IBTS toadd", id

                            # Only add timer if not recording
                            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                            if gInfoBarTunerState:
                                if gInfoBarTunerState.hasEntry(id):

                                    # Delete references to avoid blocking tuners
                                    del timer

                                else:

                                    name = timer.name
                                    servicereference = timer.service_ref

                                    # Is this really necessary?
                                    try:
                                        timer.Filename
                                    except:
                                        timer.calculateFilename()

                                    try:
                                        filename = timer.Filename
                                    except:
                                        filename = timer.name

                                    begin = timer.begin
                                    end = timer.end
                                    endless = timer.autoincrease

                                    # Delete references to avoid blocking tuners
                                    del timer

                                    number = getNumber(servicereference.ref)
                                    channel = getChannel(servicereference.ref)

                                    self.nextids.append(id)
                                    gInfoBarTunerState.addEntry(
                                        id,
                                        self.getPluginName(), self.getType(),
                                        self.getText(), "", "", None, name,
                                        number, channel, begin, end, endless,
                                        filename)

                                if id in toremove:
                                    toremove.remove(id)

                # Close all not touched next timers
                if toremove:
                    from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                    if gInfoBarTunerState:
                        #print "IBTS toremove"
                        for id in toremove:
                            #print "IBTS toremove", id
                            if id in self.nextids:
                                self.nextids.remove(id)
                            gInfoBarTunerState.removeEntry(id)
    def onEvent(self, event, stream):
        if StreamingWebScreen and stream:
            if event == StreamingWebScreen.EVENT_START:
                id = getStreamID(stream)
                print "IBTS Stream Event WebIf Start " + id

                irecordservice = stream.getRecordService()

                eservicereference = stream.getRecordServiceRef()

                # Extract parameters
                ip = str(stream.clientIP)
                if ip and ":" in ip and "." in ip:
                    # Mixed style ::ffff:192.168.64.27
                    ip = string.split(str(stream.clientIP), ":")[-1]

                    # Delete references to avoid blocking tuners
                del stream

                tuner, tunertype, tunernumber = getTunerByPlayableService(irecordservice)

                name = getEventName(eservicereference)

                number = getNumber(eservicereference)
                channel = getChannel(eservicereference)

                client = getClient(ip)

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState

                gInfoBarTunerState.addEntry(
                    id,
                    self.getPluginName(),
                    self.getType(),
                    self.getText(),
                    tuner,
                    tunertype,
                    tunernumber,
                    name,
                    number,
                    channel,
                    time(),
                    0,
                    True,
                    "",
                    client,
                    ip,
                )
                gInfoBarTunerState.onEvent()

            elif event == StreamingWebScreen.EVENT_END:

                # Remove Finished Stream
                id = getStreamID(stream)
                print "IBTS Stream Event WebIf End " + id

                # Delete references to avoid blocking tuners
                del stream

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState

                gInfoBarTunerState.finishEntry(id)
                gInfoBarTunerState.onEvent()
	def onShow(self, tunerstates):
		if config.infobartunerstate.plugin_timers.enabled.value:
			number_pending_timers = int( config.infobartunerstate.plugin_timers.number_pending_timers.value )
			#log.debug( "IBTS number_pending_timers", number_pending_timers )
			
			toremove = self.nextids[:]
			
			if number_pending_timers:
				pending_seconds = int( config.infobartunerstate.plugin_timers.pending_hours.value ) * 3600
				pending_limit = (time() + pending_seconds) if pending_seconds else 0
				#log.debug( "IBTS pending_limit", pending_limit )
				timer_end = 0
				timer_list = getNextPendingRecordTimers(pending_limit)[:]
				#pprint.pprint(timer_list)
				
				if timer_list:
					
					#timer_list.reverse()
					
					for i, timer in enumerate(timer_list):
						if i>=number_pending_timers+timer_end:
							break
						if timer:
							
							id = getTimerID( timer )
							#log.debug( "IBTS toadd", id )
							
							if id in toremove:
								toremove.remove(id)
							
							# Only add timer if not recording
							from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
							if gInfoBarTunerState:
								if gInfoBarTunerState.hasEntry(id):
									
									# Delete references to avoid blocking tuners
									del timer
									
								else:
								
									name = timer.name
									servicereference = timer.service_ref
									
									# if ((name=="Ausschalten")or(name=="Einschalten")or(name=="Standby"))and(config.infobartunerstate.plugin_timers.show_energy_timers.value==False):
									# isset zapbeforerecord="0" justremind="0" wakeup_t="0" shutdown_t="0" notify_t="0" standby_t="1"
									
									if (str(servicereference)[0]=="-")and(config.infobartunerstate.plugin_timers.show_energy_timers.value==False):
										timer_end+=1
										
									else:
										# Is this really necessary?
										try: timer.Filename
										except: timer.calculateFilename()
										
										try: filename = timer.Filename
										except: filename = timer.name
										
										begin = timer.begin
										end = timer.end
										endless = timer.autoincrease
										
										# Delete references to avoid blocking tuners
										del timer
										
										number = getNumber(servicereference.ref)
										channel = getChannel(servicereference.ref)
										reference = str(servicereference)
										
										self.nextids.append(id)
										gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), "", "", None, name, number, channel, reference, begin, end, endless, filename)

				# Close all not touched next timers
				if toremove:
					from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
					if gInfoBarTunerState:
						log.debug( "IBTS toremove" )
						#pprint.pprint(toremove)
						for id in toremove:
							log.debug( "IBTS timers toremove", id )
							if id in self.nextids:
								self.nextids.remove(id)
							gInfoBarTunerState.removeEntry(id)
Esempio n. 27
0
    def onShow(self, tunerstates):
        if config.infobartunerstate.plugin_timers.enabled.value:
            number_pending_timers = int(config.infobartunerstate.plugin_timers.number_pending_timers.value)
            # print "IBTS number_pending_timers", number_pending_timers

            toremove = self.nextids[:]

            if number_pending_timers:
                pending_seconds = int(config.infobartunerstate.plugin_timers.pending_hours.value) * 3600
                pending_limit = (time() + pending_seconds) if pending_seconds else 0
                # print "IBTS pending_limit", pending_limit

                timer_list = getNextPendingRecordTimers(pending_limit)[:number_pending_timers]

                if timer_list:

                    timer_list.reverse()

                    for i, timer in enumerate(timer_list):

                        if timer:

                            id = getTimerID(timer)
                            # print "IBTS toadd", id

                            # Only add timer if not recording
                            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState

                            if gInfoBarTunerState:
                                if gInfoBarTunerState.hasEntry(id):

                                    # Delete references to avoid blocking tuners
                                    del timer

                                else:

                                    name = timer.name
                                    servicereference = timer.service_ref

                                    # Is this really necessary?
                                    try:
                                        timer.Filename
                                    except:
                                        timer.calculateFilename()

                                    try:
                                        filename = timer.Filename
                                    except:
                                        filename = timer.name

                                    begin = timer.begin
                                    end = timer.end
                                    endless = timer.autoincrease

                                    # Delete references to avoid blocking tuners
                                    del timer

                                    number = getNumber(servicereference.ref)
                                    channel = getChannel(servicereference.ref)

                                    self.nextids.append(id)
                                    gInfoBarTunerState.addEntry(
                                        id,
                                        self.getPluginName(),
                                        self.getType(),
                                        self.getText(),
                                        "",
                                        "",
                                        None,
                                        name,
                                        number,
                                        channel,
                                        begin,
                                        end,
                                        endless,
                                        filename,
                                    )

                                if id in toremove:
                                    toremove.remove(id)

                                    # Close all not touched next timers
                if toremove:
                    from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState

                    if gInfoBarTunerState:
                        # print "IBTS toremove"
                        for id in toremove:
                            # print "IBTS toremove", id
                            if id in self.nextids:
                                self.nextids.remove(id)
                            gInfoBarTunerState.removeEntry(id)
Esempio n. 28
0
    def onEvent(self, timer):
        if timer.justplay:
            return

        elif timer.state == timer.StatePrepared:
            log.debug("IBTS Records StatePrepared")
            return

        elif timer.state == timer.StateRunning:
            id = getTimerID(timer)
            log.debug("IBTS Records StateRunning ID " + id)

            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
            if gInfoBarTunerState and not gInfoBarTunerState.hasEntry(id):

                #TEST Bug Repeating timer blocking tuner and are not marked as finished
                #timer.timeChanged = self.__OnTimeChanged

                name = timer.name

                begin = timer.begin
                end = timer.end
                endless = timer.autoincrease

                # Is this really necessary?
                try:
                    timer.Filename
                except:
                    timer.calculateFilename()

                try:
                    filename = timer.Filename
                except:
                    filename = timer.name

                irecordservice = timer.record_service
                servicereference = timer.service_ref

                # Delete references to avoid blocking tuners
                del timer

                tuner, tunertype, tunernumber = getTunerByPlayableService(
                    irecordservice)

                number = getNumber(servicereference.ref)
                channel = getChannel(servicereference.ref)
                reference = str(servicereference)

                gInfoBarTunerState.addEntry(id, self.getPluginName(),
                                            self.getType(), self.getText(),
                                            tuner, tunertype, tunernumber,
                                            name, number, channel, reference,
                                            begin, end, endless, filename)
                if config.infobartunerstate.plugin_records.show_events.value == "start" or config.infobartunerstate.plugin_records.show_events.value == "startend":
                    gInfoBarTunerState.onEvent()

        elif timer.state == timer.StateEnded:
            id = getTimerID(timer)
            log.debug("IBTS Records StateEnded ID " + id)

            # Delete references to avoid blocking tuners
            del timer

            self.finish(id)

            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
            if gInfoBarTunerState:
                if config.infobartunerstate.plugin_records.show_events.value == "startend" or config.infobartunerstate.plugin_records.show_events.value == "end":
                    gInfoBarTunerState.onEvent()

        elif timer.state == timer.StateWaiting:
            id = getTimerID(timer)
            log.debug("IBTS Records StateWaiting ID " + id)

            finish = False

            # Finished repeating timer will report the state StateEnded+1 or StateWaiting
            if (timer.repeated != 0):
                finish = True

            # Delete references to avoid blocking tuners
            del timer

            if finish:
                self.finish(id)

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    if config.infobartunerstate.plugin_records.show_events.value == "startend" or config.infobartunerstate.plugin_records.show_events.value == "end":
                        gInfoBarTunerState.onEvent()

        elif timer.state == (timer.StateEnded + 1):
            id = getTimerID(timer)
            log.debug("IBTS Records StateEnded+1 ID " + id)

            finish = False

            # Finished repeating timer will report the state StateEnded+1 or StateWaiting
            if (timer.repeated != 0):
                finish = True

            # Delete references to avoid blocking tuners
            del timer

            if finish:
                self.finish(id)

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    if config.infobartunerstate.plugin_records.show_events.value == "startend" or config.infobartunerstate.plugin_records.show_events.value == "end":
                        gInfoBarTunerState.onEvent()

        else:
            # Unknown timer state
            id = getTimerID(timer)
            log.debug("IBTS Records unknown state  " + str(timer.state) +
                      " ID " + id)

            # Delete references to avoid blocking tuners
            del timer