Beispiel #1
0
 def get_items(self):
     for i in get_drill_items():
         yield i.eid, todo(
             i.dt,
             heading=i.text,
             tags=['drill'],
             body=f'from {i.book.title}\n',
         )
Beispiel #2
0
 def get_items(self):
     for t in get_todos():
         # TODO shit judging by the state.json, looks like eid might be flaky?
         yield t.eid, todo(
             t.dt,
             heading=t.text,
             tags=['kobo2org'],
             body=f'{t.annotation}\nfrom {t.book}\n',
         )
Beispiel #3
0
 def get_items(self) -> Queue.Results:
     for t in get_todos():
         # TODO shit judging by the state.json, looks like eid might be flaky?
         yield t.eid, todo(
             t.dt,
             heading=t.text,
             tags=['kobo2org'],  # todo allow to override tag from cmdline?
             body=f'{t.annotation}\nfrom {t.book}\n',
         )
Beispiel #4
0
 def get_items(self):
     for t in get_todos():
         # TODO move erorr handling to base renderer?
         yield t.uid, todo(
             dt=t.dt,
             heading=t.text,
             tags=['ip2org'],
             body=
             f'{t.note}\nfrom {link(title="ip", url=t.instapaper_link)}   {link(title=t.title, url=t.url)}',
         )
Beispiel #5
0
 def get_items(self):
     now = datetime.now(tz=pytz.timezone(TIMEZONE))
     # TODO extract date from messages?
     for timestamp, name, tags, lines in fetch_tg_tasks(logger=self.logger):
         yield str(timestamp), todo(
             now,
             heading=name,
             tags=tags,
             body='\n'.join(lines + ['']),
         )
Beispiel #6
0
    def get_items(self):
        for t in filter(is_todo, get_highlights()):
            yield t.id, todo(
                dt=t.dt,
                heading=t.highlight,
                tags=['hyp2org', *t.tags],
                body=f'''
{t.annotation}
{link(title=t.page_title, url=t.page_link)}
{link(title="in context", url=t.hyp_link)}
'''.lstrip(),
            )
Beispiel #7
0
    def get_items(self):
        for t in get_todos():
            # TODO move erorr handling to base renderer?
            hl = t.highlight
            bm = t.bookmark
            yield hl.hid, todo(
                dt=hl.dt,

                heading=hl.text,
                tags=['ip2org'],
                body=f'{hl.note}\nfrom {link(title="ip", url=hl.instapaper_link)}   {link(title=bm.title, url=bm.url)}',
            )
Beispiel #8
0
 def get_items(self) -> Queue.Results:
     for page in pages():
         bm = page.bookmark
         for hl in page.highlights:
             if not is_todo(hl):
                 continue
             yield hl.hid, todo(
                 # todo dt_heading? not sure. Maybe this should be configurable
                 dt=hl.dt,
                 heading=link(title="X", url=hl.instapaper_link) + ' ' + hl.text,
                 tags=['ip2org'],
                 body=f'{hl.note}\nfrom {link(title=bm.title, url=bm.url)}',
             )
Beispiel #9
0
 def get_items(self):
     for t in highlights():
         if isinstance(t, Exception):
             # I guess there isn't much we can do here? will be spotted by other tools
             continue
         if not is_todo(t):
             continue
         ann = t.annotation
         anns = '' if ann is None else ann + '\n'
         yield t.hid, todo(
             dt=t.created,
             heading=link(title="X", url=t.hyp_link) + ' ' + t.highlight,
             body=f'{anns}from {link(title=t.title, url=t.url)}',
             tags=['hyp2org', *t.tags],
         )
Beispiel #10
0
    def get_items(self):
        db = self.cmdline_args.db
        for c in dataset.connect(f'sqlite:///{db}')['comments'].all():
            author = c['author']
            if author == 'karlicoss':
                continue # ignore my own comments

            text   = c['text']
            cid    = str(c['id'])
            ts     = c['created']
            dt = datetime.utcfromtimestamp(ts)
            # TODO tid for isso_id and proper link?
            yield cid, todo(
                dt=dt,
                heading=f'{author}: {text}',
                tags=['blog'], # TODO maybe allow specifying : separated?
            )
Beispiel #11
0
    def get_items(self):
        for t in get_highlights():
            if isinstance(t, Exception):
                # I guess there isn't much we can do here? will be spotted by other tools
                continue
            if not is_todo(t):
                continue
            yield t.hid, todo(
                dt=t.created,
                heading=t.highlight,
                tags=['hyp2org', *t.tags],
                body=f'''
{t.annotation}
{link(title=t.title, url=t.url)}
{link(title="in context", url=t.hyp_link)}
'''.lstrip(),
            )
Beispiel #12
0
    def get_items(self):
        db = self.cmdline_args.db
        # https://www.sqlite.org/draft/uri.html#uriimmutable
        import sqlite3
        creator = lambda: sqlite3.connect(f'file:{db}?immutable=1', uri=True)
        for c in dataset.connect('sqlite:///', engine_kwargs={'creator': creator})['comments'].all():
            author = c['author']
            if author == 'karlicoss':
                continue # ignore my own comments

            text   = c['text']
            cid    = str(c['id'])
            ts     = c['created']
            dt = datetime.utcfromtimestamp(ts)
            # TODO tid for isso_id and proper link?
            yield cid, todo(
                dt=dt,
                heading=f'{author}: {text}',
                tags=['blog'], # TODO maybe allow specifying : separated?
            )
Beispiel #13
0
 def get_items(self) -> Queue.Results:
     for t in highlights():
         if isinstance(t, Exception):
             # todo make error helper work with Queue
             # probably hash of the body would be enough? dunno
             # I guess there isn't much we can do here? will be spotted by other tools
             continue
         if not is_todo(t):
             continue
         ann = t.annotation
         anns = '' if ann is None else ann + '\n'
         hl = t.highlight or ''
         yield t.hid, todo(
             dt=t.created,
             heading=link(title="X", url=t.hyp_link) + ' ' + hl,
             body=f'{anns}from {link(title=t.title, url=t.url)}',
             # todo maybe get rid of hyp2org?
             # or make tagging an option?
             tags=['hyp2org', *t.tags],
         )