def finish(self, id):
		finished_seconds = int( config.infobartunerstate.plugin_records.finished_hours.value ) * 3600
		number_finished_records = int(config.infobartunerstate.plugin_records.number_finished_records.value)
		if finished_seconds == 0 or number_finished_records == 0:
			from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
			if gInfoBarTunerState:
				gInfoBarTunerState.finishEntry(id)
			return
		
		timer = getTimer( id )
		if timer:
			end = timer.end
			del timer
			
			if ( end + finished_seconds ) < time():
				log.debug( "IBTS Record finish end + limit < now - Remove", id )
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id, False)
				return
		else:
			log.debug( "IBTS Record finish no timer", id )
		
		from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
		if gInfoBarTunerState:
			gInfoBarTunerState.RecordfinishEntry(id)
示例#2
0
 def onShow(self, tunerstates):
     if config.infobartunerstate.plugin_records.enabled.value:
         from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
         from Plugins.Extensions.InfoBarTunerState.InfoBarTunerState import RECORD_FINISHED
         finished_seconds = int(config.infobartunerstate.plugin_records.
                                finished_hours.value) * 3600
         number_finished_records = int(
             config.infobartunerstate.plugin_records.
             number_finished_records.value)
         if number_finished_records == 0:
             return
         count = 0
         now = time()
         tunerstatessort = sorted(tunerstates.items(),
                                  key=lambda k: k[1].end,
                                  reverse=True)
         for id, tunerstate in tunerstatessort:
             if tunerstate.type == RECORD_FINISHED:
                 if tunerstate.end < now:
                     count += 1
                     if count > number_finished_records or (
                             tunerstate.end + finished_seconds) < now:
                         log.debug(
                             "IBTS Records number_finished_records - Remove",
                             id)
                         gInfoBarTunerState.finishEntry(id, False)
示例#3
0
    def finish(self, id):
        finished_seconds = int(config.infobartunerstate.plugin_records.
                               finished_hours.value) * 3600
        number_finished_records = int(config.infobartunerstate.plugin_records.
                                      number_finished_records.value)
        if finished_seconds == 0 or number_finished_records == 0:
            from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
            if gInfoBarTunerState:
                gInfoBarTunerState.finishEntry(id)
            return

        timer = getTimer(id)
        if timer:
            end = timer.end
            del timer

            if (end + finished_seconds) < time():
                log.debug("IBTS Record finish end + limit < now - Remove", id)
                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.finishEntry(id, False)
                return
        else:
            log.debug("IBTS Record finish no timer", id)

        from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
        if gInfoBarTunerState:
            gInfoBarTunerState.RecordfinishEntry(id)
示例#4
0
	def onEventClientCountChanged(self, count, client, force=False):
		if len(self.ids) < count:
			
			# Extract parameters
			ip = str(client)
			
			id = getStreamID(count, ip)
			print "IBTS Stream Event StreamServer Start " + id
			
			self.ids.append( (id, ip, None) )
			
			# We will add the entry later
			
			if force:
				client = getClient(ip)
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), "", "", 0, "", 0, time(), 0, True, "", client, ip, "")
					gInfoBarTunerState.onEvent()
			
		else:
			
			# Remove Finished Stream
			print "IBTS Stream Event StreamServer End", count, client
			
			# There is no way to find the correct stream, just remove the oldest
			if  self.ids:
				id, ip, servicereference_string = self.ids[0]
				del self.ids[0]
				
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
					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()
示例#6
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()
示例#7
0
	def onShow(self, tunerstates):
		if config.infobartunerstate.plugin_pip.enabled.value:
			if not self.tunerstate:
				self.tunerstate = self.checkPiP()
			else:
				from Screens.InfoBar import InfoBar
				if InfoBar.instance and InfoBar.instance.session and hasattr(InfoBar.instance.session, "pip")==False:
					from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
					if gInfoBarTunerState:
						gInfoBarTunerState.finishEntry("PiP")
    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, 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 onShow(self, tunerstates):
		if config.infobartunerstate.plugin_records.enabled.value:
			from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
			from Plugins.Extensions.InfoBarTunerState.InfoBarTunerState import RECORD_FINISHED
			finished_seconds = int( config.infobartunerstate.plugin_records.finished_hours.value ) * 3600
			number_finished_records = int(config.infobartunerstate.plugin_records.number_finished_records.value)
			if number_finished_records == 0:
				return
			count = 0
			now = time()
			tunerstatessort = sorted(tunerstates.items(), key=lambda k: k[1].end, reverse=True)
			for id, tunerstate in tunerstatessort:
				if tunerstate.type == RECORD_FINISHED:
					if tunerstate.end < now:
						count += 1
						if count > number_finished_records or (tunerstate.end + finished_seconds) < now:
							log.debug( "IBTS Records number_finished_records - Remove", id )
							gInfoBarTunerState.finishEntry(id,False)
    def onShow(self, tunerstates):
        if config.infobartunerstate.plugin_unknown.enabled.value:
            toadd = self.tuners[:]
            type = self.getType()
            for id, tunerstate in tunerstates.items():
                if tunerstate.type != type:
                    if tunerstate.tunernumber in toadd:
                        #log.debug( "IBTS UNKNOWN toadd remove", tunerstate.tunernumber )
                        toadd.remove(tunerstate.tunernumber)

            # Check if we have to add an entry
            if toadd:
                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    for tunernumber in toadd:

                        id = "Unknown" + str(tunernumber)
                        if gInfoBarTunerState and not gInfoBarTunerState.hasEntry(
                                id):

                            tuner = getTunerName(tunernumber)

                            #log.debug( "IBTS UNKNOWN append ", tunernumber )
                            self.tunerstates.append(tunernumber)

                            gInfoBarTunerState.addEntry(
                                id, self.getPluginName(), self.getType(),
                                self.getText(), tuner, "-", tunernumber,
                                _("Used by unknown service"), "-", "-", "", "",
                                time())

            # Check if we have to remove an entry
            if self.tunerstates:
                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    for tunernumber in self.tunerstates:

                        if tunernumber not in self.tuners:
                            id = "Unknown" + str(tunernumber)

                            #log.debug( "IBTS UNKNOWN remove ", tunernumber )
                            self.tunerstates.remove(tunernumber)

                            gInfoBarTunerState.finishEntry(id)
	def onShow(self, tunerstates):
		if config.infobartunerstate.plugin_unknown.enabled.value:
			toadd = self.tuners[:]
			type = self.getType()
			for id, tunerstate in tunerstates.items():
				if tunerstate.type != type:
					if tunerstate.tunernumber in toadd:
						#log.debug( "IBTS UNKNOWN toadd remove", tunerstate.tunernumber )
						toadd.remove(tunerstate.tunernumber)
			
			# Check if we have to add an entry
			if toadd:
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					for tunernumber in toadd:
						
						id = "Unknown"+str(tunernumber)
						if gInfoBarTunerState and not gInfoBarTunerState.hasEntry(id):
							
							tuner = getTunerName(tunernumber)
							
							#log.debug( "IBTS UNKNOWN append ", tunernumber )
							self.tunerstates.append(tunernumber)
							
							gInfoBarTunerState.addEntry(id, self.getPluginName(), self.getType(), self.getText(), tuner, "-", tunernumber, _("Used by unknown service"), "-", "-", "", "", time() )
			
			# Check if we have to remove an entry
			if self.tunerstates:
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					for tunernumber in self.tunerstates:
					
						if tunernumber not in self.tuners:
							id = "Unknown"+str(tunernumber)
							
							#log.debug( "IBTS UNKNOWN remove ", tunernumber )
							self.tunerstates.remove(tunernumber)
							
							gInfoBarTunerState.finishEntry(id)
示例#14
0
    def onEventClientCountChanged(self, count, client, force=False):
        if len(self.ids) < count:

            # Extract parameters
            ip = str(client)

            id = getStreamID(count, ip)
            print "IBTS Stream Event StreamServer Start " + id

            self.ids.append((id, ip, None))

            # We will add the entry later

            if force:
                client = getClient(ip)

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.addEntry(id, self.getPluginName(),
                                                self.getType(), self.getText(),
                                                "", "", 0, "", 0, time(), 0,
                                                True, "", client, ip, "")
                    gInfoBarTunerState.onEvent()

        else:

            # Remove Finished Stream
            print "IBTS Stream Event StreamServer End", count, client

            # There is no way to find the correct stream, just remove the oldest
            if self.ids:
                id, ip, servicereference_string = self.ids[0]
                del self.ids[0]

                from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
                if gInfoBarTunerState:
                    gInfoBarTunerState.finishEntry(id)
                    gInfoBarTunerState.onEvent()
示例#15
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.ref)
				
				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
			
			from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
			if gInfoBarTunerState:
				gInfoBarTunerState.finishEntry(id)
				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:
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
					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:
				from Plugins.Extensions.InfoBarTunerState.plugin import gInfoBarTunerState
				if gInfoBarTunerState:
					gInfoBarTunerState.finishEntry(id)
					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
    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()