remove executemany and use a for each -> execute
This commit is contained in:
parent
2483a9434d
commit
7e10077d33
17
db.py
17
db.py
@ -71,12 +71,13 @@ class VVVVIDatabase():
|
|||||||
def insert_episodes(self, eps):
|
def insert_episodes(self, eps):
|
||||||
con = sqlite3.connect(self.path)
|
con = sqlite3.connect(self.path)
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
try:
|
for ep in eps:
|
||||||
cur.executemany("INSERT INTO episodes (id, serie_id, season_id, type, cdn_url) VALUES (?, ?, ?, ?, ?);", eps)
|
try:
|
||||||
con.commit()
|
cur.execute("INSERT INTO episodes (id, serie_id, season_id, type, cdn_url) VALUES (?, ?, ?, ?, ?);", ep)
|
||||||
con.close()
|
con.commit()
|
||||||
return True
|
con.close()
|
||||||
except sqlite3.IntegrityError:
|
return True
|
||||||
# episodi gia' presenti
|
except sqlite3.IntegrityError:
|
||||||
pass
|
# episodi gia' presenti
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user