diff options
author | Cecil <knoppmyth@gmail.com> | 2011-12-09 17:18:27 (GMT) |
---|---|---|
committer | Cecil <knoppmyth@gmail.com> | 2011-12-09 17:18:27 (GMT) |
commit | c034db2c880091379f7e58c2938a9689d78fbaa9 (patch) | |
tree | 8a074205a2f3bf6ee7fb5945c53e1a1618d41973 /abs/core/supplemental-web/contents/calllog.py | |
parent | 73b42144585c603fc64e7b1d6a126ceb7c486870 (diff) | |
parent | b0c5755ade92ee5b76a6d56248e64254876bc931 (diff) | |
download | linhes_pkgbuild-c034db2c880091379f7e58c2938a9689d78fbaa9.zip linhes_pkgbuild-c034db2c880091379f7e58c2938a9689d78fbaa9.tar.gz linhes_pkgbuild-c034db2c880091379f7e58c2938a9689d78fbaa9.tar.bz2 |
Merge branch 'testing' of ssh://cesman@linhes.org/mount/repository/linhes_pkgbuild into testing
Diffstat (limited to 'abs/core/supplemental-web/contents/calllog.py')
-rw-r--r-- | abs/core/supplemental-web/contents/calllog.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/abs/core/supplemental-web/contents/calllog.py b/abs/core/supplemental-web/contents/calllog.py new file mode 100644 index 0000000..a96813e --- /dev/null +++ b/abs/core/supplemental-web/contents/calllog.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +# import MySQL module + +import MySQLdb +import sys +import getopt +import socket + + +def main(argv): + grandtotal=0 + grandtotal_current=0 + db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="ncid") + # create a cursor + cursor = db.cursor() + # execute SQL statement + cursor.execute("select name,number,count(number) as '# calls' from cid group by number,name order by '# calls' DESC limit 20;") + result = cursor.fetchall() + + +#Top shows + #print '<div id="content"> <p></p>' + print '<div> <p></p>' + print '<table class="calllog">' + print "Top 20 callers" + searchstring='''<td> <a href="http://www.google.com/search?q=%s" > %s </a> </td> ''' + cursor.execute("select name,number,count(number) as '# calls' from cid group by number,name order by '# calls' DESC limit 20;") + result = cursor.fetchall() + for row in result: + print " <tr>" + #print " <td>",row[0],"</td>" + print searchstring % (row[0], row [0]) + print " <td>",row[2],"</td>" + #print " <td>",row[1],"</td>" + print searchstring % (row[1], row [1]) + print " </tr>" + #print "%40s %26s %10s" %(row[0],row[2],row[1]) + print "</table>" + print "</div>" +#Top categorys + + + print '<br>' + print '<br>' + #print '<div id="content"> <p></p>' + print '<div> <p></p>' + print '<table class="calllog">' + print "Last 20 calls" + print '<br>' + cursor.execute("select date,time,name,number from cid order by date(ts) DESC ,time DESC limit 20 ;" ) + result = cursor.fetchall() + for row in result: + print " <tr>" + print " <td> %s </td>" %(row[0]) + print " <td>",row[1],"</td>" + #print " <td>",row[2],"</td>" + print searchstring % (row[2], row [2]) + #print " <td>",row[3],"</td>" + print searchstring % (row[3], row [3]) + print " </tr>" +# print "%26s %26s %26s %26s " %(row[0],row[1],row[2],row[3]) + print "</table>" + print "</div>" + +if __name__ == "__main__": + main(sys.argv[1:]) |