当前位置: 首页>>代码示例>>Python>>正文


Python RecordTimerEntry.processRepeated方法代码示例

本文整理汇总了Python中RecordTimer.RecordTimerEntry.processRepeated方法的典型用法代码示例。如果您正苦于以下问题:Python RecordTimerEntry.processRepeated方法的具体用法?Python RecordTimerEntry.processRepeated怎么用?Python RecordTimerEntry.processRepeated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RecordTimer.RecordTimerEntry的用法示例。


在下文中一共展示了RecordTimerEntry.processRepeated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: editTimer

# 需要导入模块: from RecordTimer import RecordTimerEntry [as 别名]
# 或者: from RecordTimer.RecordTimerEntry import processRepeated [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 )
开发者ID:Haehnchen,项目名称:sharemybox.net-enigma2-client,代码行数:104,代码来源:ShareMyBoxTimer.py


注:本文中的RecordTimer.RecordTimerEntry.processRepeated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。