def addTimerByEventID(self, param):
print "[WebComponents.Timer] addTimerByEventID", param
if param['sRef'] is None:
return ( False, _("Missing Parameter: sRef") )
if param['eventid'] is None:
return ( False, _("Missing Parameter: eventid") )
justplay = False
if param['justplay'] is not None:
if param['justplay'] == "1":
justplay = True
if not justplay and not config.misc.recording_allowed.value:
return (False, _("Recording is currently disabled!"))
location = preferredTimerPath()
if 'dirname' in param and param['dirname']:
location = param['dirname']
tags = []
if 'tags' in param and param['tags']:
tags = unescape(param['tags']).split(' ')
epgcache = eEPGCache.getInstance()
event = epgcache.lookupEventId(eServiceReference(param['sRef']), int(param['eventid']))
if event is None:
return ( False, _("EventId not found") )
(begin, end, name, description, eit) = parseEvent(event)
timer = RecordTimerEntry(ServiceReference(param['sRef']), begin , end, name, description, eit, False, justplay, AFTEREVENT.AUTO, dirname=location, tags=tags)
conflicts = self.recordtimer.record(timer)
if conflicts is None:
return ( True, _("Timer '%s' added") %(timer.name) )
else:
print "[WebComponents.Timer] editTimer conflicting Timers: %s" %(conflicts)
msg = ""
for timer in conflicts:
msg = "%s / %s" %(msg, timer.name)
return (False, _("Conflicting Timer(s) detected! %s") %(msg))
评论列表
文章目录