Beispiel #1
0
  def checkin( self ):
    if self.appdisabled:
      return False

    try:
      self.twtaccess = Twitter(auth=OAuth(tininfo.TiNTwOAToken, tininfo.TiNTwOASecret, tininfo.TiNTwConKey, tininfo.TiNTwConSecret))
    except:
      print 'Unable to check into PyRIDE REEM twitter app. Try again in 10mins.'
      return False

    self.startupTime = time.localtime()
    self.updatestatus( time.strftime( "I'm back online at %H:%M to serve ", time.localtime() ) + tininfo.TiNLocation + "."  )
  
    self.token = self.lastoken
    self.getmessages()
    tinstate.updateStatus( constants.NEW_MESSAGES, len( self.messages ) == 0 )
    tid = PyREEM.addTimer( 60, -1, 60 )
    self.timercontext[tid] = 'getmsg'
    timermanager.addTimer( tid, self )
    #add purge archive time
    purgetime = timermanager.calcTimePeriodFromNow( "4:00" )
    if purgetime > 0:
      tid = PyREEM.addTimer( purgetime, -1, 24*60*3600 )
      self.timercontext[tid] = 'purgemsg'
      timermanager.addTimer( tid, self )

    return True
Beispiel #2
0
    def checkin(self):
        if self.appdisabled:
            return False

        try:
            self.twtaccess = Twitter(
                auth=OAuth(tininfo.TiNTwOAToken, tininfo.TiNTwOASecret,
                           tininfo.TiNTwConKey, tininfo.TiNTwConSecret))
        except:
            print 'Unable to check into PyRIDE REEM twitter app. Try again in 10mins.'
            return False

        self.startupTime = time.localtime()
        self.updatestatus(
            time.strftime("I'm back online at %H:%M to serve ",
                          time.localtime()) + tininfo.TiNLocation + ".")

        self.token = self.lastoken
        self.getmessages()
        tinstate.updateStatus(constants.NEW_MESSAGES, len(self.messages) == 0)
        tid = PyREEM.addTimer(60, -1, 60)
        self.timercontext[tid] = 'getmsg'
        timermanager.addTimer(tid, self)
        #add purge archive time
        purgetime = timermanager.calcTimePeriodFromNow("4:00")
        if purgetime > 0:
            tid = PyREEM.addTimer(purgetime, -1, 24 * 60 * 3600)
            self.timercontext[tid] = 'purgemsg'
            timermanager.addTimer(tid, self)

        return True
Beispiel #3
0
def main():
  global myMessenger, msgTryTimer
  global extProcCall, iksResolver
  global ipkSpawner

  extProcCall = extprocall.ProcConduit()
  iksResolver = iksresolver.IKSResolver()
  ipkSpawner = ipkspawner.IPKSpawner()

  PyREEM.onUserLogOn = userLogon
  PyREEM.onUserLogOff = userLogoff
  PyREEM.onTimer = timerActions
  PyREEM.onTimerLapsed = timerLapsedActions
  PyREEM.onRemoteCommand = remoteCommandActions
  PyREEM.onSystemShutdown = systemShutdownActions
  PyREEM.onPowerPluggedChange = powerPlugChangeActions
  PyREEM.onBatteryChargeChange = batteryChargeChangeActions
  PyREEM.onNodeStatusUpdate = nodeStatusUpdate

  myMessenger = messenger.Messenger()
  if not myMessenger.checkin():
    msgTryTimer = PyREEM.addTimer( 10*60, -1, 10*60 )

  PyREEM.say( constants.INTRO_TEXT )
  PyREEM.setLowPowerThreshold( 20 )