def doLive(self, lastLength): """ @param lastLength: Last length of file (only read newly logged lines) @return: Processed data, current timestamp, current file length (-1 if finished) Opens the DD logfile and parses all lines up to lastLength No multithreading is performed, as its intended for minor(live) updates only. """ try: logfile = open(self.logfilename, "r") filedata = logfile.readlines() filedata = filedata[lastLength:] logfile.close() except IOError: return [], -1 processedData = [] # No reverse, already have the starting point and such. for L in filedata: data = L.strip() # Attempt to match data (no match for chat, petspam, logout messages, etc) ret = Processing.getMatch(data) if ret == None: continue # Store data and continue loop processedData.append(ret) # END-WHILE return processedData, len(filedata)