本文整理汇总了Python中RecordTimer.RecordTimerEntry.justplay方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.justplay方法的具体用法?Python RecordTimerEntry.justplay怎么用?Python RecordTimerEntry.justplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecordTimer.RecordTimerEntry
的用法示例。
在下文中一共展示了RecordTimerEntry.justplay方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UPDT
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [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)
示例2: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [as 别名]
#.........这里部分代码省略.........
allow_modify = True
doLog("[AutoTimer SeriesPlugin] Returned name, desc, path %s %s %s" % (name, shortdesc, dest))
else:
# Nothing found
doLog(str(sp))
# If AutoTimer name not equal match, do a second lookup with the name
if timer.name.lower() != timer.match.lower():
doLog("[AutoTimer SeriesPlugin] Request name, desc, path %s %s %s" % (timer.name, shortdesc, dest))
sp = sp_getSeasonEpisode(serviceref, timer.name, evtBegin, evtEnd, shortdesc, dest)
if sp and type(sp) in (tuple, list) and len(sp) == 4:
name = sp[0] or name
shortdesc = sp[1] or shortdesc
dest = sp[2] or dest
doLog(str(sp[3]))
allow_modify = True
doLog("[AutoTimer SeriesPlugin] Returned name, desc, path %s %s %s" % (name, shortdesc, dest))
else:
doLog(str(sp))
if timer.checkFilter(name, shortdesc, extdesc, dayofweek):
doLog("[AutoTimer] Skipping an event because of filter check")
skipped.append((name, begin, end, serviceref, timer.name, getLog()))
continue
if timer.hasOffset():
# Apply custom Offset
begin, end = timer.applyOffset(begin, end)
else:
# Apply E2 Offset
begin -= config.recording.margin_before.value * 60
end += config.recording.margin_after.value * 60
# Overwrite endtime if requested
if timer.justplay and not timer.setEndtime:
end = begin
# Check for existing recordings in directory
if timer.avoidDuplicateDescription == 3:
# Reset movie Exists
movieExists = False
if dest and dest not in moviedict:
self.addDirectoryToMovieDict(moviedict, dest, serviceHandler)
for movieinfo in moviedict.get(dest, ()):
if self.checkDuplicates(timer, name, movieinfo.get("name"), shortdesc, movieinfo.get("shortdesc"), extdesc, movieinfo.get("extdesc") ):
doLog("[AutoTimer] We found a matching recorded movie, skipping event:", name)
movieExists = True
break
if movieExists:
doLog("[AutoTimer] Skipping an event because movie already exists")
skipped.append((name, begin, end, serviceref, timer.name, getLog()))
continue
# 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 timerdict.get(serviceref, ()):
if rtimer.eit == eit:
oldExists = True
doLog("[AutoTimer] We found a timer based on eit")
newEntry = rtimer
oldEntry = rtimer
break
elif config.plugins.autotimer.try_guessing.value:
if timer.hasOffset():
# Remove custom Offset
示例3: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [as 别名]
#.........这里部分代码省略.........
# If AutoTimer name not equal match, do a second lookup with the name
if timer.name.lower() != timer.match.lower():
#doLog("Request name, desc, path %s %s %s" % (timer.name,shortdesc,dest))
sp = sp_getSeasonEpisode(serviceref, timer.name, evtBegin, evtEnd, shortdesc, dest)
if sp and type(sp) in (tuple, list) and len(sp) == 4:
name = sp[0] or name
shortdesc = sp[1] or shortdesc
dest = sp[2] or dest
doLog(str(sp[3]))
#doLog("Returned name, desc, path %s %s %s" % (name,shortdesc,dest))
allow_modify = True
else:
doLog(str(sp))
if timer.checkFilter(name, shortdesc, extdesc, dayofweek):
doLog("Skipping an event because of filter check")
skipped.append((name, begin, end, serviceref, timer.name, getLog()))
continue
if timer.hasOffset():
# Apply custom Offset
begin, end = timer.applyOffset(begin, end)
else:
# Apply E2 Offset
if ServiceRecordingSettings:
begin -= ServiceRecordingSettings.instance.getMarginBefore(eserviceref)
end += ServiceRecordingSettings.instance.getMarginAfter(eserviceref)
else:
begin -= config.recording.margin_before.value * 60
end += config.recording.margin_after.value * 60
# Overwrite endtime if requested
if timer.justplay and not timer.setEndtime:
end = begin
# Check for existing recordings in directory
if timer.avoidDuplicateDescription == 3:
# Reset movie Exists
movieExists = False
if dest and dest not in moviedict:
self.addDirectoryToMovieDict(moviedict, dest, serviceHandler)
for movieinfo in moviedict.get(dest, ()):
if self.checkDuplicates(timer, name, movieinfo.get("name"), shortdesc, movieinfo.get("shortdesc"), extdesc, movieinfo.get("extdesc") ):
doLog("We found a matching recorded movie, skipping event:", name)
movieExists = True
break
if movieExists:
doLog("Skipping an event because movie already exists")
skipped.append((name, begin, end, serviceref, timer.name, getLog()))
continue
# 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 timerdict.get(serviceref, ()):
if rtimer.eit == eit:
oldExists = True
doLog("We found a timer based on eit")
newEntry = rtimer
break
elif config.plugins.autotimer.try_guessing.value:
if timer.hasOffset():
# Remove custom Offset
rbegin = rtimer.begin + timer.offset[0] * 60
示例4: parseTimer
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [as 别名]
#.........这里部分代码省略.........
# Check if eit is in similar matches list
# NOTE: ignore evtLimit for similar timers as I feel this makes the feature unintuitive
similarTimer = False
if eit in similardict:
similarTimer = True
dayofweek = None # NOTE: ignore day on similar timer
else:
# If maximum days in future is set then check time
if checkEvtLimit:
if begin > evtLimit:
continue
dayofweek = str(timestamp.tm_wday)
# Check timer conditions
# NOTE: similar matches do not care about the day/time they are on, so ignore them
if timer.checkServices(serviceref) \
or timer.checkDuration(duration) \
or (not similarTimer and (\
timer.checkTimespan(timestamp) \
or timer.checkTimeframe(begin) \
)) or timer.checkFilter(name, shortdesc, extdesc, dayofweek):
continue
if timer.hasOffset():
# Apply custom Offset
begin, end = timer.applyOffset(begin, end)
else:
# Apply E2 Offset
begin -= config.recording.margin_before.value * 60
end += config.recording.margin_after.value * 60
# Overwrite endtime if requested
if timer.justplay and not timer.setEndtime:
end = begin
# Eventually change service to alternative
if timer.overrideAlternatives:
serviceref = timer.getAlternative(serviceref)
# Append to timerlist and abort if simulating
timers.append((name, begin, end, serviceref, timer.name))
if simulateOnly:
continue
# Check for existing recordings in directory
if timer.avoidDuplicateDescription == 3:
# Reset movie Exists
movieExists = False
if dest and dest not in moviedict:
self.addDirectoryToMovieDict(moviedict, dest, serviceHandler)
for movieinfo in moviedict.get(dest, ()):
if self.checkSimilarity(timer, name, movieinfo.get("name"), shortdesc, movieinfo.get("shortdesc"), extdesc, movieinfo.get("extdesc")):
print("[AutoTimer] We found a matching recorded movie, skipping event:", name)
movieExists = True
break
if movieExists:
continue
# Initialize
newEntry = None
oldExists = False
# Check for double Timers
# We first check eit and if user wants us to guess event based on time
示例5: parseEPG
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [as 别名]
#.........这里部分代码省略.........
timers.append((name, begin, end, serviceref, timer.name))
if simulateOnly:
continue
# 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" or rtimer.repeated:
print "[AutoTimer] Won't modify existing timer because either no modification allowed or repeated timer"
break
if hasattr(rtimer, "isAutoTimer"):
print "[AutoTimer] Modifying existing AutoTimer!"
else:
if config.plugins.autotimer.refresh.value != "all":
print "[AutoTimer] Won't modify existing timer because it's no timer set by us"
break
print "[AutoTimer] Warning, we're messing with a timer which might not have been set by us"
newEntry = rtimer
modified += 1
# Modify values saved in timer
newEntry.name = name
newEntry.description = description
newEntry.begin = int(begin)
newEntry.end = int(end)
newEntry.service_ref = ServiceReference(serviceref)
break
elif timer.avoidDuplicateDescription == 1 and not rtimer.disabled and rtimer.name == name and rtimer.description == description:
oldExists = True
print "[AutoTimer] We found a timer with same 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:
# I thinks thats the fastest way to do this, though it's a little ugly
try:
for list in recorddict.values():
for rtimer in list:
if not rtimer.disabled and rtimer.name == name and rtimer.description == description:
raise AutoTimerIgnoreTimerException("We found a timer with same description, skipping event")
except AutoTimerIgnoreTimerException, etite:
print etite
continue
if timer.checkCounter(timestamp):
continue
print "[AutoTimer] Adding an event."
newEntry = RecordTimerEntry(ServiceReference(serviceref), begin, end, name, description, eit)
# 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
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:
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((name, begin, end, serviceref, timer.name))
if conflicts is None:
timer.decrementCounter()
new += 1
recorddict.setdefault(serviceref, []).append(newEntry)
else:
conflicting.append((name, begin, end, serviceref, timer.name))
示例6: parseEPG
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [as 别名]
#.........这里部分代码省略.........
# Check if eit is in similar matches list
# NOTE: ignore evtLimit for similar timers as I feel this makes the feature unintuitive
similarTimer = False
if eit in similar:
similarTimer = True
dayofweek = None # NOTE: ignore day on similar timer
else:
# If maximum days in future is set then check time
if checkEvtLimit:
if begin > evtLimit:
continue
dayofweek = str(timestamp.tm_wday)
# Check timer conditions
# NOTE: similar matches to not care about the day/time they are on, so ignore them
if timer.checkServices(serviceref) \
or timer.checkDuration(duration) \
or (not similarTimer and (\
timer.checkTimespan(timestamp) \
or timer.checkTimeframe(begin) \
)) or timer.checkFilter(name, shortdesc, extdesc, dayofweek):
continue
if timer.hasOffset():
# Apply custom Offset
begin, end = timer.applyOffset(begin, end)
else:
# Apply E2 Offset
begin -= config.recording.margin_before.value * 60
end += config.recording.margin_after.value * 60
# Overwrite endtime if requested
if timer.justplay and not timer.setEndtime:
end = begin
# Eventually change service to alternative
if timer.overrideAlternatives:
serviceref = timer.getAlternative(serviceref)
total += 1
# Append to timerlist and abort if simulating
timers.append((name, begin, end, serviceref, timer.name))
if simulateOnly:
continue
# Check for existing recordings in directory
if timer.avoidDuplicateDescription == 3:
# Reset movie Exists
movieExists = False
if dest and dest not in moviedict:
#Question: Move to a separate function getRecordDict()
print("[AutoTimer] listing of movies in " + dest + " failed")
event = info.getEvent(movieref)
if event is None:
continue
"shortdesc": info.getInfoString(movieref, iServiceInformation.sDescription),
"extdesc": event.getExtendedDescription() or '' # XXX: does event.getExtendedDescription() actually return None on no description or an empty string?
for movieinfo in moviedict.get(dest, ()):
if movieinfo.get("name") == name \
and movieinfo.get("shortdesc") == shortdesc:
# Some channels indicate replays in the extended descriptions
# If the similarity percent is higher then 0.8 it is a very close match
extdescM = movieinfo.get("extdesc")
示例7: parseEPG
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [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)
示例8: mktime
# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import justplay [as 别名]
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, 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)