From 2483a9434de4afc4b00dd7dce1f6a2603aa6133a Mon Sep 17 00:00:00 2001 From: thezero Date: Mon, 29 Oct 2018 23:17:37 +0100 Subject: [PATCH] fix primary-key integrity in db --- db.py | 4 ++-- vvvvget.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/db.py b/db.py index 31cda5e..b3c8b1e 100644 --- a/db.py +++ b/db.py @@ -10,8 +10,8 @@ class VVVVIDatabase(): def create(self): con = sqlite3.connect(self.path) cur = con.cursor() - cur.execute("CREATE TABLE series (id INTEGER, name TEXT NOT NULL, season_id INTEGER, type TEXT, PRIMARY KEY (id, season_id));") - cur.execute("CREATE TABLE episodes (id INTEGER, serie_id INTEGER, season_id INTEGER, cdn_url TEXT NOT NULL, type TEXT NOT NULL);") + cur.execute("CREATE TABLE series (id INTEGER NOT NULL, name TEXT NOT NULL, season_id INTEGER NOT NULL, type TEXT NOT NULL, PRIMARY KEY (id, season_id));") + cur.execute("CREATE TABLE episodes (id INTEGER NOT NULL, serie_id INTEGER NOT NULL, season_id INTEGER NOT NULL, cdn_url TEXT NOT NULL, type TEXT NOT NULL, PRIMARY KEY (id, serie_id, season_id, cdn_url, type));") con.commit() con.close() diff --git a/vvvvget.py b/vvvvget.py index e857ea3..e1532f0 100644 --- a/vvvvget.py +++ b/vvvvget.py @@ -55,7 +55,6 @@ for i in range(last, last + smax): for j in seasons: print("Found: {}".format(info['title'])) - print(j) if not vvvvidb.insert_serie((info['show_id'], info['title'], j['season_id'], j.get('name'))): print("Serie already present") continue