def buildEPGSearchEntry(self, service, eventId, beginTime, duration, EventName):
		rec1 = self.getClockTypesForEntry(service, eventId, beginTime, duration)
		# Partnerbox 
		if PartnerBoxIconsEnabled:
			rec2 = beginTime and isInRemoteTimer(self, beginTime, duration, service)
		else:
			rec2 = False
		r1 = self.weekday_rect
		r2 = self.datetime_rect
		r3 = self.descr_rect
		dx = self.piconSize[0] + self.piconDistance
		nowTime = int(time())
		remaining = ""
		if beginTime is not None:
			if nowTime < beginTime:
				remaining = _(" (%d min)") % (duration / 60)
			else:
				prefix = "+"
				total = ((beginTime+duration) - nowTime) / 60
				if total <= 0:
					prefix = ""
				remaining = _(" (%s%d min)") % (prefix, total)
		t = localtime(beginTime)
		serviceref = ServiceReference(service) # for Servicename
		if config.plugins.epgsearch.picons.value:
			if getPiconsName:
				picon = getPiconName(service)
			else:
				picon = self.findPicon(service)
			if picon != "":
				self.picon.setPara((self.piconSize[0], self.piconSize[1], 1, 1, False, 1, '#000f0f0f'))
				self.picon.startDecode(picon, 0, 0, False)
				png = self.picon.getData()
				dy = int((self.height - self.piconSize[1])/2.)
				res = [
					None, # no private data needed
					(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r1.left(), r1.top()+ dy, self.piconSize[0], self.piconSize[1], png),
					(eListboxPythonMultiContent.TYPE_TEXT, r1.left() + dx, r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
					(eListboxPythonMultiContent.TYPE_TEXT, r2.left() + dx, r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
				]
			else:
				res = [
					None, # no private data needed
					(eListboxPythonMultiContent.TYPE_TEXT, r1.left() + dx, r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
					(eListboxPythonMultiContent.TYPE_TEXT, r2.left() + dx, r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
				]
		else:
			res = [
				None, # no private data needed
				(eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
				(eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
			]
		if config.plugins.epgsearch.picons.value:
			if rec1 or rec2:
				if rec1:
					clock_types = rec1
					# maybe Partnerbox too
					if rec2:
						if PartnerBoxZapRepIcons:
							clock_pic_partnerbox = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
						else:
							clock_pic_partnerbox = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				else:
					if PartnerBoxZapRepIcons:
						clock_pic = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
					else:
						clock_pic = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				if rec1 and rec2:
					# Partnerbox and local
					for i in range(len(clock_types)):
						res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
					res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + (i + 1) * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic_partnerbox),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.pboxDistance + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
				else:
					if rec1:
						for i in range(len(clock_types)):
							res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
						res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + dx + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
					else:
						res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + dx, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + self.pboxDistance + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
			else:
				res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + dx, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
		else:
			if rec1 or rec2:
				if rec1:
					clock_types = rec1
					# maybe Partnerbox too
					if rec2:
						if PartnerBoxZapRepIcons:
							clock_pic_partnerbox = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
						else:
							clock_pic_partnerbox = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				else:
					if PartnerBoxZapRepIcons:
						clock_pic = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
					else:
						clock_pic = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				if rec1 and rec2:
					# Partnerbox and local
					for i in range(len(clock_types)):
						res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
					res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + (i + 1) * self.space, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic_partnerbox),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
				else:
					if rec1:
						for i in range(len(clock_types)):
							res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.iconSize, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
						res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
					else:
						res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
			else:
				res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
		return res
Exemple #2
0
	def buildEPGSearchEntry(self, service, eventId, beginTime, duration, EventName):
		rec1 = self.getClockTypesForEntry(service, eventId, beginTime, duration)
		# Partnerbox
		if PartnerBoxIconsEnabled:
			rec2 = beginTime and isInRemoteTimer(self, beginTime, duration, service)
		else:
			rec2 = False
		r1 = self.weekday_rect
		r2 = self.datetime_rect
		r3 = self.descr_rect
		dx = self.piconSize[0] + self.piconDistance
		nowTime = int(time())
		remaining = ""
		if beginTime is not None:
			if nowTime < beginTime:
				remaining = _(" (%d min)") % (duration / 60)
			else:
				prefix = "+"
				total = ((beginTime+duration) - nowTime) / 60
				if total <= 0:
					prefix = ""
				remaining = _(" (%s%d min)") % (prefix, total)
		t = localtime(beginTime)
		serviceref = ServiceReference(service) # for Servicename
		if config.plugins.epgsearch.picons.value:
			if getPiconsName:
				picon = getPiconName(service)
			else:
				picon = self.findPicon(service)
			if picon != "":
				self.picon.setPara((self.piconSize[0], self.piconSize[1], 1, 1, False, 1, '#000f0f0f'))
				self.picon.startDecode(picon, 0, 0, False)
				png = self.picon.getData()
				dy = int((self.height - self.piconSize[1])/2.)
				res = [
					None, # no private data needed
					(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r1.left(), r1.top()+ dy, self.piconSize[0], self.piconSize[1], png),
					(eListboxPythonMultiContent.TYPE_TEXT, r1.left() + dx, r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
					(eListboxPythonMultiContent.TYPE_TEXT, r2.left() + dx, r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
				]
			else:
				res = [
					None, # no private data needed
					(eListboxPythonMultiContent.TYPE_TEXT, r1.left() + dx, r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
					(eListboxPythonMultiContent.TYPE_TEXT, r2.left() + dx, r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
				]
		else:
			res = [
				None, # no private data needed
				(eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
				(eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
			]
		if config.plugins.epgsearch.picons.value:
			if rec1 or rec2:
				if rec1:
					clock_types = rec1
					# maybe Partnerbox too
					if rec2:
						if PartnerBoxZapRepIcons:
							clock_pic_partnerbox = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
						else:
							clock_pic_partnerbox = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				else:
					if PartnerBoxZapRepIcons:
						clock_pic = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
					else:
						clock_pic = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				if rec1 and rec2:
					# Partnerbox and local
					for i in range(len(clock_types)):
						res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
					res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + (i + 1) * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic_partnerbox),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.pboxDistance + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
				else:
					if rec1:
						for i in range(len(clock_types)):
							res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
						res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + dx + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
					else:
						res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + dx, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + self.pboxDistance + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
			else:
				res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + dx, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
		else:
			if rec1 or rec2:
				if rec1:
					clock_types = rec1
					# maybe Partnerbox too
					if rec2:
						if PartnerBoxZapRepIcons:
							clock_pic_partnerbox = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
						else:
							clock_pic_partnerbox = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				else:
					if PartnerBoxZapRepIcons:
						clock_pic = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId)
					else:
						clock_pic = getRemoteClockPixmap(self, service, beginTime, duration, eventId)
				if rec1 and rec2:
					# Partnerbox and local
					for i in range(len(clock_types)):
						res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
					res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + (i + 1) * self.space, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic_partnerbox),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
				else:
					if rec1:
						for i in range(len(clock_types)):
							res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.iconSize, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]]))
						res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
					else:
						res.extend((
						(eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic),
						(eListboxPythonMultiContent.TYPE_TEXT, r3.left() + self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)))
			else:
				res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))
		return res