Compare commits

..

2 Commits

Author SHA1 Message Date
bartholin
a8e5b976fe fix a bug for blank entries 2024-10-13 16:28:34 +02:00
bartholin
5f0deef482 fix so that we can deal with imdb movies without poster 2024-10-13 16:26:41 +02:00
2 changed files with 5 additions and 1 deletions

View File

@ -87,7 +87,7 @@ def new_blank_movie():
db = get_db()
id = db.execute("INSERT INTO movies DEFAULT VALUES RETURNING id").fetchone()["id"]
nb = new_nb()
db.execute("UPDATE movies SET number = ? WHERE id = ?", (nb, id))
db.execute("UPDATE movies SET number = ?, watched = 0 WHERE id = ?", (nb, id))
db.commit()
return {"id": id, "nb": nb}

View File

@ -41,6 +41,10 @@ def imdbid(imdbid):
img = get(poster)
if img.status_code == 200:
movie["poster"] = posters.save(poster, img.content)
else:
movie["poster"] = None
else:
movie["poster"] = None
return movie
else:
return None