Added option to use folders names as tags when importing (#146)
This commit is contained in:
parent
0923fa0d7f
commit
c48be129ee
17
buku.py
17
buku.py
@ -1491,8 +1491,23 @@ class BukuDb:
|
||||
except Exception as e:
|
||||
logerr(e)
|
||||
return False
|
||||
|
||||
|
||||
html_tags = soup.findAll('a')
|
||||
|
||||
|
||||
resp = input('Add imported folders names as tags? (y/n): ')
|
||||
if resp == 'y' :
|
||||
for tag in html_tags :
|
||||
possible_folder = tag.find_previous('h3') # could be its folder or not
|
||||
tag_list = tag.parent.parent.find_parent('dl') # get list of tags within that folder
|
||||
|
||||
if (possible_folder) and possible_folder.parent in list(tag_list.parents):
|
||||
# then it's the folder of this bookmark
|
||||
if tag.has_attr('tags') :
|
||||
tag['tags'] += (DELIMITER + possible_folder.text)
|
||||
else :
|
||||
tag['tags'] = possible_folder.text
|
||||
|
||||
for tag in html_tags:
|
||||
# Extract comment from <dd> tag
|
||||
desc = None
|
||||
|
Loading…
Reference in New Issue
Block a user