Ejemplo n.º 1
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()
    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)
	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)
Ejemplo n.º 5
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
Ejemplo n.º 6
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)
Ejemplo n.º 7
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, 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