nicer processing
This commit is contained in:
parent
d24f7e18f2
commit
592fec86be
1 changed files with 25 additions and 32 deletions
|
@ -57,15 +57,18 @@ class Loader:
|
||||||
meta['pagemarks'].zoom()
|
meta['pagemarks'].zoom()
|
||||||
if 'notes' in meta:
|
if 'notes' in meta:
|
||||||
# TODO something nicer?
|
# TODO something nicer?
|
||||||
meta['notes'].zoom()
|
notes = meta['notes'].zoom()
|
||||||
meta['comments'].zoom()
|
else:
|
||||||
|
notes = [] # TODO FIXME dict?
|
||||||
|
comments = meta['comments'].zoom()
|
||||||
meta['questions'].zoom()
|
meta['questions'].zoom()
|
||||||
meta['flashcards'].zoom()
|
meta['flashcards'].zoom()
|
||||||
meta['textHighlights'].zoom()
|
highlights = meta['textHighlights'].zoom()
|
||||||
meta['areaHighlights'].zoom()
|
meta['areaHighlights'].zoom()
|
||||||
meta['screenshots'].zoom()
|
meta['screenshots'].zoom()
|
||||||
meta['thumbnails'].zoom()
|
meta['thumbnails'].zoom()
|
||||||
meta['readingProgress'].zoom()
|
if 'readingProgress' in meta:
|
||||||
|
meta['readingProgress'].zoom()
|
||||||
|
|
||||||
# TODO want to ignore the whold subtree..
|
# TODO want to ignore the whold subtree..
|
||||||
pi = meta['pageInfo'].zoom()
|
pi = meta['pageInfo'].zoom()
|
||||||
|
@ -74,34 +77,23 @@ class Loader:
|
||||||
err = self.error(exx, meta)
|
err = self.error(exx, meta)
|
||||||
self.logger.exception(err)
|
self.logger.exception(err)
|
||||||
yield err
|
yield err
|
||||||
from pprint import pprint
|
return # TODO ugh, careful with unconsumed?
|
||||||
# pprint(notes)
|
|
||||||
# try:
|
|
||||||
# pm, notes, comm, que, flash, text, area, screens, thumb, rp, pi = zoom(
|
|
||||||
# meta,
|
|
||||||
# )
|
|
||||||
# except Exception as exx:
|
|
||||||
# yield echain(self.err, exx)
|
|
||||||
# return
|
|
||||||
|
|
||||||
# def aempty(x):
|
# TODO how to make it nicer?
|
||||||
# akeq(x)
|
vals = list(comments.values())
|
||||||
# try:
|
for v in vals:
|
||||||
# aempty(pm)
|
cid = v['id'].zoom()
|
||||||
# aempty(que)
|
v['guid'].zoom()
|
||||||
# aempty(flash)
|
# TODO values should probably be checked by flow analysis??
|
||||||
# aempty(text)
|
crt = v['created'].zoom()
|
||||||
# aempty(area) # TODO these should be yieldy?
|
updated = v['lastUpdated'].zoom()
|
||||||
# aempty(screens)
|
content = v['content'].zoom()
|
||||||
# aempty(rp)
|
html = content['HTML'].zoom()
|
||||||
# akeq(pi, 'num')
|
v['ref'].zoom()
|
||||||
# except Exception as ex:
|
v.consume()
|
||||||
# # TODO make it a method?
|
|
||||||
# yield echain(self.err, ex)
|
|
||||||
|
|
||||||
|
highlights.consume_all() # TODO FIXME
|
||||||
# aempty(notes)
|
# TODO need to process text highlights...
|
||||||
# yield Item(self.uid)
|
|
||||||
|
|
||||||
|
|
||||||
def load_items(self, metas) -> Iterator[ResultItem]:
|
def load_items(self, metas) -> Iterator[ResultItem]:
|
||||||
|
@ -121,8 +113,9 @@ class Loader:
|
||||||
tags = di['tags']
|
tags = di['tags']
|
||||||
pm = j['pageMetas']
|
pm = j['pageMetas']
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.logger.exception(ex)
|
err = self.error(ex, j)
|
||||||
yield echain(self.err, ex)
|
self.logger.exception(err)
|
||||||
|
yield err
|
||||||
return
|
return
|
||||||
|
|
||||||
# TODO should I group by book???
|
# TODO should I group by book???
|
||||||
|
|
Loading…
Add table
Reference in a new issue