# -*- org-confirm-babel-evaluate: nil; -*-

Orger converts your data into Org-mode to allow for quick access and search.

I write in detail about usecases and motivation for it [[https://beepb00p.xyz/orger.html][here]], this readme is mostly the setup manual!

* Installing

[[https://pypi.org/project/orger][PyPi]]: ~pip3 install --user orger~

* Usage and examples
There are several examples [[https://beepb00p.xyz/orger.html#examples][here]], including a [[https://www.youtube.com/watch?v=ib_PDJpTh-Q][screencast]].

See [[./modules/pocket_demo.py][pocket_demo]] for a documented literate demo and [[./modules][modules]] for some of modules I'm using.

Here's a quick minimalistic demo.

#+BEGIN_SRC python
  from orger import StaticView
  from orger.inorganic import node, link
  from orger.common import dt_heading

  import my.coding.github as github_data

  class Github(StaticView):
    def get_items(self):
      for event in github_data.get_events():
        yield node(dt_heading(event.dt, event.summary))
      
  Github.main()
#+END_SRC

That ten line program results in a file =Github.org=:

#+BEGIN_SRC org
  # AUTOGENERATED BY /code/orger/github.py

  ,* [2016-10-30 Sun 10:29] opened PR Add __enter__ and __exit__ to Pool stub
  ,* [2016-11-10 Thu 09:29] opened PR Update gradle to 2.14.1 and gradle plugin to 2.1.1
  ,* [2016-11-16 Wed 20:20] commented on issue Linker error makes it impossible to use a stack-provided ghc
  ,* [2016-12-30 Fri 11:57] commented on issue Fix performance in the rare case of hashCode evaluating to zero 
  ,* [2019-09-21 Sat 16:51] commented on issue Tags containing letters outside of a-zA-Z
  ....
#+END_SRC

I run it automatically through Cron every night.

The trick to accessing data is in ~import my.coding.github~.
You can learn about setting it up and using [[https://github.com/karlicoss/HPI][here]].


# TODO Use :session t???


** types of views
 - 
    #+BEGIN_SRC python :exports results :results raw
      import sys
      sys.path.insert(0, 'src')
      import orger
      return orger.org_view.StaticView.__doc__
    #+END_SRC
   
   You can run static module as:
  
   #+BEGIN_SRC bash
     ./orger_module.py --to /path/to/output.org
   #+END_SRC
   

 - 
    #+BEGIN_SRC python :exports results :results raw
      import sys
      sys.path.insert(0, 'src')
      import orger
      return orger.org_view.InteractiveView.__doc__
    #+END_SRC
   Typically you'd want to use these as a source of tasks for your todo list. See [[./modules/ip2org.py][ip2org]] as an example.

   You can run interactive module as:

   #+BEGIN_SRC bash
     # initialise the state file first to avoid surprises (you only need to do it once)
     ./orger_module.py --to /path/to/output.org --state /path/to/state.json --init
     # after that you can just run it:
     ./orger_module.py --to /path/to/output.org --state /path/to/state.json
   #+END_SRC

* Similar projects
- [[https://github.com/novoid/Memacs][Memacs by novoid]]
