本文整理汇总了Python中RecordTimer.RecordTimerEntry.log_entries方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.log_entries方法的具体用法?Python RecordTimerEntry.log_entries怎么用?Python RecordTimerEntry.log_entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.log_entries方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [as 别名]
def addTimer(
session,
serviceref,
begin,
end,
name,
description,
disabled,
justplay,
afterevent,
dirname,
tags,
repeated,
logentries=None,
eit=0,
):
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)}
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 log_entries [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
}
示例3: UPDT
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [as 别名]
def UPDT(self, args):
# <id> <settings>
args = args.split(None, 1)
if len(args) != 2:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
try:
timerId = int(args[0])
except ValueError:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
list = self.getTimerList()
if timerId < 1:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
if len(list) >= timerId: oldTimer = list[timerId - 1]
else: oldTimer = None
try:
flags, channelid, datestring, beginstring, endstring, priority, lifetime, name, description = args[1].split(':')
flags = int(flags)
service_ref = ServiceReference(self.channelList[int(channelid)-1])
datestruct = strptime(datestring, '%Y-%m-%d')
timestruct = strptime(beginstring, '%H%M')
begin = mktime((datestruct.tm_year, datestruct.tm_mon, datestruct.tm_mday, timestruct.tm_hour, timestruct.tm_min, 0, datestruct.tm_wday, datestruct.tm_yday, -1))
timestruct = strptime(endstring, '%H%M')
end = mktime((datestruct.tm_year, datestruct.tm_mon, datestruct.tm_mday, timestruct.tm_hour, timestruct.tm_min, 0, datestruct.tm_wday, datestruct.tm_yday, -1))
del datestruct, timestruct
except ValueError as e:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
except KeyError as e:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
if end < begin: end += 86400 # Add 1 day, beware - this is evil and might not work correctly due to dst
timer = RecordTimerEntry(service_ref, begin, end, name, description, 0, disabled=flags & 1 == 0)
if oldTimer:
recordTimer.removeEntry(oldTimer)
timer.justplay = oldTimer.justplay
timer.afterEvent = oldTimer.afterEvent
timer.dirname = oldTimer.dirname
timer.tags = oldTimer.tags
timer.log_entries = oldTimer.log_entries
conflict = recordTimer.record(timer)
if conflict is None:
return self.sendTimerLine(timer, timerId, last=True)
else:
payload = "%d timer conflict detected, original timer lost." % (CODE_ERR_LOCAL,)
return self.sendLine(payload)
示例4: editTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [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 )
示例5: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [as 别名]
def addTimer(
session,
serviceref,
begin,
end,
name,
description,
disabled,
justplay,
afterevent,
dirname,
tags,
repeated,
logentries=None,
eit=0,
):
recordHandler = NavigationInstance.instance.RecordTimer
msgTimeout = config.plugins.skyrecorder.msgtimeout.value
if not dirname:
try:
dirname = config.plugins.skyrecorder.anytimefolder.value
except Exception:
dirname = preferredTimerPath()
print "mao1", 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
print "rrgggg"
conflicts = recordHandler.record(timer)
if conflicts:
errors = []
for conflict in conflicts:
errors.append(conflict.name)
print "duuuupppppppeeeeee"
return {"result": False, "message": "Conflicting Timer(s) detected! %s" % " / ".join(errors)}
except Exception, e:
print "adupppeee"
print e
return {"result": False, "message": "Could not add timer '%s'!" % name}
示例6: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [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
}
示例7: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [as 别名]
def addTimer(serviceref, begin, end, name, description, eit, disabled, dirname, vpsSettings, tags, logentries=None):
recordHandler = NavigationInstance.instance.RecordTimer
# config.plugins.serienRec.seriensubdir
# if not dirname:
# try:
# dirname = config.plugins.serienRec.savetopath.value
# except Exception:
# dirname = preferredTimerPath()
try:
try:
timer = RecordTimerEntry(
ServiceReference(serviceref),
begin,
end,
name,
description,
eit,
disabled=disabled,
justplay=config.plugins.serienRec.justplay.value,
zapbeforerecord=config.plugins.serienRec.zapbeforerecord.value,
justremind=config.plugins.serienRec.justremind.value,
afterEvent=int(config.plugins.serienRec.afterEvent.value),
dirname=dirname)
except Exception:
sys.exc_clear()
timer = RecordTimerEntry(
ServiceReference(serviceref),
begin,
end,
name,
description,
eit,
disabled,
config.plugins.serienRec.justplay.value | config.plugins.serienRec.justremind.value,
afterEvent=int(config.plugins.serienRec.afterEvent.value),
dirname=dirname,
tags=None)
timer.repeated = 0
# Add tags
timerTags = timer.tags[:]
timerTags.append('SerienRecorder')
if len(tags) != 0:
timerTags.extend(tags)
timer.tags = timerTags
# If eit = 0 the VPS plugin won't work properly for this timer, so we have to disable VPS in this case.
if SerienRecorder.VPSPluginAvailable and eit is not 0:
timer.vpsplugin_enabled = vpsSettings[0]
timer.vpsplugin_overwrite = timer.vpsplugin_enabled and (not vpsSettings[1])
if logentries:
timer.log_entries = logentries
timer.log(0, "[SerienRecorder] Timer angelegt")
conflicts = recordHandler.record(timer)
if conflicts:
errors = []
for conflict in conflicts:
errors.append(conflict.name)
return {
"result": False,
"message": "In Konflikt stehende Timer vorhanden! %s" % " / ".join(errors)
}
except Exception, e:
print "[%s] <%s>" % (__name__, e)
return {
"result": False,
"message": "Timer konnte nicht angelegt werden '%s'!" % e
}
示例8: RecordTimerEntry
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import log_entries [as 别名]
except ValueError, e:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
except KeyError, e:
payload = "%d argument error" % (CODE_SYNTAX,)
return self.sendLine(payload)
if end < begin: end += 86400 # Add 1 day, beware - this is evil and might not work correctly due to dst
timer = RecordTimerEntry(service_ref, begin, end, name, description, 0, disabled=flags & 1 == 0)
if oldTimer:
recordTimer.removeEntry(oldTimer)
timer.justplay = oldTimer.justplay
timer.afterEvent = oldTimer.afterEvent
timer.dirname = oldTimer.dirname
timer.tags = oldTimer.tags
timer.log_entries = oldTimer.log_entries
conflict = recordTimer.record(timer)
if conflict is None:
return self.sendTimerLine(timer, timerId, last=True)
else:
payload = "%d timer conflict detected, original timer lost." % (CODE_ERR_LOCAL,)
return self.sendLine(payload)
def NEWT(self, args):
self.UPDT("999999999 " + args)
def MODT(self, args):
# <id> on | off | <settings>
args = args.split(None, 1)
if len(args) != 2: