Fix minor errors in the new thumbnail stuff was stopping stuff from being inserted
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -135,23 +135,27 @@ async def main():
|
||||
if 'thumb' in post:
|
||||
thumb_path = Path(THUMBS_DIR, f"{post['thumb']}s.jpg")
|
||||
download_jobs += [get_thumb(thumb_path, post)]
|
||||
else:
|
||||
thumb_path = ""
|
||||
|
||||
# Try to create post in database
|
||||
try:
|
||||
with db:
|
||||
curs = db.execute(
|
||||
"insert into bans (action, board, length, post, thumb_path, reason) values(?, ?, ?, ?, ?)",
|
||||
"insert into bans (action, board, length, post, thumb_path, reason) values(?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
cols["action"],
|
||||
cols["board"],
|
||||
cols["length"],
|
||||
json.dumps(cols["post"]),
|
||||
cols["thumb_path"],
|
||||
str(thumb_path),
|
||||
cols["reason"],
|
||||
),
|
||||
)
|
||||
except:
|
||||
pass
|
||||
except Exception as ex:
|
||||
msg = str(ex)
|
||||
if 'UNIQUE' not in msg:
|
||||
print("error:", ex)
|
||||
# Finish off thumbnail jobs
|
||||
await asyncio.gather(*download_jobs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user