From 66c23a54d292d5764adf7019a60bda073a029cf0 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 20 May 2022 21:59:01 -0400 Subject: [PATCH] [111] reload table --- VERSION | 2 +- modules/cache.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 7d415cb3..1a450a38 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop110 +1.16.5-develop111 diff --git a/modules/cache.py b/modules/cache.py index a270375f..0da17487 100644 --- a/modules/cache.py +++ b/modules/cache.py @@ -26,6 +26,7 @@ class Cache: cursor.execute("DROP TABLE IF EXISTS omdb_data") cursor.execute("DROP TABLE IF EXISTS omdb_data2") cursor.execute("DROP TABLE IF EXISTS tvdb_data") + cursor.execute("DROP TABLE IF EXISTS tvdb_data2") cursor.execute( """CREATE TABLE IF NOT EXISTS guids_map ( key INTEGER PRIMARY KEY, @@ -165,7 +166,7 @@ class Cache: expiration_date TEXT)""" ) cursor.execute( - """CREATE TABLE IF NOT EXISTS tvdb_data2 ( + """CREATE TABLE IF NOT EXISTS tvdb_data3 ( key INTEGER PRIMARY KEY, tvdb_id INTEGER UNIQUE, type TEXT, @@ -574,7 +575,7 @@ class Cache: with sqlite3.connect(self.cache_path) as connection: connection.row_factory = sqlite3.Row with closing(connection.cursor()) as cursor: - cursor.execute("SELECT * FROM tvdb_data2 WHERE tvdb_id = ? and type = ?", (tvdb_id, "movie" if is_movie else "show")) + cursor.execute("SELECT * FROM tvdb_data3 WHERE tvdb_id = ? and type = ?", (tvdb_id, "movie" if is_movie else "show")) row = cursor.fetchone() if row: tvdb_dict["tvdb_id"] = int(row["tvdb_id"]) if row["tvdb_id"] else 0 @@ -595,8 +596,8 @@ class Cache: with sqlite3.connect(self.cache_path) as connection: connection.row_factory = sqlite3.Row with closing(connection.cursor()) as cursor: - cursor.execute("INSERT OR IGNORE INTO tvdb_data2(tvdb_id, type) VALUES(?, ?)", (obj.tvdb_id, "movie" if obj.is_movie else "show")) - update_sql = "UPDATE tvdb_data2 SET title = ?, summary = ?, poster_url = ?, background_url = ?, " \ + cursor.execute("INSERT OR IGNORE INTO tvdb_data3(tvdb_id, type) VALUES(?, ?)", (obj.tvdb_id, "movie" if obj.is_movie else "show")) + update_sql = "UPDATE tvdb_data3 SET title = ?, summary = ?, poster_url = ?, background_url = ?, " \ "release_date = ?, genres = ?, expiration_date = ? WHERE tvdb_id = ? AND type = ?" tvdb_date = f"{str(obj.release_date.year).zfill(4)}-{str(obj.release_date.month).zfill(2)}-{str(obj.release_date.day).zfill(2)}" if obj.release_date else None cursor.execute(update_sql, (