diff --git a/chanbans/db.py b/chanbans/db.py index d34e8f5..803191a 100644 --- a/chanbans/db.py +++ b/chanbans/db.py @@ -33,7 +33,8 @@ def get_db(db_path: str = DB_PATH): filename text, tim varchar(30), thumb_path text, - reason varchar(200) + reason varchar(200), + op boolean default 0 ); """ ) diff --git a/chanbans/pull.py b/chanbans/pull.py index 511b5e5..0175d3e 100644 --- a/chanbans/pull.py +++ b/chanbans/pull.py @@ -76,6 +76,7 @@ async def pull(): if key != "time" } post = defaultdict(lambda: None, posts[cols["post"]["data-pid"]]) + post["op"] = "(OP)" in str(cols["post"]) if "thumb" in post: thumb = post['thumb'] @@ -170,7 +171,7 @@ async def pull(): db.execute( """ - insert into bans (action, board, length, now, name, trip, com, time, sub, nsfw, thumb, ext, w, h, tn_w, tn_h, md5, fsize, filename, tim, thumb_path, reason) + insert into bans (action, board, length, now, name, trip, com, time, sub, nsfw, thumb, ext, w, h, tn_w, tn_h, md5, fsize, filename, tim, thumb_path, reason, op) values ( :action, :board, @@ -193,7 +194,8 @@ async def pull(): :filename, :tim, :thumb_path, - :reason + :reason, + :op ) """, post,