本文整理汇总了Python中RecordTimer.RecordTimerEntry.processRepeated方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.processRepeated方法的具体用法?Python RecordTimerEntry.processRepeated怎么用?Python RecordTimerEntry.processRepeated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.processRepeated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: editTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import processRepeated [as 别名]
#.........这里部分代码省略.........
pass
justplay = False #Default to: Record
if 'justplay' in param:
if param['justplay'] == "1":
justplay = True
afterEvent = 3 #Default to Afterevent: Auto
if 'afterevent' in param:
if (param['afterevent'] == "0") or (param['afterevent'] == "1") or (param['afterevent'] == "2"):
afterEvent = int(param['afterevent'])
dirname = preferredTimerPath()
if 'dirname' in param and param['dirname']:
dirname = param['dirname']
tags = []
if 'tags' in param and param['tags']:
tags = unescape(param['tags']).split(' ')
delold = 0
if 'deleteOldOnSave' in param:
delold = int(param['deleteOldOnSave'])
#Try to edit an existing Timer
if delold:
if 'channelOld' in param and param['channelOld']:
channelOld = ServiceReference(param['channelOld'])
else:
return ( False, "Missing Parameter: channelOld" )
# We do need all of the following Parameters, too, for being able of finding the Timer.
# Therefore so we can neither use default values in this part nor can we
# continue if a parameter is missing
if 'beginOld' not in param:
return ( False, "Missing Parameter: beginOld" )
beginOld = int(param['beginOld'])
if 'endOld' not in param:
return ( False, "Missing Parameter: endOld" )
endOld = int(param['endOld'])
#let's try to find the timer
try:
for timer in self.__recordtimer.timer_list + self.__recordtimer.processed_timers:
if str(timer.service_ref) == str(channelOld):
if int(timer.begin) == beginOld:
if int(timer.end) == endOld:
#we've found the timer we've been searching for
#Delete the old entry
self.__recordtimer.removeEntry(timer)
old = timer
timer = RecordTimerEntry(service_ref, begin, end, name, description, 0, disabled, justplay, afterEvent, dirname=dirname, tags=tags)
timer.repeated = repeated
timer.log_entries = old.log_entries
timer.processRepeated()
#send the changed timer back to enigma2 and hope it's good
conflicts = self.__recordtimer.record(timer)
if conflicts is None:
print "[WebComponents.Timer] editTimer: Timer changed!"
return ( True, "Timer '%s' changed" %(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))
except Exception:
#obviously some value was not good, return an error
return ( False, "Changing the timer for '%s' failed!" % name )
return ( False, "Could not find timer '%s' with given start and end time!" % name )
#Try adding a new Timer
try:
#Create a new instance of recordtimerentry
timer = RecordTimerEntry(service_ref, begin, end, name, description, 0, disabled, justplay, afterEvent, dirname=dirname, tags=tags)
timer.repeated = repeated
#add the new timer
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))
except Exception, e:
#something went wrong, most possibly one of the given paramater-values was wrong
print "[WebComponents.Timer] editTimer exception: %s" %(e)
return ( False, "Could not add timer '%s'!" % name )