Change --preserve so that it can preserve everything
This commit is contained in:
parent
cd17b27e83
commit
c5e874229a
10
buku
10
buku
@ -796,7 +796,10 @@ class BukuDb:
|
|||||||
ret = False
|
ret = False
|
||||||
|
|
||||||
preserve_title = False
|
preserve_title = False
|
||||||
|
preserve_desc = False
|
||||||
if preserve is not None:
|
if preserve is not None:
|
||||||
|
if len(preserve) == 0:
|
||||||
|
preserve = ['url', 'tag', 'comment', 'title']
|
||||||
for option in preserve:
|
for option in preserve:
|
||||||
if option == "url":
|
if option == "url":
|
||||||
url = None
|
url = None
|
||||||
@ -804,6 +807,7 @@ class BukuDb:
|
|||||||
tags_in = None
|
tags_in = None
|
||||||
elif option == "comment":
|
elif option == "comment":
|
||||||
desc = None
|
desc = None
|
||||||
|
preserve_desc = True
|
||||||
elif option == "title":
|
elif option == "title":
|
||||||
title_in = None
|
title_in = None
|
||||||
preserve_title = True
|
preserve_title = True
|
||||||
@ -873,7 +877,7 @@ class BukuDb:
|
|||||||
ptags = None
|
ptags = None
|
||||||
if title_in is not None:
|
if title_in is not None:
|
||||||
title_to_insert = title_in
|
title_to_insert = title_in
|
||||||
elif url is not None and url != '' and not preserve_title:
|
elif url is not None and url != '':
|
||||||
title_to_insert, pdesc, ptags, mime, bad = network_handler(url)
|
title_to_insert, pdesc, ptags, mime, bad = network_handler(url)
|
||||||
if bad:
|
if bad:
|
||||||
print('Malformed URL')
|
print('Malformed URL')
|
||||||
@ -884,7 +888,7 @@ class BukuDb:
|
|||||||
else:
|
else:
|
||||||
LOGDBG('Title: [%s]', title_to_insert)
|
LOGDBG('Title: [%s]', title_to_insert)
|
||||||
|
|
||||||
if not desc:
|
if not desc and not preserve_desc:
|
||||||
if not pdesc:
|
if not pdesc:
|
||||||
pdesc = ''
|
pdesc = ''
|
||||||
query += ' desc = ?,'
|
query += ' desc = ?,'
|
||||||
@ -896,7 +900,7 @@ class BukuDb:
|
|||||||
self.print_rec(index)
|
self.print_rec(index)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
if title_to_insert is not None:
|
if title_to_insert is not None and not preserve_title:
|
||||||
query += ' metadata = ?,'
|
query += ' metadata = ?,'
|
||||||
arguments += (title_to_insert,)
|
arguments += (title_to_insert,)
|
||||||
to_update = True
|
to_update = True
|
||||||
|
Loading…
Reference in New Issue
Block a user