From c411befcf546fab1def900ce4fae496a5315199d Mon Sep 17 00:00:00 2001 From: bartholin Date: Sun, 13 Oct 2024 16:19:17 +0200 Subject: [PATCH 1/3] fix bug where movies did not show up properly --- kinolist/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinolist/database.py b/kinolist/database.py index bae755c..d11ae35 100644 --- a/kinolist/database.py +++ b/kinolist/database.py @@ -78,7 +78,7 @@ def get_watched_movies(): def new_movie(movie): db = get_db() - movie["id"] = db.execute("INSERT INTO movies (title, year, poster, plot, number) VALUES (?,?,?,?,?) RETURNING id", + movie["id"] = db.execute("INSERT INTO movies (title, year, poster, plot, number, watched) VALUES (?,?,?,?,?, 0) RETURNING id", (movie["title"], movie["year"], movie["poster"], movie["plot"], new_nb())).fetchone()["id"] db.commit() return movie From 5f0deef482b9f992cd506f3bebb66303acff97b8 Mon Sep 17 00:00:00 2001 From: bartholin Date: Sun, 13 Oct 2024 16:26:41 +0200 Subject: [PATCH 2/3] fix so that we can deal with imdb movies without poster --- kinolist/imdb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kinolist/imdb.py b/kinolist/imdb.py index e392bec..8984b5c 100644 --- a/kinolist/imdb.py +++ b/kinolist/imdb.py @@ -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 From a8e5b976fed5df7b28fed48c3b64af7917154bad Mon Sep 17 00:00:00 2001 From: bartholin Date: Sun, 13 Oct 2024 16:28:34 +0200 Subject: [PATCH 3/3] fix a bug for blank entries --- kinolist/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinolist/database.py b/kinolist/database.py index d11ae35..b571ba8 100644 --- a/kinolist/database.py +++ b/kinolist/database.py @@ -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}