summaryrefslogtreecommitdiff
path: root/scripts/hist_importer.py
diff options
context:
space:
mode:
authorJosefson Fraga <josefson@users.noreply.github.com>2017-10-03 01:55:31 -0400
committerJosefson Fraga <josefson@users.noreply.github.com>2017-10-03 01:55:31 -0400
commit92f9a8503ee90cba87bc11b9aa983e8c8069c497 (patch)
treeef0922fa644023e7b3b8e2b092651c4e0d1dd812 /scripts/hist_importer.py
parent665a76561ecf405783f13beca694085a0803e479 (diff)
downloadqutebrowser-92f9a8503ee90cba87bc11b9aa983e8c8069c497.tar.gz
qutebrowser-92f9a8503ee90cba87bc11b9aa983e8c8069c497.zip
add required redirect (url,title,atime,redirect)
Diffstat (limited to 'scripts/hist_importer.py')
-rw-r--r--scripts/hist_importer.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/hist_importer.py b/scripts/hist_importer.py
index 8df16384a..d96284879 100644
--- a/scripts/hist_importer.py
+++ b/scripts/hist_importer.py
@@ -89,10 +89,14 @@ def extract(source, query):
def clean(history):
"""Receives a list of records:(datetime,url,title). And clean all records
in place, that has a NULL/None datetime attribute. Otherwise Qutebrowser
- will throw errors."""
+ will throw errors. Also, will add a 4rth attribute of '0' for the redirect
+ field in history.sqlite in qutebrowser."""
nulls = [record for record in history if record[0] is None]
for null_datetime in nulls:
history.remove(null_datetime)
+ history = [list(record) for record in history]
+ for record in history:
+ record.append('0')
return history
@@ -102,12 +106,10 @@ def insert_qb(history, dest):
conn = open_db(dest)
cursor = conn.cursor()
cursor.executemany(
- 'INSERT INTO History (url,title,atime) VALUES (?,?,?)', history
- )
- cursor.executemany(
- 'INSERT INTO CompletionHistory (url,title,last_atime) VALUES (?,?,?)',
+ 'INSERT INTO History (url,title,atime,redirect) VALUES (?,?,?,?)',
history
)
+ cursor.execute('DROP TABLE CompletionHistory')
conn.commit()
conn.close()