本文整理汇总了Python中RecordTimer.RecordTimerEntry.vpsplugin_time方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.vpsplugin_time方法的具体用法?Python RecordTimerEntry.vpsplugin_time怎么用?Python RecordTimerEntry.vpsplugin_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.vpsplugin_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_time [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: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_time [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
}