chg: dev: merge code when adding record
This commit is contained in:
parent
433a943cb9
commit
9209f3e7fa
17
buku.py
17
buku.py
@ -2277,15 +2277,11 @@ class BukuDb:
|
|||||||
else:
|
else:
|
||||||
append_tags_resp = 'n'
|
append_tags_resp = 'n'
|
||||||
|
|
||||||
|
items = []
|
||||||
if filepath.endswith('.md'):
|
if filepath.endswith('.md'):
|
||||||
for item in import_md(filepath=filepath, newtag=newtag):
|
items = import_md(filepath=filepath, newtag=newtag)
|
||||||
self.add_rec(*item)
|
|
||||||
|
|
||||||
self.conn.commit()
|
|
||||||
|
|
||||||
elif filepath.endswith('org'):
|
elif filepath.endswith('org'):
|
||||||
for item in import_org(filepath=filepath, newtag=newtag):
|
items = import_org(filepath=filepath, newtag=newtag)
|
||||||
self.add_rec(*item)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -2305,13 +2301,16 @@ class BukuDb:
|
|||||||
resp = 'y'
|
resp = 'y'
|
||||||
|
|
||||||
add_parent_folder_as_tag = (resp == 'y')
|
add_parent_folder_as_tag = (resp == 'y')
|
||||||
for item in import_html(soup, add_parent_folder_as_tag, newtag):
|
items = import_html(soup, add_parent_folder_as_tag, newtag)
|
||||||
|
infp.close()
|
||||||
|
|
||||||
|
for item in items:
|
||||||
add_rec_res = self.add_rec(*item)
|
add_rec_res = self.add_rec(*item)
|
||||||
if add_rec_res == -1 and append_tags_resp == 'y':
|
if add_rec_res == -1 and append_tags_resp == 'y':
|
||||||
rec_id = self.get_rec_id(item[0])
|
rec_id = self.get_rec_id(item[0])
|
||||||
self.append_tag_at_index(rec_id, item[2])
|
self.append_tag_at_index(rec_id, item[2])
|
||||||
|
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
infp.close()
|
|
||||||
|
|
||||||
if newtag:
|
if newtag:
|
||||||
print('\nAuto-generated tag: %s' % newtag)
|
print('\nAuto-generated tag: %s' % newtag)
|
||||||
|
Loading…
Reference in New Issue
Block a user