#!/usr/bin/python #Copyright (C) 2008 Luar Roji #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. # #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. # #You should have received a copy of the GNU General Public License #along with this program; if not, write to the Free Software #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # #For full license view COPYRIGHT file or go to: #http://www.fsf.org/licensing/licenses/info/GPLv2.html from datetime import * import sys print "CenterIM Log2HTML - $Rev: 25$" print "Luar Roji - http://roji.net\n" def usage(): print "Usage: " + sys.argv[0] + " [logFileName] {outFileName}" print "" print " If outFileName is not specified, logFileName+.html is assumed." print "" sys.exit() def getLine(f): s = f.readline() s = s.rstrip('\n\r') return s def out(s): outfile.write(s + "\n") # print s def outtd(msg, field): data = msg[field] if (field=="timestamp1" or field=="timestamp2"): if (data!=""): floatData = float(data) dateTimeObj = datetime.fromtimestamp(floatData) data = dateTimeObj.strftime(DATEFORMAT) out("