-
-def do_track_chat_log(args, bu):
- if len(args) != 1: bu('ship-aid takes only chat log filename')
+ if progress: progress.caughtup()
+
+class ProgressPrintPercentage:
+ def __init__(self, f=sys.stdout): self._f = f
+ def progress(self,done,total):
+ self._f.write("scan chat logs %3d%%\r" % ((done*100) / total))
+ self._f.flush()
+ def caughtup(self):
+ self._f.write(' \r')
+ self._f.flush()
+
+def simple_printer(x): print x
+
+def run_chat_log(args, bu, progress=ProgressPrintPercentage(),
+ display=simple_printer, max_myself_age=3600):
+ if len(args) != 1: bu('this action takes only chat log filename')