def isInRemoteTimer(self, begin, duration, service):
	time_match = 0
	chktime = None
	chktimecmp = None
	chktimecmp_end = None
	end = begin + duration
	serviceref = getServiceRef(service)
	for x in partnerboxfunctions.remote_timer_list:
		if x.servicereference.upper() == serviceref.upper():
			if x.repeated != 0:
				if chktime is None:
					chktime = localtime(begin)
					chktimecmp = chktime.tm_wday * 1440 + chktime.tm_hour * 60 + chktime.tm_min
					chktimecmp_end = chktimecmp + (duration / 60)
				time = localtime(x.timebegin)
				for y in range(7):
					if x.repeated & (2 ** y):
						timecmp = y * 1440 + time.tm_hour * 60 + time.tm_min
						if timecmp <= chktimecmp < (timecmp + ((x.timeend - x.timebegin) / 60)):
							time_match = ((timecmp + ((x.timeend - x.timebegin) / 60)) - chktimecmp) * 60
						elif chktimecmp <= timecmp < chktimecmp_end:
							time_match = (chktimecmp_end - timecmp) * 60
			else:
				if begin <= x.timebegin <= end:
					diff = end - x.timebegin
					if time_match < diff:
						time_match = diff
				elif x.timebegin <= begin <= x.timeend:
					diff = x.timeend - begin
					if time_match < diff:
						time_match = diff
			if time_match:
				break
	return time_match
def getRemoteClockPixmap(self, refstr, beginTime, duration, eventId):
	pre_clock = 1
	post_clock = 2
	clock_type = 0
	endTime = beginTime + duration
	refstr = getServiceRef(refstr)
	ref_str = ':'.join(str(refstr).split(':')[:11])
	for x in partnerboxfunctions.remote_timer_list:
		servicereference_str = ':'.join(str(x.servicereference).split(':')[:11])
		if servicereference_str.upper() == ref_str.upper():
			if x.eventId == eventId:
				return self.remote_clock_pixmap
			beg = x.timebegin
			end = x.timeend
			if beginTime > beg and beginTime < end and endTime > end:
				clock_type |= pre_clock
			elif beginTime < beg and endTime > beg and endTime < end:
				clock_type |= post_clock
	if clock_type == 0:
		return self.remote_clock_add_pixmap
	elif clock_type == pre_clock:
		return self.remote_clock_pre_pixmap
	elif clock_type == post_clock:
		return self.remote_clock_post_pixmap
	else:
		return self.remote_clock_prepost_pixmap
def getRemoteClockPixmap(self, refstr, beginTime, duration, eventId):
    pre_clock = 1
    post_clock = 2
    clock_type = 0
    endTime = beginTime + duration
    refstr = getServiceRef(refstr)
    ref_str = ":".join(str(refstr).split(":")[:11])
    for x in partnerboxfunctions.remote_timer_list:
        servicereference_str = ":".join(str(x.servicereference).split(":")[:11])
        if servicereference_str.upper() == ref_str.upper():
            if x.eventId == eventId:
                return self.remote_clock_pixmap
            beg = x.timebegin
            end = x.timeend
            if beginTime > beg and beginTime < end and endTime > end:
                clock_type |= pre_clock
            elif beginTime < beg and endTime > beg and endTime < end:
                clock_type |= post_clock
    if clock_type == 0:
        return self.remote_clock_add_pixmap
    elif clock_type == pre_clock:
        return self.remote_clock_pre_pixmap
    elif clock_type == post_clock:
        return self.remote_clock_post_pixmap
    else:
        return self.remote_clock_prepost_pixmap
def isInRemoteTimer(self, begin, duration, service):
    time_match = 0
    chktime = None
    chktimecmp = None
    chktimecmp_end = None
    end = begin + duration
    serviceref = getServiceRef(service)
    for x in partnerboxfunctions.remote_timer_list:
        if x.servicereference.upper() == serviceref.upper():
            if x.repeated != 0:
                if chktime is None:
                    chktime = localtime(begin)
                    chktimecmp = chktime.tm_wday * 1440 + chktime.tm_hour * 60 + chktime.tm_min
                    chktimecmp_end = chktimecmp + (duration / 60)
                time = localtime(x.timebegin)
                for y in range(7):
                    if x.repeated & (2 ** y):
                        timecmp = y * 1440 + time.tm_hour * 60 + time.tm_min
                        if timecmp <= chktimecmp < (timecmp + ((x.timeend - x.timebegin) / 60)):
                            time_match = ((timecmp + ((x.timeend - x.timebegin) / 60)) - chktimecmp) * 60
                        elif chktimecmp <= timecmp < chktimecmp_end:
                            time_match = (chktimecmp_end - timecmp) * 60
            else:
                if begin <= x.timebegin <= end:
                    diff = end - x.timebegin
                    if time_match < diff:
                        time_match = diff
                elif x.timebegin <= begin <= x.timeend:
                    diff = x.timeend - begin
                    if time_match < diff:
                        time_match = diff
            if time_match:
                break
    return time_match
def getRemoteClockPixmap(self, refstr, beginTime, duration, eventId):
	serviceref = getServiceRef(refstr)
	pre_clock = 1
	post_clock = 2
	clock_type = 0
	endTime = beginTime + duration
	for x in partnerboxfunctions.remote_timer_list:
		if x.servicereference.upper() == serviceref.upper():
			if x.eventId == eventId:
				return self.remote_clock_pixmap
			beg = x.timebegin
			end = x.timeend
			if beginTime > beg and beginTime < end and endTime > end:
				clock_type |= pre_clock
			elif beginTime < beg and endTime > beg and endTime < end:
				clock_type |= post_clock
	if clock_type == 0:
		return self.remote_clock_add_pixmap
	elif clock_type == pre_clock:
		return self.remote_clock_pre_pixmap
	elif clock_type == post_clock:
		return self.remote_clock_post_pixmap
	else:
		return self.remote_clock_prepost_pixmap
def getRemoteClockPixmap(self, refstr, beginTime, duration, eventId):
    serviceref = getServiceRef(refstr)
    pre_clock = 1
    post_clock = 2
    clock_type = 0
    endTime = beginTime + duration
    for x in partnerboxfunctions.remote_timer_list:
        if x.servicereference.upper() == serviceref.upper():
            if x.eventId == eventId:
                return self.remote_clock_pixmap
            beg = x.timebegin
            end = x.timeend
            if beginTime > beg and beginTime < end and endTime > end:
                clock_type |= pre_clock
            elif beginTime < beg and endTime > beg and endTime < end:
                clock_type |= post_clock
    if clock_type == 0:
        return self.remote_clock_add_pixmap
    elif clock_type == pre_clock:
        return self.remote_clock_pre_pixmap
    elif clock_type == post_clock:
        return self.remote_clock_post_pixmap
    else:
        return self.remote_clock_prepost_pixmap