if nextping <= now: if settings.catchup or nextping > now - settings.retrothresh: util.playsound() # invokes popup for this ping plus additional popups if there were more # pings while answering this one: cmd = [os.path.join(settings.path, "launch.py"), "quiet", "&"] util.callcmd(cmd) s = "{i: 4}: PING! gap {gap} avg {avg} tot {tot}".format( i=i, gap=datetime.timedelta(seconds=nextping - lastping), avg=datetime.timedelta(seconds=(0.0 + time.time() - start) / i), tot=datetime.timedelta(seconds=(0.0 + time.time() - start)), ) print(util.annotime(s, nextping, 72), file=sys.stderr) lastping = nextping nextping = rand.nextping(nextping) i += 1 ## Invoke popup for this ping plus additional popups if there were more pings ## while answering this one. def pingery(): # TODO: move everything from launch.py to here return 0 # # __DATA__
# close(F); # } else { # print "ERROR: Can't read task file ($tskf) again\n"; # $eflag++; # } # } # XXX task file tagstr = util.strip(resp).strip() comments = util.stripc(resp).strip() #tagstr = re.sub(r'\b(\d+)\b', lambda m) #$tagstr =~ s//($tags{$1} eq "" ? "$1" : "$1 ").$tags{$1}/eg; #$tagstr =~ s/\b(\d+)\b/tsk $1/; tagstr += autotags tagstr = re.sub(r'\s+', ' ', tagstr) a = util.annotime("{} {} {}".format(t, tagstr, comments), t) if (not tagstr) or\ (not settings.enforcenums or re.search(r'\b(\d+|non|afk)\b', tagstr)): # if enforcenums is enabled, requires a digit or "non" or "afk" to end break print(a) logger.log(a) # Send your TagTime log to Beeminder # (maybe should do this after retro pings too but launch.pl would do that). if settings.beeminder and resp: print(util.divider(" sending your tagtime data to beeminder ")) for key in settings.beeminder: print(key) bm(key)
else: nxtping = rand.prevping(launchtime) # XXX locking # if(!lockn()) { # print "Can't get lock. Exiting.\n" unless $quiet; # exit(1); # } # Don't wait if we can't get the lock. editorflag = False # First, if we missed any pings by more than $retrothresh seconds for no # apparent reason, then assume the computer was off and auto-log them. while nxtping < launchtime - settings.retrothresh: line = "{nxtping} afk off RETRO".format(nxtping=nxtping) logger.log(util.annotime(line, nxtping)) nxtping = rand.nextping(nxtping) editorflag = True # # Next, ping for any pings in the last retrothresh seconds. while True: while nxtping <= time.time(): if nxtping < time.time() - settings.retrothresh: line = util.annotime('{} afk RETRO'.format(nxtping), nxtping) + "\n" logger.log(line) editorflag = True else: launch(nxtping) # this shouldn't complete till you answer ts, ln = lastln()