+ if dosave:
+ self.saveTimer()
+ return None
+
+ def isInTimer(self, eventid, begin, duration, service):
+ time_match = 0
+ chktime = None
+ chktimecmp = None
+ chktimecmp_end = None
+ end = begin + duration
+ refstr = str(service)
+ for x in self.timer_list:
+ check = x.service_ref.ref.toString() == refstr
+ if not check:
+ sref = x.service_ref.ref
+ parent_sid = sref.getUnsignedData(5)
+ parent_tsid = sref.getUnsignedData(6)
+ if parent_sid and parent_tsid: # check for subservice
+ sid = sref.getUnsignedData(1)
+ tsid = sref.getUnsignedData(2)
+ sref.setUnsignedData(1, parent_sid)
+ sref.setUnsignedData(2, parent_tsid)
+ sref.setUnsignedData(5, 0)
+ sref.setUnsignedData(6, 0)
+ check = sref.toCompareString() == refstr
+ num = 0
+ if check:
+ check = False
+ event = eEPGCache.getInstance().lookupEventId(sref, eventid)
+ num = event and event.getNumOfLinkageServices() or 0
+ sref.setUnsignedData(1, sid)
+ sref.setUnsignedData(2, tsid)
+ sref.setUnsignedData(5, parent_sid)
+ sref.setUnsignedData(6, parent_tsid)
+ for cnt in range(num):
+ subservice = event.getLinkageService(sref, cnt)
+ if sref.toCompareString() == subservice.toCompareString():
+ check = True
+ break
+ if check:
+ 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.begin)
+ for y in (0, 1, 2, 3, 4, 5, 6):
+ if x.repeated & (2 ** y):
+ timecmp = y * 1440 + time.tm_hour * 60 + time.tm_min
+ if timecmp <= chktimecmp < (timecmp + ((x.end - x.begin) / 60)):
+ time_match = ((timecmp + ((x.end - x.begin) / 60)) - chktimecmp) * 60
+ elif chktimecmp <= timecmp < chktimecmp_end:
+ time_match = (chktimecmp_end - timecmp) * 60
+ else: #if x.eit is None:
+ if begin <= x.begin <= end:
+ diff = end - x.begin
+ if time_match < diff:
+ time_match = diff
+ elif x.begin <= begin <= x.end:
+ diff = x.end - begin
+ if time_match < diff:
+ time_match = diff
+ if time_match:
+ break
+ return time_match