Optimize full DB refresh.

This commit is contained in:
Arun Prakash Jana 2016-04-22 20:10:58 +05:30
parent 28c1b16285
commit 1433a58b6a
No known key found for this signature in database
GPG Key ID: C0A712ED95043DCB

25
buku
View File

@ -456,8 +456,8 @@ def dbRefresh(conn, cur, index):
cur.execute("SELECT id, url FROM bookmarks WHERE id = ?", (index,)) cur.execute("SELECT id, url FROM bookmarks WHERE id = ?", (index,))
resultset = cur.fetchall() resultset = cur.fetchall()
for row in resultset: if titleManual is None:
if titleManual is None: for row in resultset:
title = fetchTitle(row[1]) title = fetchTitle(row[1])
if title == '': if title == '':
print("\x1B[91mTitle: []") print("\x1B[91mTitle: []")
@ -465,15 +465,20 @@ def dbRefresh(conn, cur, index):
continue continue
else: else:
print("Title: [%s]" % title) print("Title: [%s]" % title)
else:
if titleManual == "none":
title = ''
else:
title = titleManual
cur.execute("UPDATE bookmarks SET metadata = ? WHERE id = ?", (title, row[0],)) cur.execute("UPDATE bookmarks SET metadata = ? WHERE id = ?", (title, row[0],))
conn.commit() conn.commit()
print("Updated index %d\n" % row[0]) print("Updated index %d\n" % row[0])
else:
if titleManual == "none":
title = ''
else:
title = titleManual
for row in resultset:
cur.execute("UPDATE bookmarks SET metadata = ? WHERE id = ?", (title, row[0],))
conn.commit()
print("Updated index %d\n" % row[0])