From 844ebf28c12bd8bfe89541d75da94ad4e1572a67 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 15 May 2020 11:47:37 +0100 Subject: [PATCH] polar: extract book tags --- my/reading/polar.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/my/reading/polar.py b/my/reading/polar.py index 5b2ecae..bcd712f 100755 --- a/my/reading/polar.py +++ b/my/reading/polar.py @@ -76,6 +76,8 @@ class Book(NamedTuple): # think about it later. items: Sequence[Highlight] + tags: Sequence[str] + @property def filename(self) -> str: # TODO deprecate @@ -188,9 +190,11 @@ class Loader: added = di['added'] filename = di['filename'] # TODO here title = di.get('title', None) - tags = di['tags'] + tags_dict = di['tags'] pm = j['pageMetas'] + # todo defensive? + tags = tuple(t['label'] for t in tags_dict.values()) path = Path(config.polar_dir) / 'stash' / filename @@ -200,6 +204,7 @@ class Loader: path=path, title=title, items=list(self.load_items(pm)), + tags=tags, )