本文整理汇总了Python中RecordTimer.RecordTimerEntry.always_zap方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.always_zap方法的具体用法?Python RecordTimerEntry.always_zap怎么用?Python RecordTimerEntry.always_zap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.always_zap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import always_zap [as 别名]
def addTimer(session, serviceref, begin, end, name, description, disabled, justplay, afterevent, dirname, tags, repeated, vpsinfo=None, logentries=None, eit=0, always_zap=-1):
serviceref = unquote(serviceref)
rt = session.nav.RecordTimer
print "mao1", dirname
if not dirname:
dirname = preferredTimerPath()
print "mao2", dirname
try:
timer = RecordTimerEntry(
ServiceReference(serviceref),
begin,
end,
name,
description,
eit,
disabled,
justplay,
afterevent,
dirname=dirname,
tags=tags)
timer.repeated = repeated
if logentries:
timer.log_entries = logentries
conflicts = rt.record(timer)
if conflicts:
errors = []
for conflict in conflicts:
errors.append(conflict.name)
return {
"result": False,
"message": _("Conflicting Timer(s) detected! %s") % " / ".join(errors)
}
#VPS
if vpsinfo is not None:
timer.vpsplugin_enabled = vpsinfo["vpsplugin_enabled"]
timer.vpsplugin_overwrite = vpsinfo["vpsplugin_overwrite"]
timer.vpsplugin_time = vpsinfo["vpsplugin_time"]
if always_zap <> -1:
if hasattr(timer,"always_zap"):
timer.always_zap = always_zap == 1
except Exception, e:
print e
return {
"result": False,
"message": _("Could not add timer '%s'!") % name
}
示例2: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import always_zap [as 别名]
#.........这里部分代码省略.........
if oldEntry:
self.setOldTimer(newEntry, oldEntry)
doLog("[AutoTimer] conflict for modification timer %s detected return to old timer" % (newEntry.name))
continue
else:
msg = "[AutoTimer] AutoTimer modification not allowed for timer: %s ." % (newEntry.name)
doLog(msg)
continue
else:
newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, name, shortdesc, eit)
newAT = True
msg = "[AutoTimer] Try to add new timer based on AutoTimer %s." % (timer.name)
doLog(msg)
newEntry.log(500, msg)
# Mark this entry as AutoTimer
newEntry.flags.add("autotimer")
# Apply afterEvent
if timer.hasAfterEvent():
afterEvent = timer.getAfterEventTimespan(localtime(end))
if afterEvent is None:
afterEvent = timer.getAfterEvent()
if afterEvent is not None:
newEntry.afterEvent = afterEvent
newEntry.dirname = dest
newEntry.calculateFilename()
newEntry.justplay = timer.justplay
newEntry.vpsplugin_enabled = timer.vps_enabled
newEntry.vpsplugin_overwrite = timer.vps_overwrite
newEntry.conflict_detection = timer.conflict_detection
newEntry.always_zap = timer.always_zap
newEntry.zap_wakeup = timer.zap_wakeup
tags = timer.tags[:]
if config.plugins.autotimer.add_autotimer_to_tags.value:
if 'AutoTimer' not in tags:
tags.append('AutoTimer')
if config.plugins.autotimer.add_name_to_tags.value:
tagname = timer.name.strip()
if tagname:
tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
if tagname not in tags:
tags.append(tagname)
newEntry.tags = tags
if oldExists and newAT is None:
if self.isResolvedConflict(newEntry):
recordHandler.timeChanged(newEntry)
else:
if oldEntry:
self.setOldTimer(newEntry, oldEntry)
doLog("[AutoTimer] rechecking - conflict for timer %s detected return to old timer" % (newEntry.name))
continue
elif newAT:
newAT = newEntry
conflictString = ""
if similarTimer:
conflictString = similardict[eit].conflictString
msg = "[AutoTimer] Try to add similar Timer because of conflicts with %s." % (conflictString)
doLog(msg)
newEntry.log(504, msg)
# add new timer in AT timer list
示例3: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import always_zap [as 别名]
def addTimer(session, serviceref, begin, end, name, description, disabled, justplay, afterevent, dirname, tags, repeated, vpsinfo=None, logentries=None, eit=0, always_zap=-1):
rt = session.nav.RecordTimer
if not dirname:
dirname = preferredTimerPath()
try:
timer = RecordTimerEntry(
ServiceReference(serviceref),
begin,
end,
name,
description,
eit,
disabled,
justplay,
afterevent,
dirname=dirname,
tags=tags)
timer.repeated = repeated
if logentries:
timer.log_entries = logentries
conflicts = rt.record(timer)
if conflicts:
errors = []
conflictinfo = []
for conflict in conflicts:
errors.append(conflict.name)
conflictinfo.append({
"serviceref": str(conflict.service_ref),
"servicename": conflict.service_ref.getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''),
"name": conflict.name,
"begin" : conflict.begin,
"end" : conflict.end,
"realbegin":strftime("%d.%m.%Y %H:%M", (localtime(float(conflict.begin)))),
"realend":strftime("%d.%m.%Y %H:%M", (localtime(float(conflict.end))))
})
return {
"result": False,
"message": _("Conflicting Timer(s) detected! %s") % " / ".join(errors),
"conflicts" : conflictinfo
}
#VPS
if vpsinfo is not None:
timer.vpsplugin_enabled = vpsinfo["vpsplugin_enabled"]
timer.vpsplugin_overwrite = vpsinfo["vpsplugin_overwrite"]
timer.vpsplugin_time = vpsinfo["vpsplugin_time"]
if always_zap <> -1:
if hasattr(timer,"always_zap"):
timer.always_zap = always_zap == 1
except Exception, e:
print e
return {
"result": False,
"message": _("Could not add timer '%s'!") % name
}
示例4: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import always_zap [as 别名]
#.........这里部分代码省略.........
if self.checkSimilarity(timer, name, rtimer.name, shortdesc, rtimer.description, extdesc, rtimer.extdesc ):
oldExists = True
# print("[AutoTimer] We found a timer (any service) with same description, skipping event")
break
if oldExists:
continue
if timer.checkCounter(timestamp):
print("[AutoTimer] Not adding new timer because counter is depleted.")
continue
newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, name, shortdesc, eit)
newEntry.log(500, "[AutoTimer] Try to add new timer based on AutoTimer %s." % (timer.name))
newEntry.log(509, "[AutoTimer] Timer start on: %s" % ctime(begin))
# Mark this entry as AutoTimer (only AutoTimers will have this Attribute set)
# It is only temporarily, after a restart it will be lost,
# because it won't be stored in the timer xml file
newEntry.isAutoTimer = True
# Apply afterEvent
if timer.hasAfterEvent():
afterEvent = timer.getAfterEventTimespan(localtime(end))
if afterEvent is None:
afterEvent = timer.getAfterEvent()
if afterEvent is not None:
newEntry.afterEvent = afterEvent
newEntry.dirname = timer.destination
newEntry.justplay = timer.justplay
newEntry.vpsplugin_enabled = timer.vps_enabled
newEntry.vpsplugin_overwrite = timer.vps_overwrite
if hasattr(timer, 'always_zap') and hasattr(newEntry, 'always_zap'):
newEntry.always_zap = timer.always_zap
tags = timer.tags[:]
if config.plugins.autotimer.add_autotimer_to_tags.value:
if TAG not in tags:
tags.append(TAG)
if config.plugins.autotimer.add_name_to_tags.value:
tagname = timer.name.strip()
if tagname:
tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
if tagname not in tags:
tags.append(tagname)
newEntry.tags = tags
if oldExists:
# XXX: this won't perform a sanity check, but do we actually want to do so?
recordHandler.timeChanged(newEntry)
if renameTimer is not None and timer.series_labeling:
renameTimer(newEntry, name, evtBegin, evtEnd)
else:
conflictString = ""
if similarTimer:
conflictString = similardict[eit].conflictString
msg = "[AutoTimer] Try to add similar Timer because of conflicts with %s." % (conflictString)
print(msg)
newEntry.log(504, msg)
# Try to add timer
conflicts = recordHandler.record(newEntry)
if conflicts and not timer.hasOffset() and not config.recording.margin_before.value and not config.recording.margin_after.value and len(conflicts) > 1: