Add op column to database

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2023-07-31 00:10:15 -07:00
parent 3db45d63d2
commit cf4fd799b4
2 changed files with 6 additions and 3 deletions

View File

@@ -33,7 +33,8 @@ def get_db(db_path: str = DB_PATH):
filename text, filename text,
tim varchar(30), tim varchar(30),
thumb_path text, thumb_path text,
reason varchar(200) reason varchar(200),
op boolean default 0
); );
""" """
) )

View File

@@ -76,6 +76,7 @@ async def pull():
if key != "time" if key != "time"
} }
post = defaultdict(lambda: None, posts[cols["post"]["data-pid"]]) post = defaultdict(lambda: None, posts[cols["post"]["data-pid"]])
post["op"] = "(OP)" in str(cols["post"])
if "thumb" in post: if "thumb" in post:
thumb = post['thumb'] thumb = post['thumb']
@@ -170,7 +171,7 @@ async def pull():
db.execute( 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 ( values (
:action, :action,
:board, :board,
@@ -193,7 +194,8 @@ async def pull():
:filename, :filename,
:tim, :tim,
:thumb_path, :thumb_path,
:reason :reason,
:op
) )
""", """,
post, post,