add 'add' method to db.DuckDB

This commit is contained in:
randomuser 2021-07-20 23:58:37 -05:00
parent 6bf490ead4
commit be25f97cbf
1 changed files with 12 additions and 1 deletions

13
db.py
View File

@ -2,7 +2,18 @@ class DuckDB:
def __init__(self, location=None): def __init__(self, location=None):
self.location = location self.location = location
self.db = [] self.db = []
if location != None: read(location) if location != None: self.read(location)
def add(self, state, nick, abstime, reltime, channel):
self.db.append(DuckEvent(
"{}{} {} {} {}".format(
state,
nick,
str(abstime),
str(reltime),
channel,
)
)
def parse(self, fd): def parse(self, fd):
lines = [i.rstrip() for i in fd.readlines()] lines = [i.rstrip() for i in fd.readlines()]