add required redirect (url,title,atime,redirect)
This commit is contained in:
parent
665a76561e
commit
92f9a8503e
@ -89,10 +89,14 @@ def extract(source, query):
|
|||||||
def clean(history):
|
def clean(history):
|
||||||
"""Receives a list of records:(datetime,url,title). And clean all records
|
"""Receives a list of records:(datetime,url,title). And clean all records
|
||||||
in place, that has a NULL/None datetime attribute. Otherwise Qutebrowser
|
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]
|
nulls = [record for record in history if record[0] is None]
|
||||||
for null_datetime in nulls:
|
for null_datetime in nulls:
|
||||||
history.remove(null_datetime)
|
history.remove(null_datetime)
|
||||||
|
history = [list(record) for record in history]
|
||||||
|
for record in history:
|
||||||
|
record.append('0')
|
||||||
return history
|
return history
|
||||||
|
|
||||||
|
|
||||||
@ -102,12 +106,10 @@ def insert_qb(history, dest):
|
|||||||
conn = open_db(dest)
|
conn = open_db(dest)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.executemany(
|
cursor.executemany(
|
||||||
'INSERT INTO History (url,title,atime) VALUES (?,?,?)', history
|
'INSERT INTO History (url,title,atime,redirect) VALUES (?,?,?,?)',
|
||||||
)
|
|
||||||
cursor.executemany(
|
|
||||||
'INSERT INTO CompletionHistory (url,title,last_atime) VALUES (?,?,?)',
|
|
||||||
history
|
history
|
||||||
)
|
)
|
||||||
|
cursor.execute('DROP TABLE CompletionHistory')
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user