polar: extract book tags
This commit is contained in:
parent
759b0e1324
commit
844ebf28c1
1 changed files with 6 additions and 1 deletions
|
@ -76,6 +76,8 @@ class Book(NamedTuple):
|
||||||
# think about it later.
|
# think about it later.
|
||||||
items: Sequence[Highlight]
|
items: Sequence[Highlight]
|
||||||
|
|
||||||
|
tags: Sequence[str]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def filename(self) -> str:
|
def filename(self) -> str:
|
||||||
# TODO deprecate
|
# TODO deprecate
|
||||||
|
@ -188,9 +190,11 @@ class Loader:
|
||||||
added = di['added']
|
added = di['added']
|
||||||
filename = di['filename'] # TODO here
|
filename = di['filename'] # TODO here
|
||||||
title = di.get('title', None)
|
title = di.get('title', None)
|
||||||
tags = di['tags']
|
tags_dict = di['tags']
|
||||||
pm = j['pageMetas']
|
pm = j['pageMetas']
|
||||||
|
|
||||||
|
# todo defensive?
|
||||||
|
tags = tuple(t['label'] for t in tags_dict.values())
|
||||||
|
|
||||||
path = Path(config.polar_dir) / 'stash' / filename
|
path = Path(config.polar_dir) / 'stash' / filename
|
||||||
|
|
||||||
|
@ -200,6 +204,7 @@ class Loader:
|
||||||
path=path,
|
path=path,
|
||||||
title=title,
|
title=title,
|
||||||
items=list(self.load_items(pm)),
|
items=list(self.load_items(pm)),
|
||||||
|
tags=tags,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue