本文整理汇总了Python中RecordTimer.RecordTimerEntry.conflictString方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.conflictString方法的具体用法?Python RecordTimerEntry.conflictString怎么用?Python RecordTimerEntry.conflictString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.conflictString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import conflictString [as 别名]
#.........这里部分代码省略.........
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
atDoubleTimer = False
refstr = ':'.join(newEntry.service_ref.ref.toString().split(':')[:11])
for at in addNewTimers:
needed_ref = ':'.join(at.service_ref.ref.toString().split(':')[:11]) == refstr
if needed_ref and at.eit == newEntry.eit and (newEntry.begin < at.begin <= newEntry.end or at.begin <= newEntry.begin <= at.end):
atDoubleTimer = True
break
if atDoubleTimer:
doLog("[AutoTimer] ignore double new auto timer %s." % newEntry.name)
continue
else:
addNewTimers.append(newEntry)
# 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("[AutoTimer] conflict with %s detected" % (conflictString))
if 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)
示例2: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import conflictString [as 别名]
#.........这里部分代码省略.........
# 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))
if 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 self.checkSimilarity(timer, name, nameS, shortdesc, shortdescS, extdesc, extdescS, force=True ):
# Check if the similar is already known
if eitS not in similardict:
print("[AutoTimer] Found similar Timer: " + name)
# Store the actual and similar eit and conflictString, so it can be handled later
newEntry.conflictString = conflictString
similardict[eit] = newEntry
similardict[eitS] = newEntry
similarTimer = True
if beginS <= evtBegin:
# Event is before our actual epgmatch so we have to append it to the epgmatches list
epgmatches.append((servicerefS, eitS, nameS, beginS, durationS, shortdescS, extdescS))
# If we need a second similar it will be found the next time
else:
similarTimer = False
newEntry = similardict[eitS]
break
if conflicts is None:
timer.decrementCounter()
new += 1
newEntry.extdesc = extdesc
timerdict[serviceref].append(newEntry)
if renameTimer is not None and timer.series_labeling:
renameTimer(newEntry, name, evtBegin, evtEnd)
# Similar timers are in new timers list and additionally in similar timers list
if similarTimer:
similars.append((name, begin, end, serviceref, timer.name))
similardict.clear()
# Don't care about similar timers
elif not similarTimer:
conflicting.append((name, begin, end, serviceref, timer.name))
if config.plugins.autotimer.disabled_on_conflict.value:
newEntry.log(503, "[AutoTimer] Timer disabled because of conflicts with %s." % (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 = recordHandler.record(newEntry)
self.result=(new, modified, skipped)
self.completed.append(timer.name)
sleep(0.5)
示例3: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import conflictString [as 别名]
#.........这里部分代码省略.........
# 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))
if 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 self.checkDuplicates(timer, name, nameS, shortdesc, shortdescS, extdesc, extdescS, force=True ):
# Check if the similar is already known
if eitS not in similardict:
doLog("Found similar Timer: " + name)
# Store the actual and similar eit and conflictString, so it can be handled later
newEntry.conflictString = conflictString
similardict[eit] = newEntry
similardict[eitS] = newEntry
similarTimer = True
if beginS <= evtBegin:
# Event is before our actual epgmatch so we have to append it to the epgmatches list
epgmatches.append((servicerefS, eitS, nameS, beginS, durationS, shortdescS, extdescS))
# If we need a second similar it will be found the next time
else:
similarTimer = False
newEntry = similardict[eitS]
break
if conflicts is None:
timer.decrementCounter()
new += 1
newEntry.extdesc = extdesc
timerdict[serviceref].append(newEntry)
# Similar timers are in new timers list and additionally in similar timers list
if similarTimer:
similars.append((name, begin, end, serviceref, timer.name))
similardict.clear()
# Don't care about similar timers
elif not similarTimer:
conflicting.append((name, begin, end, serviceref, timer.name))
if config.plugins.autotimer.disabled_on_conflict.value:
msg = "[AutoTimer] Timer disabled because of conflicts with %s." % (conflictString)
doLog(msg)
newEntry.log(503, msg)
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 = recordHandler.record(newEntry)
return (new, modified)
示例4: parseEPG
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import conflictString [as 别名]
#.........这里部分代码省略.........
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)
# Store the actual and similar eit and conflictString, so it can be handled later
newEntry.conflictString = conflictString
similar[eit] = newEntry
similar[eitS] = newEntry
similarTimer = True
if beginS <= evtBegin: