本文整理汇总了Python中RecordTimer.RecordTimerEntry.vpsplugin_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.vpsplugin_enabled方法的具体用法?Python RecordTimerEntry.vpsplugin_enabled怎么用?Python RecordTimerEntry.vpsplugin_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.vpsplugin_enabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [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: program_seek_vps_multiple_closed
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
def program_seek_vps_multiple_closed(self, retval):
self.program_seek_vps_multiple_started = -1
self.found_vps_multiple = sorted(self.found_vps_multiple)
for evt_begin, evt_id, evt in self.found_vps_multiple:
# eigenen Timer überprüfen, wenn Zeiten nicht überschrieben werden dürfen
if not self.timer.vpsplugin_overwrite and evt_begin <= self.timer.end:
self.next_events.append(evt_id)
self.timer.log(0, "[VPS] add event_id "+ str(evt_id))
else:
canbeadded = True
evt_begin += 60
evt_end = evt.getBeginTime() + evt.getDuration() - 60
now = time()
for checktimer in self.session.nav.RecordTimer.timer_list:
if checktimer == self.timer:
continue
if (checktimer.begin - now) > 3600*24:
break
if checktimer.service_ref.ref.toCompareString() == self.timer.service_ref.ref.toCompareString() or checktimer.service_ref.ref.toCompareString() == self.rec_ref.toCompareString():
if checktimer.begin <= evt_begin and checktimer.end >= evt_end:
if not checktimer.vpsplugin_enabled or not checktimer.vpsplugin_overwrite:
canbeadded = False
# manuell angelegter Timer mit VPS
if checktimer.vpsplugin_enabled and checktimer.name == "" and checktimer.vpsplugin_time is not None:
checktimer.eit = evt_id
checktimer.name = evt.getEventName()
checktimer.description = evt.getShortDescription()
checktimer.vpsplugin_time = None
checktimer.log(0, "[VPS] changed timer (found same PDC-Time as in other VPS-recording)")
canbeadded = False
break
if canbeadded:
newevent_data = parseEvent(evt)
newEntry = RecordTimerEntry(ServiceReference(self.rec_ref), *newevent_data)
newEntry.vpsplugin_enabled = True
newEntry.vpsplugin_overwrite = True
newEntry.log(0, "[VPS] added this timer (found same PDC-Time as in other VPS-recording)")
# Wenn kein Timer-Konflikt auftritt, wird der Timer angelegt.
NavigationInstance.instance.RecordTimer.record(newEntry)
示例3: check_and_add_event
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
def check_and_add_event(self, neweventid):
if not config.plugins.vps.allow_seeking_multiple_pdc.value:
return
epgcache = eEPGCache.getInstance()
evt = epgcache.lookupEventId(self.rec_ref, neweventid)
if evt:
evt_begin = evt.getBeginTime() + 60
evt_end = evt.getBeginTime() + evt.getDuration() - 60
if evt_begin < self.timer.begin:
return
for checktimer in self.session.nav.RecordTimer.timer_list:
if checktimer == self.timer:
continue
if (checktimer.begin - evt_begin) > 3600*2:
break
compareString = checktimer.service_ref.ref.toCompareString()
if compareString == self.timer.service_ref.ref.toCompareString() or compareString == self.rec_ref.toCompareString():
if checktimer.eit == neweventid:
return
if checktimer.begin <= evt_begin and checktimer.end >= evt_end:
if checktimer.vpsplugin_enabled is None or not checktimer.vpsplugin_enabled:
return
# manuell angelegter Timer mit VPS
if checktimer.name == "" and checktimer.vpsplugin_time is not None:
checktimer.eit = neweventid
checktimer.name = evt.getEventName()
checktimer.description = evt.getShortDescription()
checktimer.vpsplugin_time = None
checktimer.log(0, "[VPS] changed timer (found same PDC-Time as in other VPS-recording)")
return
# eigenen Timer überprüfen, wenn Zeiten nicht überschrieben werden dürfen
if not self.timer.vpsplugin_overwrite and evt_begin <= self.timer.end:
check_already_existing = [x for (x,y) in self.next_events if y == neweventid]
if len(check_already_existing) > 0:
start = check_already_existing.pop()
if start == evt_begin:
return
else:
self.next_events.remove( (start, neweventid) )
self.timer.log(0, "[VPS] delete event_id "+ str(neweventid) +" because of delay "+ str(evt_begin - start))
self.next_events.append( (evt_begin, neweventid) )
self.next_events = sorted(self.next_events)
self.timer.log(0, "[VPS] add event_id "+ str(neweventid))
else:
newevent_data = parseEvent(evt)
newEntry = RecordTimerEntry(ServiceReference(self.rec_ref), *newevent_data)
newEntry.vpsplugin_enabled = True
newEntry.vpsplugin_overwrite = True
newEntry.dirname = self.timer.dirname
newEntry.log(0, "[VPS] added this timer (found same PDC-Time as in other VPS-recording)")
# Wenn kein Timer-Konflikt auftritt, wird der Timer angelegt.
res = NavigationInstance.instance.RecordTimer.record(newEntry)
self.timer.log(0, "[VPS] added another timer, res "+ str(res))
示例4: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
#.........这里部分代码省略.........
else:
msg = "[AutoTimer] AutoTimer modification not allowed for timer %s because conflicts or double timer." % (newEntry.name)
doLog(msg)
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)
示例5: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
#.........这里部分代码省略.........
modified += 1
if allow_modify:
self.modifyTimer(newEntry, name, shortdesc, begin, end, serviceref, eit)
msg = "[AutoTimer] AutoTimer modified timer: %s ." % (newEntry.name)
doLog(msg)
newEntry.log(501, msg)
else:
msg = "[AutoTimer] AutoTimer modification not allowed for timer: %s ." % (newEntry.name)
doLog(msg)
else:
newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, name, shortdesc, eit)
msg = "[AutoTimer] Try to add new timer based on AutoTimer %s." % (timer.name)
doLog(msg)
newEntry.log(500, msg)
# 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 = dest
newEntry.calculateFilename()
newEntry.justplay = timer.justplay
newEntry.vpsplugin_enabled = timer.vps_enabled
newEntry.vpsplugin_overwrite = timer.vps_overwrite
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)
else:
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)
# Try to add timer
conflicts = recordHandler.record(newEntry)
if conflicts:
# Maybe use newEntry.log
conflictString += ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in conflicts])
doLog("conflict with %s detected" % (conflictString))
示例6: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
#.........这里部分代码省略.........
oldExists = True
# print("[AutoTimer] We found a timer with same StartTime, skipping event")
break
if timer.avoidDuplicateDescription >= 2:
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))
# 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
tags = timer.tags[:]
if config.plugins.autotimer.add_autotimer_to_tags.value:
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(" ", "_")
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
newEntry.log(504, "[AutoTimer] Try to add similar Timer because of conflicts with %s." % (conflictString))
# Try to add timer
conflicts = recordHandler.record(newEntry)
if conflicts:
# Maybe use newEntry.log
conflictString += ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in conflicts])
print("[AutoTimer] conflict with %s detected" % (conflictString))
示例7: parseEPG
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
#.........这里部分代码省略.........
# Some channels indicate replays in the extended descriptions
# If the similarity percent is higher then 0.8 it is a very close match
if ( len(extdesc) == len(rtimer.extdesc) and extdesc == rtimer.extdesc ) \
or ( 0.8 < SequenceMatcher(lambda x: x == " ",extdesc, rtimer.extdesc).ratio() ):
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))
# 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.tags = timer.tags
newEntry.vpsplugin_enabled = timer.vps_enabled
newEntry.vpsplugin_overwrite = timer.vps_overwrite
if oldExists:
# XXX: this won't perform a sanity check, but do we actually want to do so?
recordHandler.timeChanged(newEntry)
else:
conflictString = ""
if similarTimer:
conflictString = similar[eit].conflictString
newEntry.log(504, "[AutoTimer] Try to add similar Timer because of conflicts with %s." % (conflictString))
# Try to add timer
conflicts = recordHandler.record(newEntry)
if conflicts:
conflictString += ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in conflicts])
print("[AutoTimer] conflict with %s detected" % (conflictString))
if conflicts and config.plugins.autotimer.addsimilar_on_conflict.value:
# We start our search right after our actual index
# Attention we have to use a copy of the list, because we have to append the previous older matches
lepgm = len(epgmatches)
for i in xrange(lepgm):
servicerefS, eitS, nameS, beginS, durationS, shortdescS, extdescS = epgmatches[ (i+idx+1)%lepgm ]
if shortdesc == shortdescS:
# Some channels indicate replays in the extended descriptions
# If the similarity percent is higher then 0.8 it is a very close match
if ( len(extdesc) == len(extdescS) and extdesc == extdescS ) \
or ( 0.8 < SequenceMatcher(lambda x: x == " ",extdesc, extdescS).ratio() ):
# Check if the similar is already known
if eitS not in similar:
print("[AutoTimer] Found similar Timer: " + name)
示例8: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [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
}
示例9: parseEPG
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [as 别名]
#.........这里部分代码省略.........
# Initialize
newEntry = None
oldExists = False
# Check for double Timers
# We first check eit and if user wants us to guess event based on time
# we try this as backup. The allowed diff should be configurable though.
for rtimer in recorddict.get(serviceref, ()):
if rtimer.eit == eit or config.plugins.autotimer.try_guessing.value and getTimeDiff(rtimer, begin, end) > ((duration/10)*8):
oldExists = True
# Abort if we don't want to modify timers or timer is repeated
if config.plugins.autotimer.refresh.value == "none":
print "[AutoTimer] Won't modify existing timer because no modification allowed"
break
if rtimer.repeated:
print "[AutoTimer] Won't modify existing timer because repeated timer"
break
if hasattr(rtimer, "isAutoTimer"):
rtimer.log(501, "[AutoTimer] AutoTimer %s modified this automatically generated timer." % (timer.name,))
else:
if config.plugins.autotimer.refresh.value != "all":
print "[AutoTimer] Won't modify existing timer because it's no timer set by us"
break
rtimer.log(501, "[AutoTimer] Warning, AutoTimer %s messed with a timer which might not belong to it." % (timer.name,))
newEntry = rtimer
modified += 1
# Modify values saved in timer
newEntry.name = evtInfo.name
newEntry.description = evtInfo.shortDescription
newEntry.begin = int(begin)
newEntry.end = int(end)
newEntry.service_ref = ServiceReference(serviceref)
break
elif timer.avoidDuplicateDescription >= 1 and self.normalizeRecordTimer(rtimer) == evtInfo:
oldExists = True
print "[AutoTimer] We found a timer with same service and description, skipping event"
break
# We found no timer we want to edit
if newEntry is None:
# But there is a match
if oldExists:
continue
# We want to search for possible doubles
if timer.avoidDuplicateDescription >= 2 and self.isEventInList(evtInfo, recorddict, self.normalizeRecordTimer):
print "[AutoTimer] We found a timer with same description, skipping event"
continue
if timer.checkCounter(timestamp):
print "[AutoTimer] Not adding new timer because counter is depleted."
continue
newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, evtInfo.name, evtInfo.shortDescription, eit)
newEntry.log(500, "[AutoTimer] Adding new timer based on AutoTimer %s." % (timer.name,))
# Mark this entry as AutoTimer (only AutoTimers will have this Attribute set)
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.tags = timer.tags
newEntry.vpsplugin_enabled = timer.vps_enabled
newEntry.vpsplugin_overwrite = timer.vps_overwrite
if oldExists:
# XXX: this won't perform a sanity check, but do we actually want to do so?
NavigationInstance.instance.RecordTimer.timeChanged(newEntry)
else:
conflicts = NavigationInstance.instance.RecordTimer.record(newEntry)
if conflicts and config.plugins.autotimer.disabled_on_conflict.value:
conflictString = ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in conflicts])
newEntry.log(503, "[AutoTimer] Timer disabled because of conflicts with %s." % (conflictString,))
del conflictString
newEntry.disabled = True
# We might want to do the sanity check locally so we don't run it twice - but I consider this workaround a hack anyway
conflicts = NavigationInstance.instance.RecordTimer.record(newEntry)
conflicting.append((evtInfo.name, begin, end, serviceref, timer.name))
if conflicts is None:
timer.decrementCounter()
new += 1
recorddict.setdefault(serviceref, []).append(newEntry)
else:
conflicting.append((evtInfo.name, begin, end, serviceref, timer.name))
return (total, new, modified, timers, conflicting)
示例10: addTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import vpsplugin_enabled [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
}