From: Vincent Le Gallic Date: Sun, 29 Sep 2013 12:31:47 +0000 (+0200) Subject: Non-working python IRC-statistics script X-Git-Url: http://gitweb.pimeys.fr/?p=scripts-20-100.git;a=commitdiff_plain;h=74e56c032628f28a837c0126a9308a8dac02f198 Non-working python IRC-statistics script --- diff --git a/mystats.py b/mystats.py new file mode 100755 index 0000000..2991cf0 --- /dev/null +++ b/mystats.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- + +"""Codé par 20-100 une nuit où il trouvait qu'il parlait beaucoup sur #note-dev + + Ne marche plus parce que sous WeeChat les paths ont changé et j'ai eu la + flemme de corriger jusqu'ici. +""" + +import sys +import os +os.chdir("/home/legallic/.weechat/logs/crans/") + +try: + chan = sys.argv[1] +except: + print "Usage : mystats.py " + exit(1) + +from commands import getstatusoutput as ex + +cmdlignes = r"cat */*/%s.log | grep '^........<' | wc -l"%(chan) +cmdmeslignes = r"cat */*/%s.log | grep '^........<.\[20-100\]' | wc -l"%(chan) +lignes = int(ex(cmdlignes)[1]) +meslignes = int(ex(cmdmeslignes)[1]) +print "messages = %s/%s, %s%%"%(meslignes,lignes,int(1000*meslignes/float(lignes))/10.0) +mess = (meslignes,lignes) + +cmdlignes = r"cat */*/%s.log | grep '^........ [*]' | wc -l"%(chan) +cmdmeslignes = r"cat */*/%s.log | grep '^........ [*] \[20-100\]' | wc -l"%(chan) +lignes = int(ex(cmdlignes)[1]) +meslignes = int(ex(cmdmeslignes)[1]) +print "actions = %s/%s, %s%%"%(meslignes,lignes,int(1000*meslignes/float(lignes))/10.0) +acts = (meslignes,lignes) + +tot=(mess[0]+acts[0],mess[1]+acts[1]) +print "total = %s/%s, %s%%"%(tot[0],tot[1],int(1000*tot[0]/float(tot[1]))/10.0)