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:
|
if 'thumb' in post:
|
||||||
thumb_path = Path(THUMBS_DIR, f"{post['thumb']}s.jpg")
|
thumb_path = Path(THUMBS_DIR, f"{post['thumb']}s.jpg")
|
||||||
download_jobs += [get_thumb(thumb_path, post)]
|
download_jobs += [get_thumb(thumb_path, post)]
|
||||||
|
else:
|
||||||
|
thumb_path = ""
|
||||||
|
|
||||||
# Try to create post in database
|
# Try to create post in database
|
||||||
try:
|
try:
|
||||||
with db:
|
with db:
|
||||||
curs = db.execute(
|
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["action"],
|
||||||
cols["board"],
|
cols["board"],
|
||||||
cols["length"],
|
cols["length"],
|
||||||
json.dumps(cols["post"]),
|
json.dumps(cols["post"]),
|
||||||
cols["thumb_path"],
|
str(thumb_path),
|
||||||
cols["reason"],
|
cols["reason"],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
except:
|
except Exception as ex:
|
||||||
pass
|
msg = str(ex)
|
||||||
|
if 'UNIQUE' not in msg:
|
||||||
|
print("error:", ex)
|
||||||
# Finish off thumbnail jobs
|
# Finish off thumbnail jobs
|
||||||
await asyncio.gather(*download_jobs)
|
await asyncio.gather(*download_jobs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user